Merge "Added OverScroller and overscroll effects for ScrollView and HorizontalScrollView."
diff --git a/Android.mk b/Android.mk
index 568352e..7520afe 100644
--- a/Android.mk
+++ b/Android.mk
@@ -117,6 +117,7 @@
core/java/android/os/IParentalControlCallback.aidl \
core/java/android/os/IPermissionController.aidl \
core/java/android/os/IPowerManager.aidl \
+ core/java/android/os/IRemoteCallback.aidl \
core/java/android/os/IVibratorService.aidl \
core/java/android/service/wallpaper/IWallpaperConnection.aidl \
core/java/android/service/wallpaper/IWallpaperEngine.aidl \
@@ -136,6 +137,7 @@
core/java/android/speech/tts/ITtsCallback.aidl \
core/java/com/android/internal/app/IBatteryStats.aidl \
core/java/com/android/internal/app/IUsageStats.aidl \
+ core/java/com/android/internal/app/IMediaContainerService.aidl \
core/java/com/android/internal/appwidget/IAppWidgetService.aidl \
core/java/com/android/internal/appwidget/IAppWidgetHost.aidl \
core/java/com/android/internal/backup/IBackupTransport.aidl \
diff --git a/api/current.xml b/api/current.xml
index 527ffe3..d79b5cc 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -3184,7 +3184,7 @@
value="16843395"
static="true"
final="true"
- deprecated="deprecated"
+ deprecated="not deprecated"
visibility="public"
>
</field>
@@ -3261,7 +3261,7 @@
value="16843362"
static="true"
final="true"
- deprecated="deprecated"
+ deprecated="not deprecated"
visibility="public"
>
</field>
@@ -5131,7 +5131,7 @@
value="16842997"
static="true"
final="true"
- deprecated="deprecated"
+ deprecated="not deprecated"
visibility="public"
>
</field>
@@ -5252,7 +5252,7 @@
value="16842996"
static="true"
final="true"
- deprecated="deprecated"
+ deprecated="not deprecated"
visibility="public"
>
</field>
@@ -16176,11 +16176,26 @@
synchronized="false"
static="false"
final="false"
+ deprecated="deprecated"
+ visibility="protected"
+>
+<parameter name="id" type="int">
+</parameter>
+</method>
+<method name="onCreateDialog"
+ return="android.app.Dialog"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
deprecated="not deprecated"
visibility="protected"
>
<parameter name="id" type="int">
</parameter>
+<parameter name="args" type="android.os.Bundle">
+</parameter>
</method>
<method name="onCreateOptionsMenu"
return="boolean"
@@ -16476,6 +16491,21 @@
synchronized="false"
static="false"
final="false"
+ deprecated="deprecated"
+ visibility="protected"
+>
+<parameter name="id" type="int">
+</parameter>
+<parameter name="dialog" type="android.app.Dialog">
+</parameter>
+</method>
+<method name="onPrepareDialog"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
deprecated="not deprecated"
visibility="protected"
>
@@ -16483,6 +16513,8 @@
</parameter>
<parameter name="dialog" type="android.app.Dialog">
</parameter>
+<parameter name="args" type="android.os.Bundle">
+</parameter>
</method>
<method name="onPrepareOptionsMenu"
return="boolean"
@@ -17110,6 +17142,21 @@
<parameter name="id" type="int">
</parameter>
</method>
+<method name="showDialog"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="id" type="int">
+</parameter>
+<parameter name="args" type="android.os.Bundle">
+</parameter>
+</method>
<method name="startActivityForResult"
return="void"
abstract="false"
@@ -19895,6 +19942,21 @@
<parameter name="context" type="android.content.Context">
</parameter>
</method>
+<method name="onDisableRequested"
+ return="java.lang.CharSequence"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="intent" type="android.content.Intent">
+</parameter>
+</method>
<method name="onDisabled"
return="void"
abstract="false"
@@ -19996,6 +20058,17 @@
visibility="public"
>
</field>
+<field name="ACTION_DEVICE_ADMIN_DISABLE_REQUESTED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="ACTION_DEVICE_ADMIN_ENABLED"
type="java.lang.String"
transient="false"
@@ -20051,6 +20124,17 @@
visibility="public"
>
</field>
+<field name="EXTRA_DISABLE_WARNING"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.app.extra.DISABLE_WARNING""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
<class name="DeviceAdminInfo"
extends="java.lang.Object"
@@ -20148,6 +20232,34 @@
visibility="public"
>
</method>
+<method name="getTagForPolicy"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="policyIdent" type="int">
+</parameter>
+</method>
+<method name="loadDescription"
+ return="java.lang.CharSequence"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pm" type="android.content.pm.PackageManager">
+</parameter>
+<exception name="Resources.NotFoundException" type="android.content.res.Resources.NotFoundException">
+</exception>
+</method>
<method name="loadIcon"
return="android.graphics.drawable.Drawable"
abstract="false"
@@ -20174,6 +20286,19 @@
<parameter name="pm" type="android.content.pm.PackageManager">
</parameter>
</method>
+<method name="usesPolicy"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="policyIdent" type="int">
+</parameter>
+</method>
<method name="writeToParcel"
return="void"
abstract="false"
@@ -20199,6 +20324,72 @@
visibility="public"
>
</field>
+<field name="USES_POLICY_FORCE_LOCK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="USES_POLICY_LIMIT_PASSWORD"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="USES_POLICY_LIMIT_UNLOCK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="USES_POLICY_RESET_PASSWORD"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="USES_POLICY_WATCH_LOGIN"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="USES_POLICY_WIPE_DATA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
<class name="DevicePolicyManager"
extends="java.lang.Object"
@@ -20208,6 +20399,17 @@
deprecated="not deprecated"
visibility="public"
>
+<method name="getActiveAdmins"
+ return="java.util.List<android.content.ComponentName>"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getCurrentFailedPasswordAttempts"
return="int"
abstract="false"
@@ -20313,6 +20515,21 @@
<parameter name="password" type="java.lang.String">
</parameter>
</method>
+<method name="setMaximumFailedPasswordsForWipe"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="admin" type="android.content.ComponentName">
+</parameter>
+<parameter name="num" type="int">
+</parameter>
+</method>
<method name="setMaximumTimeToLock"
return="void"
abstract="false"
@@ -20393,6 +20610,17 @@
visibility="public"
>
</field>
+<field name="EXTRA_ADD_EXPLANATION"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.app.extra.ADD_EXPLANATION""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="EXTRA_DEVICE_ADMIN"
type="java.lang.String"
transient="false"
@@ -40253,6 +40481,16 @@
visibility="public"
>
</field>
+<field name="delayUntil"
+ type="long"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="fullSyncRequested"
type="boolean"
transient="false"
@@ -41557,6 +41795,16 @@
visibility="public"
>
</field>
+<field name="descriptionRes"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="enabled"
type="boolean"
transient="false"
@@ -55200,6 +55448,88 @@
>
</field>
</class>
+<class name="GestureUtilities"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="computeOrientedBoundingBox"
+ return="android.gesture.OrientedBoundingBox"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="originalPoints" type="java.util.ArrayList<android.gesture.GesturePoint>">
+</parameter>
+</method>
+<method name="computeOrientedBoundingBox"
+ return="android.gesture.OrientedBoundingBox"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="originalPoints" type="float[]">
+</parameter>
+</method>
+<method name="spatialSampling"
+ return="float[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="gesture" type="android.gesture.Gesture">
+</parameter>
+<parameter name="bitmapSize" type="int">
+</parameter>
+</method>
+<method name="spatialSampling"
+ return="float[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="gesture" type="android.gesture.Gesture">
+</parameter>
+<parameter name="bitmapSize" type="int">
+</parameter>
+<parameter name="keepAspectRatio" type="boolean">
+</parameter>
+</method>
+<method name="temporalSampling"
+ return="float[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="stroke" type="android.gesture.GestureStroke">
+</parameter>
+<parameter name="numPoints" type="int">
+</parameter>
+</method>
+</class>
<class name="OrientedBoundingBox"
extends="java.lang.Object"
abstract="false"
@@ -69326,6 +69656,19 @@
visibility="public"
>
</method>
+<method name="setDisplayOrientation"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="degrees" type="int">
+</parameter>
+</method>
<method name="setErrorCallback"
return="void"
abstract="false"
@@ -119751,6 +120094,28 @@
visibility="public"
>
</field>
+<field name="EXTRA_HEADERS_KEY"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""com.android.browser.headers_key""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_HEADERS_VALUE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""com.android.browser.headers_value""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="HISTORY_PROJECTION"
type="java.lang.String[]"
transient="false"
@@ -130602,6 +130967,17 @@
visibility="public"
>
</field>
+<field name="ACTION_DEVICE_INFO_SETTINGS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.settings.DEVICE_INFO_SETTINGS""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="ACTION_DISPLAY_SETTINGS"
type="java.lang.String"
transient="false"
@@ -131044,6 +131420,21 @@
<parameter name="name" type="java.lang.String">
</parameter>
</method>
+<method name="isLocationProviderEnabled"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="cr" type="android.content.ContentResolver">
+</parameter>
+<parameter name="provider" type="java.lang.String">
+</parameter>
+</method>
<method name="putFloat"
return="boolean"
abstract="false"
@@ -131112,6 +131503,23 @@
<parameter name="value" type="java.lang.String">
</parameter>
</method>
+<method name="setLocationProviderEnabled"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="cr" type="android.content.ContentResolver">
+</parameter>
+<parameter name="provider" type="java.lang.String">
+</parameter>
+<parameter name="enabled" type="boolean">
+</parameter>
+</method>
<field name="ACCESSIBILITY_ENABLED"
type="java.lang.String"
transient="false"
@@ -132444,6 +132852,39 @@
visibility="public"
>
</field>
+<field name="SCREEN_BRIGHTNESS_MODE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""screen_brightness_mode""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SCREEN_BRIGHTNESS_MODE_AUTOMATIC"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SCREEN_BRIGHTNESS_MODE_MANUAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="SCREEN_OFF_TIMEOUT"
type="java.lang.String"
transient="false"
@@ -134065,6 +134506,320 @@
</package>
<package name="android.speech"
>
+<interface name="RecognitionListener"
+ abstract="true"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onBeginningOfSpeech"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="onBufferReceived"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="buffer" type="byte[]">
+</parameter>
+</method>
+<method name="onEndOfSpeech"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="onError"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="error" type="int">
+</parameter>
+</method>
+<method name="onInit"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="onPartialResults"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="partialResults" type="android.os.Bundle">
+</parameter>
+</method>
+<method name="onReadyForSpeech"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="params" type="android.os.Bundle">
+</parameter>
+</method>
+<method name="onResults"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="results" type="android.os.Bundle">
+</parameter>
+</method>
+<method name="onRmsChanged"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="rmsdB" type="float">
+</parameter>
+</method>
+</interface>
+<class name="RecognitionManager"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="cancel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="createRecognitionManager"
+ return="android.speech.RecognitionManager"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="listener" type="android.speech.RecognitionListener">
+</parameter>
+<parameter name="recognizerIntent" type="android.content.Intent">
+</parameter>
+</method>
+<method name="destroy"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isRecognitionAvailable"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+</method>
+<method name="startListening"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="recognizerIntent" type="android.content.Intent">
+</parameter>
+</method>
+<method name="stopListening"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<field name="AUDIO_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="CLIENT_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="MANAGER_NOT_INITIALIZED_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="9"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="NETWORK_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="NETWORK_TIMEOUT_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="NO_MATCH_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="RECOGNITION_RESULTS_STRING_ARRAY"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""recognition_results_string_array""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SERVER_BUSY_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="8"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SERVER_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SPEECH_TIMEOUT_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="6"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
<class name="RecognizerIntent"
extends="java.lang.Object"
abstract="false"
@@ -134084,6 +134839,17 @@
visibility="public"
>
</field>
+<field name="ACTION_VOICE_SEARCH_SETTINGS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.speech.action.VOICE_SEARCH_SETTINGS""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="ACTION_WEB_SEARCH"
type="java.lang.String"
transient="false"
@@ -134172,6 +134938,39 @@
visibility="public"
>
</field>
+<field name="EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.speech.extras.SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.speech.extras.SPEECH_INPUT_MINIMUM_LENGTH_MILLIS""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.speech.extras.SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="LANGUAGE_MODEL_FREE_FORM"
type="java.lang.String"
transient="false"
@@ -168804,6 +169603,19 @@
visibility="public"
>
</method>
+<method name="dispatchDisplayHint"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="hint" type="int">
+</parameter>
+</method>
<method name="dispatchDraw"
return="void"
abstract="false"
@@ -170532,6 +171344,19 @@
visibility="protected"
>
</method>
+<method name="onDisplayHint"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="hint" type="int">
+</parameter>
+</method>
<method name="onDraw"
return="void"
abstract="false"
@@ -189207,6 +190032,21 @@
>
<parameter name="url" type="java.lang.String">
</parameter>
+<parameter name="extraHeaders" type="java.util.Map<java.lang.String, java.lang.String>">
+</parameter>
+</method>
+<method name="loadUrl"
+ 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="onChildViewAdded"
return="void"
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp
index a8e217e..81d60dc 100644
--- a/camera/libcameraservice/CameraService.cpp
+++ b/camera/libcameraservice/CameraService.cpp
@@ -1191,14 +1191,6 @@
CameraParameters p(params);
- // The orientation parameter is actually for CameraService, not for the camera driver.
- if (p.getOrientation() == CameraParameters::CAMERA_ORIENTATION_PORTRAIT) {
- LOGV("portrait mode");
- mOrientation = ISurface::BufferHeap::ROT_90;
- } else {
- mOrientation = 0;
- }
-
return mHardware->setParameters(p);
}
@@ -1224,6 +1216,30 @@
status_t result = checkPid();
if (result != NO_ERROR) return result;
+ if (cmd == CAMERA_CMD_SET_DISPLAY_ORIENTATION) {
+ // The orientation cannot be set during preview.
+ if (mHardware->previewEnabled()) {
+ return INVALID_OPERATION;
+ }
+ switch (arg1) {
+ case 0:
+ mOrientation = ISurface::BufferHeap::ROT_0;
+ break;
+ case 90:
+ mOrientation = ISurface::BufferHeap::ROT_90;
+ break;
+ case 180:
+ mOrientation = ISurface::BufferHeap::ROT_180;
+ break;
+ case 270:
+ mOrientation = ISurface::BufferHeap::ROT_270;
+ break;
+ default:
+ return BAD_VALUE;
+ }
+ return OK;
+ }
+
if (mHardware == 0) {
LOGE("mHardware is NULL, returning.");
return INVALID_OPERATION;
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index 9300915..78f90a1 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -129,7 +129,7 @@
dump_file("LAST PANIC CONSOLE", "/data/dontpanic/apanic_console");
dump_file("LAST PANIC THREADS", "/data/dontpanic/apanic_threads");
- printf("----- BACKLIGHTS -----\n");
+ printf("------ BACKLIGHTS ------\n");
printf("LCD brightness=");
dump_file(NULL, "/sys/class/leds/lcd-backlight/brightness");
printf("Button brightness=");
diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c
index fda618c..39e14e4 100644
--- a/cmds/dumpstate/utils.c
+++ b/cmds/dumpstate/utils.c
@@ -43,13 +43,13 @@
int fd = open(path, O_RDONLY);
if (fd < 0) {
int err = errno;
- if (title) printf("----- %s (%s) -----\n", title, path);
+ if (title) printf("------ %s (%s) ------\n", title, path);
printf("*** %s: %s\n", path, strerror(err));
if (title) printf("\n");
return -1;
}
- if (title) printf("----- %s (%s", title, path);
+ if (title) printf("------ %s (%s", title, path);
if (title) {
struct stat st;
@@ -59,7 +59,7 @@
strftime(stamp, sizeof(stamp), "%Y-%m-%d %H:%M:%S", localtime(&mtime));
printf(": %s", stamp);
}
- printf(") -----\n");
+ printf(") ------\n");
}
int newline = 0;
@@ -97,13 +97,13 @@
va_list ap;
va_start(ap, command);
- if (title) printf("----- %s (%s", title, command);
+ if (title) printf("------ %s (%s", title, command);
for (arg = 1; arg < sizeof(args) / sizeof(args[0]); ++arg) {
args[arg] = va_arg(ap, const char *);
if (args[arg] == NULL) break;
if (title) printf(" %s", args[arg]);
}
- if (title) printf(") -----\n");
+ if (title) printf(") ------\n");
fflush(stdout);
execvp(command, (char**) args);
@@ -159,7 +159,7 @@
property_list(print_prop, NULL);
qsort(&props, num_props, sizeof(props[0]), compare_prop);
- printf("----- SYSTEM PROPERTIES -----\n");
+ printf("------ SYSTEM PROPERTIES ------\n");
for (i = 0; i < num_props; ++i) {
fputs(props[i], stdout);
free(props[i]);
diff --git a/cmds/installd/utils.c b/cmds/installd/utils.c
index 5db5545..555c19e 100644
--- a/cmds/installd/utils.c
+++ b/cmds/installd/utils.c
@@ -33,6 +33,7 @@
}
x = pkgname;
+ int alpha = -1;
while (*x) {
if (isalnum(*x) || (*x == '_')) {
/* alphanumeric or underscore are fine */
@@ -42,13 +43,28 @@
LOGE("invalid package name '%s'\n", pkgname);
return -1;
}
- } else {
+ } else if (*x == '-') {
+ /* Suffix -X is fine to let versioning of packages.
+ But whatever follows should be alphanumeric.*/
+ alpha = 1;
+ }else {
/* anything not A-Z, a-z, 0-9, _, or . is invalid */
LOGE("invalid package name '%s'\n", pkgname);
return -1;
}
x++;
}
+ if (alpha == 1) {
+ // Skip current character
+ x++;
+ while (*x) {
+ if (!isalnum(*x)) {
+ LOGE("invalid package name '%s' should include only numbers after -\n", pkgname);
+ return -1;
+ }
+ x++;
+ }
+ }
sprintf(path, "%s%s%s", prefix, pkgname, postfix);
return 0;
diff --git a/cmds/stagefright/audioloop.cpp b/cmds/stagefright/audioloop.cpp
index 3788e73..8733662 100644
--- a/cmds/stagefright/audioloop.cpp
+++ b/cmds/stagefright/audioloop.cpp
@@ -1,7 +1,10 @@
#include "SineSource.h"
#include <binder/ProcessState.h>
+#include <media/mediarecorder.h>
+#include <media/stagefright/AMRWriter.h>
#include <media/stagefright/AudioPlayer.h>
+#include <media/stagefright/AudioSource.h>
#include <media/stagefright/MediaDebug.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MetaData.h>
@@ -21,7 +24,16 @@
OMXClient client;
CHECK_EQ(client.connect(), OK);
+#if 0
sp<MediaSource> source = new SineSource(kSampleRate, kNumChannels);
+#else
+ sp<MediaSource> source = new AudioSource(
+ AUDIO_SOURCE_DEFAULT,
+ kSampleRate,
+ kNumChannels == 1
+ ? AudioSystem::CHANNEL_IN_MONO
+ : AudioSystem::CHANNEL_IN_STEREO);
+#endif
sp<MetaData> meta = new MetaData;
@@ -43,12 +55,19 @@
meta, true /* createEncoder */,
source);
+#if 1
+ sp<AMRWriter> writer = new AMRWriter("/sdcard/out.amr");
+ writer->addSource(encoder);
+ writer->start();
+ sleep(10);
+ writer->stop();
+#else
sp<MediaSource> decoder = OMXCodec::Create(
client.interface(),
meta, false /* createEncoder */,
encoder);
-#if 1
+#if 0
AudioPlayer *player = new AudioPlayer(NULL);
player->setSource(decoder);
@@ -60,7 +79,7 @@
delete player;
player = NULL;
-#else
+#elif 0
CHECK_EQ(decoder->start(), OK);
MediaBuffer *buffer;
@@ -76,6 +95,7 @@
CHECK_EQ(decoder->stop(), OK);
#endif
+#endif
return 0;
}
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index ee26d3c..e3ccd00 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -506,7 +506,7 @@
+ ", " + (mFeatures != null ? TextUtils.join(",", mFeatures) : null);
}
}
-
+
public void removeAccount(IAccountManagerResponse response, Account account) {
checkManageAccountsPermission();
long identityToken = clearCallingIdentity();
@@ -1660,9 +1660,16 @@
}
}
} else {
+ Account[] accounts = getAccounts(null /* type */);
+ fout.println("Accounts: " + accounts.length);
+ for (Account account : accounts) {
+ fout.println(" " + account);
+ }
+
+ fout.println();
synchronized (mSessions) {
final long now = SystemClock.elapsedRealtime();
- fout.println("AccountManagerService: " + mSessions.size() + " sessions");
+ fout.println("Active Sessions: " + mSessions.size());
for (Session session : mSessions.values()) {
fout.println(" " + session.toDebugString(now));
}
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 1c3414d..05bbf3b 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -39,6 +39,7 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
+import android.os.Looper;
import android.os.RemoteException;
import android.text.Selection;
import android.text.SpannableStringBuilder;
@@ -608,8 +609,13 @@
private static final String SAVED_DIALOG_IDS_KEY = "android:savedDialogIds";
private static final String SAVED_DIALOGS_TAG = "android:savedDialogs";
private static final String SAVED_DIALOG_KEY_PREFIX = "android:dialog_";
+ private static final String SAVED_DIALOG_ARGS_KEY_PREFIX = "android:dialog_args_";
- private SparseArray<Dialog> mManagedDialogs;
+ private static class ManagedDialog {
+ Dialog mDialog;
+ Bundle mArgs;
+ }
+ private SparseArray<ManagedDialog> mManagedDialogs;
// set by the thread after the constructor and before onCreate(Bundle savedInstanceState) is called.
private Instrumentation mInstrumentation;
@@ -850,35 +856,41 @@
final int[] ids = b.getIntArray(SAVED_DIALOG_IDS_KEY);
final int numDialogs = ids.length;
- mManagedDialogs = new SparseArray<Dialog>(numDialogs);
+ mManagedDialogs = new SparseArray<ManagedDialog>(numDialogs);
for (int i = 0; i < numDialogs; i++) {
final Integer dialogId = ids[i];
Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
if (dialogState != null) {
// Calling onRestoreInstanceState() below will invoke dispatchOnCreate
// so tell createDialog() not to do it, otherwise we get an exception
- final Dialog dialog = createDialog(dialogId, dialogState);
- mManagedDialogs.put(dialogId, dialog);
- onPrepareDialog(dialogId, dialog);
- dialog.onRestoreInstanceState(dialogState);
+ final ManagedDialog md = new ManagedDialog();
+ md.mArgs = b.getBundle(savedDialogArgsKeyFor(dialogId));
+ md.mDialog = createDialog(dialogId, dialogState, md.mArgs);
+ if (md.mDialog != null) {
+ mManagedDialogs.put(dialogId, md);
+ onPrepareDialog(dialogId, md.mDialog, md.mArgs);
+ md.mDialog.onRestoreInstanceState(dialogState);
+ }
}
}
}
- private Dialog createDialog(Integer dialogId, Bundle state) {
- final Dialog dialog = onCreateDialog(dialogId);
+ private Dialog createDialog(Integer dialogId, Bundle state, Bundle args) {
+ final Dialog dialog = onCreateDialog(dialogId, args);
if (dialog == null) {
- throw new IllegalArgumentException("Activity#onCreateDialog did "
- + "not create a dialog for id " + dialogId);
+ return null;
}
dialog.dispatchOnCreate(state);
return dialog;
}
- private String savedDialogKeyFor(int key) {
+ private static String savedDialogKeyFor(int key) {
return SAVED_DIALOG_KEY_PREFIX + key;
}
+ private static String savedDialogArgsKeyFor(int key) {
+ return SAVED_DIALOG_ARGS_KEY_PREFIX + key;
+ }
/**
* Called when activity start-up is complete (after {@link #onStart}
@@ -1095,8 +1107,11 @@
for (int i = 0; i < numDialogs; i++) {
final int key = mManagedDialogs.keyAt(i);
ids[i] = key;
- final Dialog dialog = mManagedDialogs.valueAt(i);
- dialogState.putBundle(savedDialogKeyFor(key), dialog.onSaveInstanceState());
+ final ManagedDialog md = mManagedDialogs.valueAt(i);
+ dialogState.putBundle(savedDialogKeyFor(key), md.mDialog.onSaveInstanceState());
+ if (md.mArgs != null) {
+ dialogState.putBundle(savedDialogArgsKeyFor(key), md.mArgs);
+ }
}
dialogState.putIntArray(SAVED_DIALOG_IDS_KEY, ids);
@@ -1282,14 +1297,14 @@
// dismiss any dialogs we are managing.
if (mManagedDialogs != null) {
-
final int numDialogs = mManagedDialogs.size();
for (int i = 0; i < numDialogs; i++) {
- final Dialog dialog = mManagedDialogs.valueAt(i);
- if (dialog.isShowing()) {
- dialog.dismiss();
+ final ManagedDialog md = mManagedDialogs.valueAt(i);
+ if (md.mDialog.isShowing()) {
+ md.mDialog.dismiss();
}
}
+ mManagedDialogs = null;
}
// close any cursors we are managing.
@@ -1300,6 +1315,7 @@
c.mCursor.close();
}
}
+ mManagedCursors.clear();
}
/**
@@ -2410,36 +2426,57 @@
}
/**
- * Callback for creating dialogs that are managed (saved and restored) for you
- * by the activity.
- *
- * If you use {@link #showDialog(int)}, the activity will call through to
- * this method the first time, and hang onto it thereafter. Any dialog
- * that is created by this method will automatically be saved and restored
- * for you, including whether it is showing.
- *
- * If you would like the activity to manage the saving and restoring dialogs
- * for you, you should override this method and handle any ids that are
- * passed to {@link #showDialog}.
- *
- * If you would like an opportunity to prepare your dialog before it is shown,
- * override {@link #onPrepareDialog(int, Dialog)}.
- *
- * @param id The id of the dialog.
- * @return The dialog
- *
- * @see #onPrepareDialog(int, Dialog)
- * @see #showDialog(int)
- * @see #dismissDialog(int)
- * @see #removeDialog(int)
+ * @deprecated Old no-arguments version of {@link #onCreateDialog(int, Bundle)}.
*/
+ @Deprecated
protected Dialog onCreateDialog(int id) {
return null;
}
/**
+ * Callback for creating dialogs that are managed (saved and restored) for you
+ * by the activity. The default implementation calls through to
+ * {@link #onCreateDialog(int)} for compatibility.
+ *
+ * <p>If you use {@link #showDialog(int)}, the activity will call through to
+ * this method the first time, and hang onto it thereafter. Any dialog
+ * that is created by this method will automatically be saved and restored
+ * for you, including whether it is showing.
+ *
+ * <p>If you would like the activity to manage saving and restoring dialogs
+ * for you, you should override this method and handle any ids that are
+ * passed to {@link #showDialog}.
+ *
+ * <p>If you would like an opportunity to prepare your dialog before it is shown,
+ * override {@link #onPrepareDialog(int, Dialog, Bundle)}.
+ *
+ * @param id The id of the dialog.
+ * @param args The dialog arguments provided to {@link #showDialog(int, Bundle)}.
+ * @return The dialog. If you return null, the dialog will not be created.
+ *
+ * @see #onPrepareDialog(int, Dialog, Bundle)
+ * @see #showDialog(int, Bundle)
+ * @see #dismissDialog(int)
+ * @see #removeDialog(int)
+ */
+ protected Dialog onCreateDialog(int id, Bundle args) {
+ return onCreateDialog(id);
+ }
+
+ /**
+ * @deprecated Old no-arguments version of
+ * {@link #onPrepareDialog(int, Dialog, Bundle)}.
+ */
+ @Deprecated
+ protected void onPrepareDialog(int id, Dialog dialog) {
+ dialog.setOwnerActivity(this);
+ }
+
+ /**
* Provides an opportunity to prepare a managed dialog before it is being
- * shown.
+ * shown. The default implementation calls through to
+ * {@link #onPrepareDialog(int, Dialog)} for compatibility.
+ *
* <p>
* Override this if you need to update a managed dialog based on the state
* of the application each time it is shown. For example, a time picker
@@ -2449,43 +2486,66 @@
*
* @param id The id of the managed dialog.
* @param dialog The dialog.
- * @see #onCreateDialog(int)
+ * @param args The dialog arguments provided to {@link #showDialog(int, Bundle)}.
+ * @see #onCreateDialog(int, Bundle)
* @see #showDialog(int)
* @see #dismissDialog(int)
* @see #removeDialog(int)
*/
- protected void onPrepareDialog(int id, Dialog dialog) {
- dialog.setOwnerActivity(this);
+ protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {
+ onPrepareDialog(id, dialog);
}
/**
- * Show a dialog managed by this activity. A call to {@link #onCreateDialog(int)}
+ * Simple version of {@link #showDialog(int, Bundle)} that does not
+ * take any arguments. Simply calls {@link #showDialog(int, Bundle)}
+ * with null arguments.
+ */
+ public final void showDialog(int id) {
+ showDialog(id, null);
+ }
+
+ /**
+ * Show a dialog managed by this activity. A call to {@link #onCreateDialog(int, Bundle)}
* will be made with the same id the first time this is called for a given
* id. From thereafter, the dialog will be automatically saved and restored.
*
- * Each time a dialog is shown, {@link #onPrepareDialog(int, Dialog)} will
+ * <p>Each time a dialog is shown, {@link #onPrepareDialog(int, Dialog, Bundle)} will
* be made to provide an opportunity to do any timely preparation.
*
* @param id The id of the managed dialog.
- *
+ * @param args Arguments to pass through to the dialog. These will be saved
+ * and restored for you. Note that if the dialog is already created,
+ * {@link #onCreateDialog(int, Bundle)} will not be called with the new
+ * arguments but {@link #onPrepareDialog(int, Dialog, Bundle)} will be.
+ * If you need to rebuild the dialog, call {@link #removeDialog(int)} first.
+ * @return Returns true if the Dialog was created; false is returned if
+ * it is not created because {@link #onCreateDialog(int, Bundle)} returns false.
+ *
* @see Dialog
- * @see #onCreateDialog(int)
- * @see #onPrepareDialog(int, Dialog)
+ * @see #onCreateDialog(int, Bundle)
+ * @see #onPrepareDialog(int, Dialog, Bundle)
* @see #dismissDialog(int)
* @see #removeDialog(int)
*/
- public final void showDialog(int id) {
+ public final boolean showDialog(int id, Bundle args) {
if (mManagedDialogs == null) {
- mManagedDialogs = new SparseArray<Dialog>();
+ mManagedDialogs = new SparseArray<ManagedDialog>();
}
- Dialog dialog = mManagedDialogs.get(id);
- if (dialog == null) {
- dialog = createDialog(id, null);
- mManagedDialogs.put(id, dialog);
+ ManagedDialog md = mManagedDialogs.get(id);
+ if (md == null) {
+ md = new ManagedDialog();
+ md.mDialog = createDialog(id, null, args);
+ if (md.mDialog == null) {
+ return false;
+ }
+ mManagedDialogs.put(id, md);
}
- onPrepareDialog(id, dialog);
- dialog.show();
+ md.mArgs = args;
+ onPrepareDialog(id, md.mDialog, args);
+ md.mDialog.show();
+ return true;
}
/**
@@ -2496,21 +2556,21 @@
* @throws IllegalArgumentException if the id was not previously shown via
* {@link #showDialog(int)}.
*
- * @see #onCreateDialog(int)
- * @see #onPrepareDialog(int, Dialog)
+ * @see #onCreateDialog(int, Bundle)
+ * @see #onPrepareDialog(int, Dialog, Bundle)
* @see #showDialog(int)
* @see #removeDialog(int)
*/
public final void dismissDialog(int id) {
if (mManagedDialogs == null) {
throw missingDialog(id);
-
}
- final Dialog dialog = mManagedDialogs.get(id);
- if (dialog == null) {
+
+ final ManagedDialog md = mManagedDialogs.get(id);
+ if (md == null) {
throw missingDialog(id);
}
- dialog.dismiss();
+ md.mDialog.dismiss();
}
/**
@@ -2526,28 +2586,27 @@
* Removes any internal references to a dialog managed by this Activity.
* If the dialog is showing, it will dismiss it as part of the clean up.
*
- * This can be useful if you know that you will never show a dialog again and
+ * <p>This can be useful if you know that you will never show a dialog again and
* want to avoid the overhead of saving and restoring it in the future.
*
* @param id The id of the managed dialog.
*
- * @see #onCreateDialog(int)
- * @see #onPrepareDialog(int, Dialog)
+ * @see #onCreateDialog(int, Bundle)
+ * @see #onPrepareDialog(int, Dialog, Bundle)
* @see #showDialog(int)
* @see #dismissDialog(int)
*/
public final void removeDialog(int id) {
-
if (mManagedDialogs == null) {
return;
}
- final Dialog dialog = mManagedDialogs.get(id);
- if (dialog == null) {
+ final ManagedDialog md = mManagedDialogs.get(id);
+ if (md == null) {
return;
}
- dialog.dismiss();
+ md.mDialog.dismiss();
mManagedDialogs.remove(id);
}
@@ -3449,17 +3508,7 @@
return;
}
- // uses super.getSystemService() since this.getSystemService() looks at the
- // mSearchManager field.
- mSearchManager = (SearchManager) super.getSystemService(Context.SEARCH_SERVICE);
- int ident = mIdent;
- if (ident == 0) {
- if (mParent != null) ident = mParent.mIdent;
- if (ident == 0) {
- throw new IllegalArgumentException("no ident");
- }
- }
- mSearchManager.setIdent(ident, getComponentName());
+ mSearchManager = new SearchManager(this, null);
}
@Override
diff --git a/core/java/android/app/BackupAgent.java b/core/java/android/app/BackupAgent.java
index b207998..2a58677 100644
--- a/core/java/android/app/BackupAgent.java
+++ b/core/java/android/app/BackupAgent.java
@@ -21,6 +21,7 @@
import android.backup.BackupDataOutput;
import android.content.Context;
import android.content.ContextWrapper;
+import android.os.Binder;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -116,7 +117,9 @@
public void doBackup(ParcelFileDescriptor oldState,
ParcelFileDescriptor data,
ParcelFileDescriptor newState) throws RemoteException {
- // !!! TODO - real implementation; for now just invoke the callbacks directly
+ // Ensure that we're running with the app's normal permission level
+ long token = Binder.clearCallingIdentity();
+
if (DEBUG) Log.v(TAG, "doBackup() invoked");
BackupDataOutput output = new BackupDataOutput(data.getFileDescriptor());
try {
@@ -127,12 +130,16 @@
} catch (RuntimeException ex) {
Log.d(TAG, "onBackup (" + BackupAgent.this.getClass().getName() + ") threw", ex);
throw ex;
+ } finally {
+ Binder.restoreCallingIdentity(token);
}
}
public void doRestore(ParcelFileDescriptor data, int appVersionCode,
ParcelFileDescriptor newState) throws RemoteException {
- // !!! TODO - real implementation; for now just invoke the callbacks directly
+ // Ensure that we're running with the app's normal permission level
+ long token = Binder.clearCallingIdentity();
+
if (DEBUG) Log.v(TAG, "doRestore() invoked");
BackupDataInput input = new BackupDataInput(data.getFileDescriptor());
try {
@@ -143,6 +150,8 @@
} catch (RuntimeException ex) {
Log.d(TAG, "onRestore (" + BackupAgent.this.getClass().getName() + ") threw", ex);
throw ex;
+ } finally {
+ Binder.restoreCallingIdentity(token);
}
}
}
diff --git a/core/java/android/app/DeviceAdmin.java b/core/java/android/app/DeviceAdmin.java
index 16832db..88fdab2 100644
--- a/core/java/android/app/DeviceAdmin.java
+++ b/core/java/android/app/DeviceAdmin.java
@@ -22,6 +22,7 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.os.Bundle;
/**
* Base class for implementing a device administration component. This
@@ -62,6 +63,27 @@
= "android.app.action.DEVICE_ADMIN_ENABLED";
/**
+ * Action sent to a device administrator when the user has requested to
+ * disable it, but before this has actually been done. This gives you
+ * a chance to supply a message to the user about the impact of
+ * disabling your admin, by setting the extra field
+ * {@link #EXTRA_DISABLE_WARNING} in the result Intent. If not set,
+ * no warning will be displayed. If set, the given text will be shown
+ * to the user before they disable your admin.
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_DEVICE_ADMIN_DISABLE_REQUESTED
+ = "android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED";
+
+ /**
+ * A CharSequence that can be shown to the user informing them of the
+ * impact of disabling your admin.
+ *
+ * @see #ACTION_DEVICE_ADMIN_DISABLE_REQUESTED
+ */
+ public static final String EXTRA_DISABLE_WARNING = "android.app.extra.DISABLE_WARNING";
+
+ /**
* Action sent to a device administrator when the user has disabled
* it. Upon return, the application no longer has access to the
* protected device policy manager APIs. You will generally
@@ -82,6 +104,10 @@
* {@link DevicePolicyManager#getMinimumPasswordLength()
* DevicePolicyManager.getMinimumPasswordLength()}. You will generally
* handle this in {@link DeviceAdmin#onPasswordChanged(Context, Intent)}.
+ *
+ * <p>The calling device admin must have requested
+ * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to receive
+ * this broadcast.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PASSWORD_CHANGED
@@ -94,6 +120,10 @@
* {@link DevicePolicyManager#getCurrentFailedPasswordAttempts()
* DevicePolicyManager.getCurrentFailedPasswordAttempts()}. You will generally
* handle this in {@link DeviceAdmin#onPasswordFailed(Context, Intent)}.
+ *
+ * <p>The calling device admin must have requested
+ * {@link DeviceAdminInfo#USES_POLICY_WATCH_LOGIN} to receive
+ * this broadcast.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PASSWORD_FAILED
@@ -102,6 +132,10 @@
/**
* Action sent to a device administrator when the user has successfully
* entered their password, after failing one or more times.
+ *
+ * <p>The calling device admin must have requested
+ * {@link DeviceAdminInfo#USES_POLICY_WATCH_LOGIN} to receive
+ * this broadcast.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PASSWORD_SUCCEEDED
@@ -154,6 +188,21 @@
}
/**
+ * Called when the user has asked to disable the administrator, as a result of
+ * receiving {@link #ACTION_DEVICE_ADMIN_DISABLE_REQUESTED}, giving you
+ * a chance to present a warning message to them. The message is returned
+ * as the result; if null is returned (the default implementation), no
+ * message will be displayed.
+ * @param context The running context as per {@link #onReceive}.
+ * @param intent The received intent as per {@link #onReceive}.
+ * @return Return the warning message to display to the user before
+ * being disabled; if null is returned, no message is displayed.
+ */
+ public CharSequence onDisableRequested(Context context, Intent intent) {
+ return null;
+ }
+
+ /**
* Called prior to the administrator being disabled, as a result of
* receiving {@link #ACTION_DEVICE_ADMIN_DISABLED}. Upon return, you
* can no longer use the protected parts of the {@link DevicePolicyManager}
@@ -214,6 +263,12 @@
onPasswordSucceeded(context, intent);
} else if (ACTION_DEVICE_ADMIN_ENABLED.equals(action)) {
onEnabled(context, intent);
+ } else if (ACTION_DEVICE_ADMIN_DISABLE_REQUESTED.equals(action)) {
+ CharSequence res = onDisableRequested(context, intent);
+ if (res != null) {
+ Bundle extras = getResultExtras(true);
+ extras.putCharSequence(EXTRA_DISABLE_WARNING, res);
+ }
} else if (ACTION_DEVICE_ADMIN_DISABLED.equals(action)) {
onDisabled(context, intent);
}
diff --git a/core/java/android/app/DeviceAdminInfo.java b/core/java/android/app/DeviceAdminInfo.java
index eac6e46..e50db89 100644
--- a/core/java/android/app/DeviceAdminInfo.java
+++ b/core/java/android/app/DeviceAdminInfo.java
@@ -22,18 +22,24 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
+import android.content.res.Resources.NotFoundException;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
+import android.util.Log;
import android.util.Printer;
+import android.util.SparseArray;
import android.util.Xml;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
/**
* This class is used to specify meta information of a device administrator
@@ -43,11 +49,122 @@
static final String TAG = "DeviceAdminInfo";
/**
+ * A type of policy that this device admin can use: limit the passwords
+ * that the user can select, via {@link DevicePolicyManager#setPasswordMode}
+ * and {@link DevicePolicyManager#setMinimumPasswordLength}.
+ *
+ * <p>To control this policy, the device admin must have a "limit-password"
+ * tag in the "uses-policies" section of its meta-data.
+ */
+ public static final int USES_POLICY_LIMIT_PASSWORD = 0;
+
+ /**
+ * A type of policy that this device admin can use: able to watch login
+ * attempts from the user, via {@link DeviceAdmin#ACTION_PASSWORD_FAILED},
+ * {@link DeviceAdmin#ACTION_PASSWORD_SUCCEEDED}, and
+ * {@link DevicePolicyManager#getCurrentFailedPasswordAttempts}.
+ *
+ * <p>To control this policy, the device admin must have a "watch-login"
+ * tag in the "uses-policies" section of its meta-data.
+ */
+ public static final int USES_POLICY_WATCH_LOGIN = 1;
+
+ /**
+ * A type of policy that this device admin can use: able to reset the
+ * user's password via
+ * {@link DevicePolicyManager#resetPassword}.
+ *
+ * <p>To control this policy, the device admin must have a "reset-password"
+ * tag in the "uses-policies" section of its meta-data.
+ */
+ public static final int USES_POLICY_RESET_PASSWORD = 2;
+
+ /**
+ * A type of policy that this device admin can use: able to limit the
+ * maximum lock timeout for the device via
+ * {@link DevicePolicyManager#setMaximumTimeToLock}.
+ *
+ * <p>To control this policy, the device admin must have a "limit-unlock"
+ * tag in the "uses-policies" section of its meta-data.
+ */
+ public static final int USES_POLICY_LIMIT_UNLOCK = 3;
+
+ /**
+ * A type of policy that this device admin can use: able to force the device
+ * to lock via{@link DevicePolicyManager#lockNow}.
+ *
+ * <p>To control this policy, the device admin must have a "force-lock"
+ * tag in the "uses-policies" section of its meta-data.
+ */
+ public static final int USES_POLICY_FORCE_LOCK = 4;
+
+ /**
+ * A type of policy that this device admin can use: able to factory
+ * reset the device, erasing all of the user's data, via
+ * {@link DevicePolicyManager#wipeData}.
+ *
+ * <p>To control this policy, the device admin must have a "wipe-data"
+ * tag in the "uses-policies" section of its meta-data.
+ */
+ public static final int USES_POLICY_WIPE_DATA = 5;
+
+ /** @hide */
+ public static class PolicyInfo {
+ public final int ident;
+ final public String tag;
+ final public int label;
+ final public int description;
+
+ public PolicyInfo(int identIn, String tagIn, int labelIn, int descriptionIn) {
+ ident = identIn;
+ tag = tagIn;
+ label = labelIn;
+ description = descriptionIn;
+ }
+ }
+
+ static ArrayList<PolicyInfo> sPoliciesDisplayOrder = new ArrayList<PolicyInfo>();
+ static HashMap<String, Integer> sKnownPolicies = new HashMap<String, Integer>();
+ static SparseArray<PolicyInfo> sRevKnownPolicies = new SparseArray<PolicyInfo>();
+
+ static {
+ sPoliciesDisplayOrder.add(new PolicyInfo(USES_POLICY_WIPE_DATA, "wipe-data",
+ com.android.internal.R.string.policylab_wipeData,
+ com.android.internal.R.string.policydesc_wipeData));
+ sPoliciesDisplayOrder.add(new PolicyInfo(USES_POLICY_RESET_PASSWORD, "reset-password",
+ com.android.internal.R.string.policylab_resetPassword,
+ com.android.internal.R.string.policydesc_resetPassword));
+ sPoliciesDisplayOrder.add(new PolicyInfo(USES_POLICY_LIMIT_PASSWORD, "limit-password",
+ com.android.internal.R.string.policylab_limitPassword,
+ com.android.internal.R.string.policydesc_limitPassword));
+ sPoliciesDisplayOrder.add(new PolicyInfo(USES_POLICY_WATCH_LOGIN, "watch-login",
+ com.android.internal.R.string.policylab_watchLogin,
+ com.android.internal.R.string.policydesc_watchLogin));
+ sPoliciesDisplayOrder.add(new PolicyInfo(USES_POLICY_LIMIT_UNLOCK, "limit-unlock",
+ com.android.internal.R.string.policylab_limitUnlock,
+ com.android.internal.R.string.policydesc_limitUnlock));
+ sPoliciesDisplayOrder.add(new PolicyInfo(USES_POLICY_FORCE_LOCK, "force-lock",
+ com.android.internal.R.string.policylab_forceLock,
+ com.android.internal.R.string.policydesc_forceLock));
+
+ for (int i=0; i<sPoliciesDisplayOrder.size(); i++) {
+ PolicyInfo pi = sPoliciesDisplayOrder.get(i);
+ sRevKnownPolicies.put(pi.ident, pi);
+ sKnownPolicies.put(pi.tag, pi.ident);
+ }
+ }
+
+ /**
* The BroadcastReceiver that implements this device admin component.
*/
final ResolveInfo mReceiver;
/**
+ * The policies this administrator needs access to.
+ */
+ int mUsesPolicies;
+
+ /**
* Constructor.
*
* @param context The Context in which we are parsing the device admin.
@@ -86,6 +203,32 @@
com.android.internal.R.styleable.Wallpaper);
sa.recycle();
+
+ int outerDepth = parser.getDepth();
+ while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
+ if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
+ continue;
+ }
+ String tagName = parser.getName();
+ if (tagName.equals("uses-policies")) {
+ int innerDepth = parser.getDepth();
+ while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG || parser.getDepth() > innerDepth)) {
+ if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
+ continue;
+ }
+ String policyName = parser.getName();
+ Integer val = sKnownPolicies.get(policyName);
+ if (val != null) {
+ mUsesPolicies |= 1 << val.intValue();
+ } else {
+ Log.w(TAG, "Unknown tag under uses-policies of "
+ + getComponent() + ": " + policyName);
+ }
+ }
+ }
+ }
} finally {
if (parser != null) parser.close();
}
@@ -93,6 +236,7 @@
DeviceAdminInfo(Parcel source) {
mReceiver = ResolveInfo.CREATOR.createFromParcel(source);
+ mUsesPolicies = source.readInt();
}
/**
@@ -137,6 +281,26 @@
}
/**
+ * Load user-visible description associated with this device admin.
+ *
+ * @param pm Supply a PackageManager used to load the device admin's
+ * resources.
+ */
+ public CharSequence loadDescription(PackageManager pm) throws NotFoundException {
+ if (mReceiver.activityInfo.descriptionRes != 0) {
+ String packageName = mReceiver.resolvePackageName;
+ ApplicationInfo applicationInfo = null;
+ if (packageName == null) {
+ packageName = mReceiver.activityInfo.packageName;
+ applicationInfo = mReceiver.activityInfo.applicationInfo;
+ }
+ return pm.getText(packageName,
+ mReceiver.activityInfo.descriptionRes, applicationInfo);
+ }
+ throw new NotFoundException();
+ }
+
+ /**
* Load the user-displayed icon for this device admin.
*
* @param pm Supply a PackageManager used to load the device admin's
@@ -146,6 +310,38 @@
return mReceiver.loadIcon(pm);
}
+ /**
+ * Return true if the device admin has requested that it be able to use
+ * the given policy control. The possible policy identifier inputs are:
+ * {@link #USES_POLICY_LIMIT_PASSWORD}, {@link #USES_POLICY_WATCH_LOGIN},
+ * {@link #USES_POLICY_RESET_PASSWORD}, {@link #USES_POLICY_LIMIT_UNLOCK},
+ * {@link #USES_POLICY_FORCE_LOCK}, {@link #USES_POLICY_WIPE_DATA}.
+ */
+ public boolean usesPolicy(int policyIdent) {
+ return (mUsesPolicies & (1<<policyIdent)) != 0;
+ }
+
+ /**
+ * Return the XML tag name for the given policy identifier. Valid identifiers
+ * are as per {@link #usesPolicy(int)}. If the given identifier is not
+ * known, null is returned.
+ */
+ public String getTagForPolicy(int policyIdent) {
+ return sRevKnownPolicies.get(policyIdent).tag;
+ }
+
+ /** @hide */
+ public ArrayList<PolicyInfo> getUsedPolicies() {
+ ArrayList<PolicyInfo> res = new ArrayList<PolicyInfo>();
+ for (int i=0; i<sPoliciesDisplayOrder.size(); i++) {
+ PolicyInfo pi = sPoliciesDisplayOrder.get(i);
+ if (usesPolicy(pi.ident)) {
+ res.add(pi);
+ }
+ }
+ return res;
+ }
+
public void dump(Printer pw, String prefix) {
pw.println(prefix + "Receiver:");
mReceiver.dump(pw, prefix + " ");
@@ -164,6 +360,7 @@
*/
public void writeToParcel(Parcel dest, int flags) {
mReceiver.writeToParcel(dest, flags);
+ dest.writeInt(mUsesPolicies);
}
/**
diff --git a/core/java/android/app/DevicePolicyManager.java b/core/java/android/app/DevicePolicyManager.java
index 538ba5b..135851f 100644
--- a/core/java/android/app/DevicePolicyManager.java
+++ b/core/java/android/app/DevicePolicyManager.java
@@ -26,11 +26,13 @@
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Handler;
+import android.os.RemoteCallback;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import java.io.IOException;
+import java.util.List;
/**
* Public interface for managing policies enforced on a device. Most clients
@@ -43,8 +45,9 @@
private static boolean localLOGV = DEBUG || android.util.Config.LOGV;
private final Context mContext;
- private final Handler mHandler;
private final IDevicePolicyManager mService;
+
+ private final Handler mHandler;
/*package*/ DevicePolicyManager(Context context, Handler handler) {
mContext = context;
@@ -60,9 +63,9 @@
* bring the user through adding the device administrator to the system (or
* allowing them to reject it).
*
- * <p>Note: the current platform can only have one device administrator
- * active at a time. If you make this request while there is already
- * an active administrator, this new request will be canceled automatically.
+ * <p>You can optionally include the {@link #EXTRA_ADD_EXPLANATION}
+ * field to provide the user with additional explanation (in addition
+ * to your component's description) about what is being added.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_ADD_DEVICE_ADMIN
@@ -76,6 +79,14 @@
public static final String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN";
/**
+ * An optional CharSequence providing additional explanation for why the
+ * admin is being added.
+ *
+ * @see #ACTION_ADD_DEVICE_ADMIN
+ */
+ public static final String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION";
+
+ /**
* Activity action: have the user enter a new password. This activity
* should be launched after using {@link #setPasswordMode(ComponentName, int)}
* or {@link #setMinimumPasswordLength(ComponentName, int)} to have the
@@ -97,7 +108,7 @@
public boolean isAdminActive(ComponentName who) {
if (mService != null) {
try {
- return who.equals(mService.getActiveAdmin());
+ return mService.isAdminActive(who);
} catch (RemoteException e) {
Log.w(TAG, "Failed talking with device policy service", e);
}
@@ -106,6 +117,22 @@
}
/**
+ * Return a list of all currently active device administrator's component
+ * names. Note that if there are no administrators than null may be
+ * returned.
+ */
+ public List<ComponentName> getActiveAdmins() {
+ if (mService != null) {
+ try {
+ return mService.getActiveAdmins();
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed talking with device policy service", e);
+ }
+ }
+ return null;
+ }
+
+ /**
* Remove a current administration component. This can only be called
* by the application that owns the administration component; if you
* try to remove someone else's component, a security exception will be
@@ -163,6 +190,10 @@
* the user's preference, and any other considerations) is the one that
* is in effect.
*
+ * <p>The calling device admin must have requested
+ * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
+ * 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},
@@ -205,6 +236,10 @@
* {@link #PASSWORD_MODE_NUMERIC} or {@link #PASSWORD_MODE_ALPHANUMERIC}
* with {@link #setPasswordMode}.
*
+ * <p>The calling device admin must have requested
+ * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
+ * this method; if it has not, a security exception will be thrown.
+ *
* @param admin Which {@link DeviceAdmin} this request is associated with.
* @param length The new desired minimum password length. A value of 0
* means there is no restriction.
@@ -239,6 +274,10 @@
* to meet the policy requirements (mode, minimum length) that have been
* requested.
*
+ * <p>The calling device admin must have requested
+ * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call
+ * this method; if it has not, a security exception will be thrown.
+ *
* @return Returns true if the password meets the current requirements,
* else false.
*/
@@ -256,6 +295,10 @@
/**
* Retrieve the number of times the user has failed at entering a
* password since that last successful password entry.
+ *
+ * <p>The calling device admin must have requested
+ * {@link DeviceAdminInfo#USES_POLICY_WATCH_LOGIN} to be able to call
+ * this method; if it has not, a security exception will be thrown.
*/
public int getCurrentFailedPasswordAttempts() {
if (mService != null) {
@@ -269,6 +312,29 @@
}
/**
+ * Set the maximum number of failed password attempts that are allowed
+ * before the device wipes its data. This is convenience for implementing
+ * the corresponding functionality with a combination of watching failed
+ * password attempts and calling {@link #wipeData} upon reaching a certain
+ * count, and as such requires that you request both
+ * {@link DeviceAdminInfo#USES_POLICY_WATCH_LOGIN} and
+ * {@link DeviceAdminInfo#USES_POLICY_WIPE_DATA}}.
+ *
+ * @param admin Which {@link DeviceAdmin} this request is associated with.
+ * @param num The number of failed password attempts at which point the
+ * device will wipe its data.
+ */
+ public void setMaximumFailedPasswordsForWipe(ComponentName admin, int num) {
+ if (mService != null) {
+ try {
+ mService.setMaximumFailedPasswordsForWipe(admin, num);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed talking with device policy service", e);
+ }
+ }
+ }
+
+ /**
* 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
@@ -277,6 +343,10 @@
* if it contains only digits, that is still an acceptable alphanumeric
* password.)
*
+ * <p>The calling device admin must have requested
+ * {@link DeviceAdminInfo#USES_POLICY_RESET_PASSWORD} to be able to call
+ * this method; if it has not, a security exception will be thrown.
+ *
* @param password The new password for the user.
* @return Returns true if the password was applied, or false if it is
* not acceptable for the current constraints.
@@ -297,6 +367,10 @@
* maximum time for user activity until the device will lock. This limits
* the length that the user can set. It takes effect immediately.
*
+ * <p>The calling device admin must have requested
+ * {@link DeviceAdminInfo#USES_POLICY_LIMIT_UNLOCK} to be able to call
+ * this method; if it has not, a security exception will be thrown.
+ *
* @param admin Which {@link DeviceAdmin} this request is associated with.
* @param timeMs The new desired maximum time to lock in milliseconds.
* A value of 0 means there is no restriction.
@@ -329,6 +403,10 @@
/**
* Make the device lock immediately, as if the lock screen timeout has
* expired at the point of this call.
+ *
+ * <p>The calling device admin must have requested
+ * {@link DeviceAdminInfo#USES_POLICY_FORCE_LOCK} to be able to call
+ * this method; if it has not, a security exception will be thrown.
*/
public void lockNow() {
if (mService != null) {
@@ -345,6 +423,10 @@
* erasing all user data while next booting up. External storage such
* as SD cards will not be erased.
*
+ * <p>The calling device admin must have requested
+ * {@link DeviceAdminInfo#USES_POLICY_WIPE_DATA} to be able to call
+ * this method; if it has not, a security exception will be thrown.
+ *
* @param flags Bit mask of additional options: currently must be 0.
*/
public void wipeData(int flags) {
@@ -373,26 +455,7 @@
/**
* @hide
*/
- public ComponentName getActiveAdmin() {
- if (mService != null) {
- try {
- return mService.getActiveAdmin();
- } catch (RemoteException e) {
- Log.w(TAG, "Failed talking with device policy service", e);
- }
- }
- return null;
- }
-
- /**
- * @hide
- */
- public DeviceAdminInfo getActiveAdminInfo() {
- ComponentName cn = getActiveAdmin();
- if (cn == null) {
- return null;
- }
-
+ public DeviceAdminInfo getAdminInfo(ComponentName cn) {
ActivityInfo ai;
try {
ai = mContext.getPackageManager().getReceiverInfo(cn,
@@ -419,6 +482,19 @@
/**
* @hide
*/
+ public void getRemoveWarning(ComponentName admin, RemoteCallback result) {
+ if (mService != null) {
+ try {
+ mService.getRemoveWarning(admin, result);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed talking with device policy service", e);
+ }
+ }
+ }
+
+ /**
+ * @hide
+ */
public void setActivePasswordState(int mode, int length) {
if (mService != null) {
try {
diff --git a/core/java/android/app/IDevicePolicyManager.aidl b/core/java/android/app/IDevicePolicyManager.aidl
index 7e38194..a5508cd 100644
--- a/core/java/android/app/IDevicePolicyManager.aidl
+++ b/core/java/android/app/IDevicePolicyManager.aidl
@@ -18,6 +18,7 @@
package android.app;
import android.content.ComponentName;
+import android.os.RemoteCallback;
/**
* Internal IPC interface to the device policy service.
@@ -32,6 +33,7 @@
boolean isActivePasswordSufficient();
int getCurrentFailedPasswordAttempts();
+ void setMaximumFailedPasswordsForWipe(in ComponentName admin, int num);
boolean resetPassword(String password);
@@ -43,7 +45,9 @@
void wipeData(int flags);
void setActiveAdmin(in ComponentName policyReceiver);
- ComponentName getActiveAdmin();
+ boolean isAdminActive(in ComponentName policyReceiver);
+ List<ComponentName> getActiveAdmins();
+ void getRemoveWarning(in ComponentName policyReceiver, in RemoteCallback result);
void removeActiveAdmin(in ComponentName policyReceiver);
void setActivePasswordState(int mode, int length);
diff --git a/core/java/android/app/ISearchManager.aidl b/core/java/android/app/ISearchManager.aidl
index 0920467..9ba7863 100644
--- a/core/java/android/app/ISearchManager.aidl
+++ b/core/java/android/app/ISearchManager.aidl
@@ -29,23 +29,4 @@
List<SearchableInfo> getSearchablesForWebSearch();
SearchableInfo getDefaultSearchableForWebSearch();
void setDefaultWebSearch(in ComponentName component);
- void startSearch(in String initialQuery,
- boolean selectInitialQuery,
- in ComponentName launchActivity,
- in Bundle appSearchData,
- boolean globalSearch,
- ISearchManagerCallback searchManagerCallback,
- int ident);
-
- void triggerSearch(in String query,
- in ComponentName launchActivity,
- in Bundle appSearchData,
- ISearchManagerCallback searchManagerCallback,
- int ident);
-
- void stopSearch();
-
-
- boolean isVisible();
-
}
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index b396396..3dfbe71 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -73,8 +73,8 @@
import java.util.concurrent.atomic.AtomicLong;
/**
- * System search dialog. This is controlled by the
- * SearchManagerService and runs in the system process.
+ * Search dialog. This is controlled by the
+ * SearchManager and runs in the current foreground process.
*
* @hide
*/
@@ -118,6 +118,7 @@
private Bundle mAppSearchData;
private boolean mGlobalSearchMode;
private Context mActivityContext;
+ private SearchManager mSearchManager;
// Values we store to allow user to toggle between in-app search and global search.
private ComponentName mStoredComponentName;
@@ -157,7 +158,7 @@
*
* @param context Application Context we can use for system acess
*/
- public SearchDialog(Context context) {
+ public SearchDialog(Context context, SearchManager searchManager) {
super(context, com.android.internal.R.style.Theme_GlobalSearchBar);
// Save voice intent for later queries/launching
@@ -168,6 +169,7 @@
mVoiceAppSearchIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
mVoiceAppSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ mSearchManager = searchManager;
}
/**
@@ -180,7 +182,6 @@
Window theWindow = getWindow();
WindowManager.LayoutParams lp = theWindow.getAttributes();
- lp.type = WindowManager.LayoutParams.TYPE_SEARCH_BAR;
lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
// taking up the whole window (even when transparent) is less than ideal,
// but necessary to show the popup window until the window manager supports
@@ -291,8 +292,10 @@
//
// TODO: When the browser icon issue is reconciled in Eclair, remove this special case.
if (isBrowserSearch()) currentSearchText = "";
-
- return doShow(currentSearchText, false, null, mAppSearchData, true);
+
+ cancel();
+ mSearchManager.startGlobalSearch(currentSearchText, false, mStoredAppSearchData);
+ return true;
} else {
if (mStoredComponentName != null) {
// This means we should toggle *back* to an in-app search context from
@@ -1314,8 +1317,7 @@
}
/**
- * Launches an intent, including any special intent handling. Doesn't dismiss the dialog
- * since that will be handled in {@link SearchDialogWrapper#performActivityResuming}
+ * Launches an intent, including any special intent handling.
*/
private void launchIntent(Intent intent) {
if (intent == null) {
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index d25d670..12a43478 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -1709,7 +1709,7 @@
/* package */ OnDismissListener mDismissListener = null;
/* package */ OnCancelListener mCancelListener = null;
- private final SearchManagerCallback mSearchManagerCallback = new SearchManagerCallback();
+ private SearchDialog mSearchDialog;
/*package*/ SearchManager(Context context, Handler handler) {
mContext = context;
@@ -1778,31 +1778,29 @@
ComponentName launchActivity,
Bundle appSearchData,
boolean globalSearch) {
- if (mIdent == 0) throw new IllegalArgumentException(
- "Called from outside of an Activity context");
+ ensureSearchDialog();
if (globalSearch) {
startGlobalSearch(initialQuery, selectInitialQuery, appSearchData);
return;
}
- if (!mAssociatedPackage.equals(launchActivity.getPackageName())) {
- Log.w(TAG, "invoking app search on a different package " +
- "not associated with this search manager");
- }
- try {
- // activate the search manager and start it up!
- mService.startSearch(initialQuery, selectInitialQuery, launchActivity, appSearchData,
- globalSearch, mSearchManagerCallback, mIdent);
- } catch (RemoteException ex) {
- Log.e(TAG, "startSearch() failed.", ex);
+ mSearchDialog.show(initialQuery, selectInitialQuery, launchActivity, appSearchData,
+ globalSearch);
+ }
+
+ private void ensureSearchDialog() {
+ if (mSearchDialog == null) {
+ mSearchDialog = new SearchDialog(mContext, this);
+ mSearchDialog.setOnCancelListener(this);
+ mSearchDialog.setOnDismissListener(this);
}
}
/**
* Starts the global search activity.
*/
- private void startGlobalSearch(String initialQuery, boolean selectInitialQuery,
+ /* package */ void startGlobalSearch(String initialQuery, boolean selectInitialQuery,
Bundle appSearchData) {
ComponentName globalSearchActivity = getGlobalSearchActivity();
if (globalSearchActivity == null) {
@@ -1876,8 +1874,6 @@
public void triggerSearch(String query,
ComponentName launchActivity,
Bundle appSearchData) {
- if (mIdent == 0) throw new IllegalArgumentException(
- "Called from outside of an Activity context");
if (!mAssociatedPackage.equals(launchActivity.getPackageName())) {
throw new IllegalArgumentException("invoking app search on a different package " +
"not associated with this search manager");
@@ -1886,12 +1882,8 @@
Log.w(TAG, "triggerSearch called with empty query, ignoring.");
return;
}
- try {
- mService.triggerSearch(query, launchActivity, appSearchData, mSearchManagerCallback,
- mIdent);
- } catch (RemoteException ex) {
- Log.e(TAG, "triggerSearch() failed.", ex);
- }
+ startSearch(query, false, launchActivity, appSearchData, false);
+ mSearchDialog.launchQuerySearch();
}
/**
@@ -1906,10 +1898,8 @@
* @see #startSearch
*/
public void stopSearch() {
- if (DBG) debug("stopSearch()");
- try {
- mService.stopSearch();
- } catch (RemoteException ex) {
+ if (mSearchDialog != null) {
+ mSearchDialog.cancel();
}
}
@@ -1923,13 +1913,7 @@
* @hide
*/
public boolean isVisible() {
- if (DBG) debug("isVisible()");
- try {
- return mService.isVisible();
- } catch (RemoteException e) {
- Log.e(TAG, "isVisible() failed: " + e);
- return false;
- }
+ return mSearchDialog == null? false : mSearchDialog.isShowing();
}
/**
@@ -1976,44 +1960,14 @@
mCancelListener = listener;
}
- private class SearchManagerCallback extends ISearchManagerCallback.Stub {
-
- private final Runnable mFireOnDismiss = new Runnable() {
- public void run() {
- if (DBG) debug("mFireOnDismiss");
- if (mDismissListener != null) {
- mDismissListener.onDismiss();
- }
- }
- };
-
- private final Runnable mFireOnCancel = new Runnable() {
- public void run() {
- if (DBG) debug("mFireOnCancel");
- if (mCancelListener != null) {
- mCancelListener.onCancel();
- }
- }
- };
-
- public void onDismiss() {
- if (DBG) debug("onDismiss()");
- mHandler.post(mFireOnDismiss);
- }
-
- public void onCancel() {
- if (DBG) debug("onCancel()");
- mHandler.post(mFireOnCancel);
- }
-
- }
-
/**
* @deprecated This method is an obsolete internal implementation detail. Do not use.
*/
@Deprecated
public void onCancel(DialogInterface dialog) {
- throw new UnsupportedOperationException();
+ if (mCancelListener != null) {
+ mCancelListener.onCancel();
+ }
}
/**
@@ -2021,7 +1975,9 @@
*/
@Deprecated
public void onDismiss(DialogInterface dialog) {
- throw new UnsupportedOperationException();
+ if (mDismissListener != null) {
+ mDismissListener.onDismiss();
+ }
}
/**
@@ -2208,4 +2164,4 @@
Thread thread = Thread.currentThread();
Log.d(TAG, msg + " (" + thread.getName() + "-" + thread.getId() + ")");
}
-}
\ No newline at end of file
+}
diff --git a/core/java/android/app/WallpaperInfo.java b/core/java/android/app/WallpaperInfo.java
index 1612ac9..5ca3fb54 100644
--- a/core/java/android/app/WallpaperInfo.java
+++ b/core/java/android/app/WallpaperInfo.java
@@ -21,6 +21,7 @@
import android.content.ComponentName;
import android.content.Context;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
@@ -204,7 +205,7 @@
return pm.getDrawable(mService.serviceInfo.packageName,
mThumbnailResource,
- null);
+ mService.serviceInfo.applicationInfo);
}
/**
@@ -212,25 +213,33 @@
*/
public CharSequence loadAuthor(PackageManager pm) throws NotFoundException {
if (mAuthorResource <= 0) throw new NotFoundException();
- return pm.getText(
- (mService.resolvePackageName != null)
- ? mService.resolvePackageName
- : getPackageName(),
- mAuthorResource,
- null);
+ String packageName = mService.resolvePackageName;
+ ApplicationInfo applicationInfo = null;
+ if (packageName == null) {
+ packageName = mService.serviceInfo.packageName;
+ applicationInfo = mService.serviceInfo.applicationInfo;
+ }
+ return pm.getText(packageName, mAuthorResource, applicationInfo);
}
/**
* Return a brief summary of this wallpaper's behavior.
*/
public CharSequence loadDescription(PackageManager pm) throws NotFoundException {
+ String packageName = mService.resolvePackageName;
+ ApplicationInfo applicationInfo = null;
+ if (packageName == null) {
+ packageName = mService.serviceInfo.packageName;
+ applicationInfo = mService.serviceInfo.applicationInfo;
+ }
+ if (mService.serviceInfo.descriptionRes != 0) {
+ return pm.getText(packageName, mService.serviceInfo.descriptionRes,
+ applicationInfo);
+
+ }
if (mDescriptionResource <= 0) throw new NotFoundException();
- return pm.getText(
- (mService.resolvePackageName != null)
- ? mService.resolvePackageName
- : getPackageName(),
- mDescriptionResource,
- null);
+ return pm.getText(packageName, mDescriptionResource,
+ mService.serviceInfo.applicationInfo);
}
/**
diff --git a/core/java/android/backup/BackupManager.java b/core/java/android/backup/BackupManager.java
index da1647a..0b27117 100644
--- a/core/java/android/backup/BackupManager.java
+++ b/core/java/android/backup/BackupManager.java
@@ -16,6 +16,7 @@
package android.backup;
+import android.backup.RestoreSession;
import android.content.Context;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -115,19 +116,21 @@
*
* {@hide}
*/
- public IRestoreSession beginRestoreSession(String transport) {
+ public RestoreSession beginRestoreSession() {
if (!EVEN_THINK_ABOUT_DOING_RESTORE) {
return null;
}
- IRestoreSession binder = null;
+ RestoreSession session = null;
checkServiceBinder();
if (sService != null) {
try {
- binder = sService.beginRestoreSession(transport);
+ String transport = sService.getCurrentTransport();
+ IRestoreSession binder = sService.beginRestoreSession(transport);
+ session = new RestoreSession(mContext, binder);
} catch (RemoteException e) {
Log.d(TAG, "beginRestoreSession() couldn't connect");
}
}
- return binder;
+ return session;
}
}
diff --git a/core/java/android/backup/RestoreObserver.java b/core/java/android/backup/RestoreObserver.java
new file mode 100644
index 0000000..3be8c08
--- /dev/null
+++ b/core/java/android/backup/RestoreObserver.java
@@ -0,0 +1,53 @@
+/*
+ * 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.backup;
+
+/**
+ * Callback class for receiving progress reports during a restore operation. These
+ * methods will all be called on your application's main thread.
+ * @hide
+ */
+public abstract class RestoreObserver {
+ /**
+ * The restore operation has begun.
+ *
+ * @param numPackages The total number of packages being processed in
+ * this restore operation.
+ */
+ void restoreStarting(int numPackages) {
+ }
+
+ /**
+ * An indication of which package is being restored currently, out of the
+ * total number provided in the restoreStarting() callback. This method
+ * is not guaranteed to be called.
+ *
+ * @param nowBeingRestored The index, between 1 and the numPackages parameter
+ * to the restoreStarting() callback, of the package now being restored.
+ */
+ void onUpdate(int nowBeingRestored) {
+ }
+
+ /**
+ * The restore operation has completed.
+ *
+ * @param error Zero on success; a nonzero error code if the restore operation
+ * as a whole failed.
+ */
+ void restoreFinished(int error) {
+ }
+}
diff --git a/core/java/android/backup/RestoreSession.java b/core/java/android/backup/RestoreSession.java
new file mode 100644
index 0000000..119fc52
--- /dev/null
+++ b/core/java/android/backup/RestoreSession.java
@@ -0,0 +1,178 @@
+/*
+ * 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.backup;
+
+import android.backup.IRestoreSession;
+import android.backup.RestoreObserver;
+import android.backup.RestoreSet;
+import android.content.Context;
+import android.os.Handler;
+import android.os.RemoteException;
+import android.util.Log;
+
+/**
+ * Interface for applications to use when managing a restore session.
+ * @hide
+ */
+public class RestoreSession {
+ static final String TAG = "RestoreSession";
+
+ final Context mContext;
+ IRestoreSession mBinder;
+ RestoreObserverWrapper mObserver = null;
+
+ /**
+ * Ask the current transport what the available restore sets are.
+ *
+ * @return A bundle containing two elements: an int array under the key
+ * "tokens" whose entries are a transport-private identifier for each backup set;
+ * and a String array under the key "names" whose entries are the user-meaningful
+ * text corresponding to the backup sets at each index in the tokens array.
+ * On error, returns null.
+ */
+ public RestoreSet[] getAvailableRestoreSets() {
+ try {
+ return mBinder.getAvailableRestoreSets();
+ } catch (RemoteException e) {
+ Log.d(TAG, "Can't contact server to get available sets");
+ return null;
+ }
+ }
+
+ /**
+ * Restore the given set onto the device, replacing the current data of any app
+ * contained in the restore set with the data previously backed up.
+ *
+ * @return Zero on success; nonzero on error. The observer will only receive
+ * progress callbacks if this method returned zero.
+ * @param token The token from {@link #getAvailableRestoreSets()} corresponding to
+ * the restore set that should be used.
+ * @param observer If non-null, this argument points to an object that will receive
+ * progress callbacks during the restore operation. These callbacks will occur
+ * on the main thread of the application.
+ */
+ public int performRestore(long token, RestoreObserver observer) {
+ int err = -1;
+ if (mObserver != null) {
+ Log.d(TAG, "performRestore() called during active restore");
+ return -1;
+ }
+ mObserver = new RestoreObserverWrapper(mContext, observer);
+ try {
+ err = mBinder.performRestore(token, mObserver);
+ } catch (RemoteException e) {
+ Log.d(TAG, "Can't contact server to perform restore");
+ }
+ return err;
+ }
+
+ /**
+ * End this restore session. After this method is called, the RestoreSession
+ * object is no longer valid.
+ *
+ * <p><b>Note:</b> The caller <i>must</i> invoke this method to end the restore session,
+ * even if {@link #getAvailableRestoreSets()} or
+ * {@link #performRestore(long, RestoreObserver)} failed.
+ */
+ public void endRestoreSession() {
+ try {
+ mBinder.endRestoreSession();
+ } catch (RemoteException e) {
+ Log.d(TAG, "Can't contact server to get available sets");
+ } finally {
+ mBinder = null;
+ }
+ }
+
+ /*
+ * Nonpublic implementation here
+ */
+
+ RestoreSession(Context context, IRestoreSession binder) {
+ mContext = context;
+ mBinder = binder;
+ }
+
+ /*
+ * 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
+ * progress callbacks nicely within the usual main-thread lifecycle pattern.
+ */
+ private class RestoreObserverWrapper extends IRestoreObserver.Stub {
+ final Handler mHandler;
+ final RestoreObserver mAppObserver;
+
+ RestoreObserverWrapper(Context context, RestoreObserver appObserver) {
+ mHandler = new Handler(context.getMainLooper());
+ 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
+ public void restoreStarting(int numPackages) {
+ mHandler.post(new RestoreStartingRunnable(numPackages));
+ }
+
+ public void onUpdate(int nowBeingRestored) {
+ mHandler.post(new OnUpdateRunnable(nowBeingRestored));
+ }
+
+ public void restoreFinished(int error) {
+ mHandler.post(new RestoreFinishedRunnable(error));
+ }
+ }
+}
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index d76b616..321ba5c 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -1278,6 +1278,17 @@
/**
* Use with {@link #getSystemService} to retrieve a {@link
+ * android.net.NetworkManagementService} for handling management of
+ * system network services
+ *
+ * @hide
+ * @see #getSystemService
+ * @see android.net.NetworkManagementService
+ */
+ public static final String NETWORKMANAGEMENT_SERVICE = "network_management";
+
+ /**
+ * Use with {@link #getSystemService} to retrieve a {@link
* android.net.wifi.WifiManager} for handling management of
* Wi-Fi access.
*
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index a9c61dc..699b61d 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -16,8 +16,6 @@
package android.content;
-import com.google.android.collect.Maps;
-
import com.android.internal.R;
import com.android.internal.util.ArrayUtils;
@@ -29,11 +27,11 @@
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.pm.ApplicationInfo;
-import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.RegisteredServicesCache;
import android.content.pm.ProviderInfo;
+import android.content.pm.RegisteredServicesCacheListener;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
@@ -45,15 +43,14 @@
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.provider.Settings;
import android.text.format.DateUtils;
import android.text.format.Time;
-import android.util.Config;
import android.util.EventLog;
import android.util.Log;
+import android.util.Pair;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@@ -65,12 +62,8 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.PriorityQueue;
import java.util.Random;
import java.util.Collection;
import java.util.concurrent.CountDownLatch;
@@ -78,7 +71,7 @@
/**
* @hide
*/
-class SyncManager implements OnAccountsUpdateListener {
+public class SyncManager implements OnAccountsUpdateListener {
private static final String TAG = "SyncManager";
// used during dumping of the Sync history
@@ -144,9 +137,6 @@
private Context mContext;
- private String mStatusText = "";
- private long mHeartbeatTime = 0;
-
private volatile Account[] mAccounts = null;
volatile private PowerManager.WakeLock mSyncWakeLock;
@@ -156,12 +146,9 @@
private final NotificationManager mNotificationMgr;
private AlarmManager mAlarmService = null;
- private HandlerThread mSyncThread;
-
- private volatile IPackageManager mPackageManager;
private final SyncStorageEngine mSyncStorageEngine;
- private final SyncQueue mSyncQueue;
+ public final SyncQueue mSyncQueue;
private ActiveSyncContext mActiveSyncContext = null;
@@ -312,8 +299,6 @@
private static final String SYNCMANAGER_PREFS_FILENAME = "/data/system/syncmanager.prefs";
- private final boolean mFactoryTest;
-
private volatile boolean mBootCompleted = false;
private ConnectivityManager getConnectivityManager() {
@@ -327,8 +312,6 @@
}
public SyncManager(Context context, boolean factoryTest) {
- mFactoryTest = factoryTest;
-
// Initialize the SyncStorageEngine first, before registering observers
// and creating threads and so on; it may fail if the disk is full.
SyncStorageEngine.init(context);
@@ -337,13 +320,20 @@
mContext = context;
- mSyncThread = new HandlerThread("SyncHandlerThread", Process.THREAD_PRIORITY_BACKGROUND);
- mSyncThread.start();
- mSyncHandler = new SyncHandler(mSyncThread.getLooper());
-
- mPackageManager = null;
+ HandlerThread syncThread = new HandlerThread("SyncHandlerThread",
+ Process.THREAD_PRIORITY_BACKGROUND);
+ syncThread.start();
+ mSyncHandler = new SyncHandler(syncThread.getLooper());
mSyncAdapters = new SyncAdaptersCache(mContext);
+ mSyncAdapters.setListener(new RegisteredServicesCacheListener<SyncAdapterType>() {
+ public void onServiceChanged(SyncAdapterType type, boolean removed) {
+ if (!removed) {
+ scheduleSync(null, type.authority, null, 0 /* no delay */,
+ false /* onlyThoseWithUnkownSyncableState */);
+ }
+ }
+ }, mSyncHandler);
mSyncAlarmIntent = PendingIntent.getBroadcast(
mContext, 0 /* ignored */, new Intent(ACTION_SYNC_ALARM), 0);
@@ -635,16 +625,12 @@
if (isLoggable) {
Log.v(TAG, "not syncing because sync is disabled");
}
- setStatusText("Sync is disabled.");
return;
}
final boolean backgroundDataUsageAllowed = !mBootCompleted ||
getConnectivityManager().getBackgroundDataSetting();
- if (!mDataConnectionIsConnected) setStatusText("No data connection");
- if (mStorageIsLow) setStatusText("Memory low");
-
if (extras == null) extras = new Bundle();
Boolean expedited = extras.getBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, false);
@@ -670,7 +656,6 @@
if (isLoggable) {
Log.v(TAG, "scheduleSync: no accounts configured, dropping");
}
- setStatusText("No accounts are configured.");
return;
}
}
@@ -759,10 +744,6 @@
}
}
- private void setStatusText(String message) {
- mStatusText = message;
- }
-
public void scheduleLocalSync(Account account, String authority) {
final Bundle extras = new Bundle();
extras.putBoolean(ContentResolver.SYNC_EXTRAS_UPLOAD, true);
@@ -770,17 +751,6 @@
false /* onlyThoseWithUnkownSyncableState */);
}
- private IPackageManager getPackageManager() {
- // Don't bother synchronizing on this. The worst that can happen is that two threads
- // can try to get the package manager at the same time but only one result gets
- // used. Since there is only one package manager in the system this doesn't matter.
- if (mPackageManager == null) {
- IBinder b = ServiceManager.getService("package");
- mPackageManager = IPackageManager.Stub.asInterface(b);
- }
- return mPackageManager;
- }
-
public SyncAdapterType[] getSyncAdapterTypes() {
final Collection<RegisteredServicesCache.ServiceInfo<SyncAdapterType>> serviceInfos =
mSyncAdapters.getAllServices();
@@ -793,11 +763,6 @@
return types;
}
- public void updateHeartbeatTime() {
- mHeartbeatTime = SystemClock.elapsedRealtime();
- mSyncStorageEngine.reportActiveChange();
- }
-
private void sendSyncAlarmMessage() {
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "sending MESSAGE_SYNC_ALARM");
mSyncHandler.sendEmptyMessage(SyncHandler.MESSAGE_SYNC_ALARM);
@@ -840,22 +805,24 @@
}
}
- private void rescheduleImmediately(SyncOperation syncOperation) {
- SyncOperation rescheduledSyncOperation = new SyncOperation(syncOperation);
- rescheduledSyncOperation.setDelay(0);
- scheduleSyncOperation(rescheduledSyncOperation);
+ private void clearBackoffSetting(SyncOperation op) {
+ mSyncStorageEngine.setBackoff(op.account, op.authority,
+ SyncStorageEngine.NOT_IN_BACKOFF_MODE, SyncStorageEngine.NOT_IN_BACKOFF_MODE);
}
- private long rescheduleWithDelay(SyncOperation syncOperation) {
- long newDelayInMs;
+ private void increaseBackoffSetting(SyncOperation op) {
+ final long now = SystemClock.elapsedRealtime();
- if (syncOperation.delay <= 0) {
+ final Pair<Long, Long> previousSettings =
+ mSyncStorageEngine.getBackoff(op.account, op.authority);
+ long newDelayInMs;
+ if (previousSettings == null || previousSettings.second <= 0) {
// The initial delay is the jitterized INITIAL_SYNC_RETRY_TIME_IN_MS
newDelayInMs = jitterize(INITIAL_SYNC_RETRY_TIME_IN_MS,
(long)(INITIAL_SYNC_RETRY_TIME_IN_MS * 1.1));
} else {
// Subsequent delays are the double of the previous delay
- newDelayInMs = syncOperation.delay * 2;
+ newDelayInMs = previousSettings.second * 2;
}
// Cap the delay
@@ -866,10 +833,20 @@
newDelayInMs = maxSyncRetryTimeInSeconds * 1000;
}
- SyncOperation rescheduledSyncOperation = new SyncOperation(syncOperation);
- rescheduledSyncOperation.setDelay(newDelayInMs);
- scheduleSyncOperation(rescheduledSyncOperation);
- return newDelayInMs;
+ mSyncStorageEngine.setBackoff(op.account, op.authority,
+ now + newDelayInMs, newDelayInMs);
+ }
+
+ private void setDelayUntilTime(SyncOperation op, long delayUntilSeconds) {
+ final long delayUntil = delayUntilSeconds * 1000;
+ final long absoluteNow = System.currentTimeMillis();
+ long newDelayUntilTime;
+ if (delayUntil > absoluteNow) {
+ newDelayUntilTime = SystemClock.elapsedRealtime() + (delayUntil - absoluteNow);
+ } else {
+ newDelayUntilTime = 0;
+ }
+ mSyncStorageEngine.setDelayUntilTime(op.account, op.authority, newDelayUntilTime);
}
/**
@@ -905,28 +882,26 @@
public void scheduleSyncOperation(SyncOperation syncOperation) {
// If this operation is expedited and there is a sync in progress then
// reschedule the current operation and send a cancel for it.
- final boolean expedited = syncOperation.delay < 0;
final ActiveSyncContext activeSyncContext = mActiveSyncContext;
- if (expedited && activeSyncContext != null) {
- final boolean activeIsExpedited = activeSyncContext.mSyncOperation.delay < 0;
+ if (syncOperation.expedited && activeSyncContext != null) {
final boolean hasSameKey =
activeSyncContext.mSyncOperation.key.equals(syncOperation.key);
// This request is expedited and there is a sync in progress.
// Interrupt the current sync only if it is not expedited and if it has a different
// key than the one we are scheduling.
- if (!activeIsExpedited && !hasSameKey) {
- rescheduleImmediately(activeSyncContext.mSyncOperation);
+ if (!activeSyncContext.mSyncOperation.expedited && !hasSameKey) {
+ scheduleSyncOperation(new SyncOperation(activeSyncContext.mSyncOperation));
sendSyncFinishedOrCanceledMessage(activeSyncContext,
null /* no result since this is a cancel */);
}
}
- boolean operationEnqueued;
+ boolean queueChanged;
synchronized (mSyncQueue) {
- operationEnqueued = mSyncQueue.add(syncOperation);
+ queueChanged = mSyncQueue.add(syncOperation);
}
- if (operationEnqueued) {
+ if (queueChanged) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "scheduleSyncOperation: enqueued " + syncOperation);
}
@@ -945,16 +920,17 @@
* @param authority limit the removals to operations with this authority, if non-null
*/
public void clearScheduledSyncOperations(Account account, String authority) {
+ mSyncStorageEngine.setBackoff(account, authority,
+ SyncStorageEngine.NOT_IN_BACKOFF_MODE, SyncStorageEngine.NOT_IN_BACKOFF_MODE);
synchronized (mSyncQueue) {
mSyncQueue.clear(account, authority);
}
}
- void maybeRescheduleSync(SyncResult syncResult, SyncOperation previousSyncOperation) {
+ void maybeRescheduleSync(SyncResult syncResult, SyncOperation operation) {
boolean isLoggable = Log.isLoggable(TAG, Log.DEBUG);
if (isLoggable) {
- Log.d(TAG, "encountered error(s) during the sync: " + syncResult + ", "
- + previousSyncOperation);
+ Log.d(TAG, "encountered error(s) during the sync: " + syncResult + ", " + operation);
}
// If this sync aborted because the internal sync loop retried too many times then
@@ -963,119 +939,33 @@
// If this was a two-way sync then retry soft errors with an exponential backoff.
// If this was an upward sync then schedule a two-way sync immediately.
// Otherwise do not reschedule.
- if (syncResult.tooManyRetries) {
+ if (operation.extras.getBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, false)) {
+ Log.d(TAG, "not retrying sync operation because it is a manual sync: "
+ + operation);
+ } else if (operation.extras.getBoolean(ContentResolver.SYNC_EXTRAS_UPLOAD, false)) {
+ final SyncOperation newSyncOperation = new SyncOperation(operation);
+ newSyncOperation.extras.remove(ContentResolver.SYNC_EXTRAS_UPLOAD);
+ Log.d(TAG, "retrying sync operation as a two-way sync because an upload-only sync "
+ + "encountered an error: " + operation);
+ scheduleSyncOperation(newSyncOperation);
+ } else if (syncResult.tooManyRetries) {
Log.d(TAG, "not retrying sync operation because it retried too many times: "
- + previousSyncOperation);
+ + operation);
} else if (syncResult.madeSomeProgress()) {
if (isLoggable) {
- Log.d(TAG, "retrying sync operation immediately because "
- + "even though it had an error it achieved some success");
+ Log.d(TAG, "retrying sync operation because even though it had an error "
+ + "it achieved some success");
}
- rescheduleImmediately(previousSyncOperation);
- } else if (previousSyncOperation.extras.getBoolean(
- ContentResolver.SYNC_EXTRAS_UPLOAD, false)) {
- final SyncOperation newSyncOperation = new SyncOperation(previousSyncOperation);
- newSyncOperation.extras.putBoolean(ContentResolver.SYNC_EXTRAS_UPLOAD, false);
- newSyncOperation.setDelay(0);
- if (Config.LOGD) {
- Log.d(TAG, "retrying sync operation as a two-way sync because an upload-only sync "
- + "encountered an error: " + previousSyncOperation);
- }
- scheduleSyncOperation(newSyncOperation);
+ scheduleSyncOperation(new SyncOperation(operation));
} else if (syncResult.hasSoftError()) {
- long delay = rescheduleWithDelay(previousSyncOperation);
- if (delay >= 0) {
- if (isLoggable) {
- Log.d(TAG, "retrying sync operation in " + delay + " ms because "
- + "it encountered a soft error: " + previousSyncOperation);
- }
+ if (isLoggable) {
+ Log.d(TAG, "retrying sync operation because it encountered a soft error: "
+ + operation);
}
+ scheduleSyncOperation(new SyncOperation(operation));
} else {
- if (Config.LOGD) {
- Log.d(TAG, "not retrying sync operation because the error is a hard error: "
- + previousSyncOperation);
- }
- }
- }
-
- /**
- * Value type that represents a sync operation.
- */
- static class SyncOperation implements Comparable {
- final Account account;
- int syncSource;
- String authority;
- Bundle extras;
- final String key;
- long earliestRunTime;
- long delay;
- SyncStorageEngine.PendingOperation pendingOperation;
-
- SyncOperation(Account account, int source, String authority, Bundle extras, long delay) {
- this.account = account;
- this.syncSource = source;
- this.authority = authority;
- this.extras = new Bundle(extras);
- this.setDelay(delay);
- this.key = toKey();
- }
-
- SyncOperation(SyncOperation other) {
- this.account = other.account;
- this.syncSource = other.syncSource;
- this.authority = other.authority;
- this.extras = new Bundle(other.extras);
- this.delay = other.delay;
- this.earliestRunTime = other.earliestRunTime;
- this.key = toKey();
- }
-
- public void setDelay(long delay) {
- this.delay = delay;
- if (delay >= 0) {
- this.earliestRunTime = SystemClock.elapsedRealtime() + delay;
- } else {
- this.earliestRunTime = 0;
- }
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("authority: ").append(authority);
- sb.append(" account: ").append(account);
- sb.append(" extras: ");
- extrasToStringBuilder(extras, sb);
- sb.append(" syncSource: ").append(syncSource);
- sb.append(" when: ").append(earliestRunTime);
- sb.append(" delay: ").append(delay);
- sb.append(" key: {").append(key).append("}");
- if (pendingOperation != null) sb.append(" pendingOperation: ").append(pendingOperation);
- return sb.toString();
- }
-
- private String toKey() {
- StringBuilder sb = new StringBuilder();
- sb.append("authority: ").append(authority);
- sb.append(" account: ").append(account);
- sb.append(" extras: ");
- extrasToStringBuilder(extras, sb);
- return sb.toString();
- }
-
- private static void extrasToStringBuilder(Bundle bundle, StringBuilder sb) {
- sb.append("[");
- for (String key : bundle.keySet()) {
- sb.append(key).append("=").append(bundle.get(key)).append(" ");
- }
- sb.append("]");
- }
-
- public int compareTo(Object o) {
- SyncOperation other = (SyncOperation)o;
- if (earliestRunTime == other.earliestRunTime) {
- return 0;
- }
- return (earliestRunTime < other.earliestRunTime) ? -1 : 1;
+ Log.d(TAG, "not retrying sync operation because the error is a hard error: "
+ + operation);
}
}
@@ -1100,10 +990,7 @@
}
public void sendHeartbeat() {
- // ignore this call if it corresponds to an old sync session
- if (mActiveSyncContext == this) {
- SyncManager.this.updateHeartbeatTime();
- }
+ // heartbeats are no longer used
}
public void onFinished(SyncResult result) {
@@ -1255,7 +1142,8 @@
pw.print(" #"); pw.print(i); pw.print(": account=");
pw.print(op.account.name); pw.print(":");
pw.print(op.account.type); pw.print(" authority=");
- pw.println(op.authority);
+ pw.print(op.authority); pw.print(" expedited=");
+ pw.println(op.expedited);
if (op.extras != null && op.extras.size() > 0) {
sb.setLength(0);
SyncOperation.extrasToStringBuilder(op.extras, sb);
@@ -1295,6 +1183,24 @@
}
pw.print(" "); pw.print(authority.authority);
pw.println(":");
+ final String syncable = authority.syncable > 0
+ ? "syncable"
+ : (authority.syncable == 0 ? "not syncable" : "not initialized");
+ final String enabled = authority.enabled ? "enabled" : "disabled";
+ final String delayUntil = authority.delayUntil > now
+ ? "delay for " + ((authority.delayUntil - now) / 1000) + " sec"
+ : "no delay required";
+ final String backoff = authority.backoffTime > now
+ ? "backoff for " + ((authority.backoffTime - now) / 1000)
+ + " sec"
+ : "no backoff required";
+ final String backoffDelay = authority.backoffDelay > 0
+ ? ("the backoff increment is " + authority.backoffDelay / 1000
+ + " sec")
+ : "no backoff increment";
+ pw.println(String.format(
+ " settings: %s, %s, %s, %s, %s",
+ enabled, syncable, backoff, backoffDelay, delayUntil));
pw.print(" count: local="); pw.print(status.numSourceLocal);
pw.print(" poll="); pw.print(status.numSourcePoll);
pw.print(" server="); pw.print(status.numSourceServer);
@@ -1568,11 +1474,9 @@
}
SyncHandlerMessagePayload payload = (SyncHandlerMessagePayload)msg.obj;
if (mActiveSyncContext != payload.activeSyncContext) {
- if (Config.LOGD) {
- Log.d(TAG, "handleSyncHandlerMessage: sync context doesn't match, "
- + "dropping: mActiveSyncContext " + mActiveSyncContext
- + " != " + payload.activeSyncContext);
- }
+ Log.d(TAG, "handleSyncHandlerMessage: sync context doesn't match, "
+ + "dropping: mActiveSyncContext " + mActiveSyncContext
+ + " != " + payload.activeSyncContext);
return;
}
runSyncFinishedOrCanceled(payload.syncResult);
@@ -1685,14 +1589,12 @@
if (now > activeSyncContext.mTimeoutStartTime + MAX_TIME_PER_SYNC) {
SyncOperation nextSyncOperation;
synchronized (mSyncQueue) {
- nextSyncOperation = mSyncQueue.head();
+ nextSyncOperation = mSyncQueue.nextReadyToRun(now);
}
- if (nextSyncOperation != null && nextSyncOperation.earliestRunTime <= now) {
- if (Config.LOGD) {
- Log.d(TAG, "canceling and rescheduling sync because it ran too long: "
- + activeSyncContext.mSyncOperation);
- }
- rescheduleImmediately(activeSyncContext.mSyncOperation);
+ if (nextSyncOperation != null) {
+ Log.d(TAG, "canceling and rescheduling sync because it ran too long: "
+ + activeSyncContext.mSyncOperation);
+ scheduleSyncOperation(new SyncOperation(activeSyncContext.mSyncOperation));
sendSyncFinishedOrCanceledMessage(activeSyncContext,
null /* no result since this is a cancel */);
} else {
@@ -1712,7 +1614,6 @@
if (isLoggable) {
Log.v(TAG, "runStateIdle: no data connection, skipping");
}
- setStatusText("No data connection");
return;
}
@@ -1720,7 +1621,6 @@
if (isLoggable) {
Log.v(TAG, "runStateIdle: memory low, skipping");
}
- setStatusText("Memory low");
return;
}
@@ -1731,7 +1631,6 @@
if (isLoggable) {
Log.v(TAG, "runStateIdle: accounts not known, skipping");
}
- setStatusText("Accounts not known yet");
return;
}
@@ -1742,8 +1641,9 @@
final boolean backgroundDataUsageAllowed =
getConnectivityManager().getBackgroundDataSetting();
synchronized (mSyncQueue) {
+ final long now = SystemClock.elapsedRealtime();
while (true) {
- op = mSyncQueue.head();
+ op = mSyncQueue.nextReadyToRun(now);
if (op == null) {
if (isLoggable) {
Log.v(TAG, "runStateIdle: no more sync operations, returning");
@@ -1751,73 +1651,57 @@
return;
}
+ // we are either going to run this sync or drop it so go ahead and remove it
+ // from the queue now
+ mSyncQueue.remove(op);
+
// Sync is disabled, drop this operation.
if (!isSyncEnabled()) {
if (isLoggable) {
Log.v(TAG, "runStateIdle: sync disabled, dropping " + op);
}
- mSyncQueue.popHead();
- continue;
- }
-
- // skip the sync if it isn't manual and auto sync is disabled
- final boolean manualSync = op.extras.getBoolean(
- ContentResolver.SYNC_EXTRAS_MANUAL, false);
- final boolean syncAutomatically =
- mSyncStorageEngine.getSyncAutomatically(op.account, op.authority)
- && mSyncStorageEngine.getMasterSyncAutomatically();
- boolean syncAllowed =
- manualSync || (backgroundDataUsageAllowed && syncAutomatically);
- int isSyncable = mSyncStorageEngine.getIsSyncable(op.account, op.authority);
- if (isSyncable == 0) {
- // if not syncable, don't allow
- syncAllowed = false;
- } else if (isSyncable < 0) {
- // if the syncable state is unknown, only allow initialization syncs
- syncAllowed =
- op.extras.getBoolean(ContentResolver.SYNC_EXTRAS_INITIALIZE, false);
- }
- if (!syncAllowed) {
- if (isLoggable) {
- Log.v(TAG, "runStateIdle: sync off, dropping " + op);
- }
- mSyncQueue.popHead();
continue;
}
// skip the sync if the account of this operation no longer exists
if (!ArrayUtils.contains(accounts, op.account)) {
- mSyncQueue.popHead();
if (isLoggable) {
Log.v(TAG, "runStateIdle: account not present, dropping " + op);
}
continue;
}
- // go ahead and try to sync this syncOperation
- if (isLoggable) {
- Log.v(TAG, "runStateIdle: found sync candidate: " + op);
+ // skip the sync if it isn't manual and auto sync is disabled
+ final boolean manualSync =
+ op.extras.getBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, false);
+ final boolean syncAutomatically =
+ mSyncStorageEngine.getSyncAutomatically(op.account, op.authority)
+ && mSyncStorageEngine.getMasterSyncAutomatically();
+ if (!(manualSync || (backgroundDataUsageAllowed && syncAutomatically))) {
+ if (isLoggable) {
+ Log.v(TAG, "runStateIdle: sync of this operation is not allowed, "
+ + "dropping " + op);
+ }
+ continue;
}
+
+ if (mSyncStorageEngine.getIsSyncable(op.account, op.authority) <= 0) {
+ // if not syncable or if the syncable is unknown (< 0), don't allow
+ if (isLoggable) {
+ Log.v(TAG, "runStateIdle: sync of this operation is not allowed, "
+ + "dropping " + op);
+ }
+ continue;
+ }
+
+ // go ahead and try to sync this syncOperation
break;
}
- // If the first SyncOperation isn't ready to run schedule a wakeup and
- // get out.
- final long now = SystemClock.elapsedRealtime();
- if (op.earliestRunTime > now) {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "runStateIdle: the time is " + now + " yet the next "
- + "sync operation is for " + op.earliestRunTime + ": " + op);
- }
- return;
- }
-
- // We will do this sync. Remove it from the queue and run it outside of the
- // synchronized block.
+ // We will do this sync. Run it outside of the synchronized block.
if (isLoggable) {
Log.v(TAG, "runStateIdle: we are going to sync " + op);
}
- mSyncQueue.popHead();
}
// connect to the sync adapter
@@ -1825,9 +1709,7 @@
RegisteredServicesCache.ServiceInfo<SyncAdapterType> syncAdapterInfo =
mSyncAdapters.getServiceInfo(syncAdapterType);
if (syncAdapterInfo == null) {
- if (Config.LOGD) {
- Log.d(TAG, "can't find a sync adapter for " + syncAdapterType);
- }
+ Log.d(TAG, "can't find a sync adapter for " + syncAdapterType);
runStateIdle();
return;
}
@@ -1861,25 +1743,22 @@
syncAdapter.startSync(mActiveSyncContext, syncOperation.authority,
syncOperation.account, syncOperation.extras);
} catch (RemoteException remoteExc) {
- if (Config.LOGD) {
- Log.d(TAG, "runStateIdle: caught a RemoteException, rescheduling", remoteExc);
- }
+ Log.d(TAG, "runStateIdle: caught a RemoteException, rescheduling", remoteExc);
mActiveSyncContext.unBindFromSyncAdapter();
mActiveSyncContext = null;
mSyncStorageEngine.setActiveSync(mActiveSyncContext);
- rescheduleWithDelay(syncOperation);
+ increaseBackoffSetting(syncOperation);
+ scheduleSyncOperation(new SyncOperation(syncOperation));
} catch (RuntimeException exc) {
mActiveSyncContext.unBindFromSyncAdapter();
mActiveSyncContext = null;
mSyncStorageEngine.setActiveSync(mActiveSyncContext);
- Log.e(TAG, "Caught a RuntimeException while starting the sync " + syncOperation,
- exc);
+ Log.e(TAG, "Caught RuntimeException while starting the sync " + syncOperation, exc);
}
}
private void runSyncFinishedOrCanceled(SyncResult syncResult) {
boolean isLoggable = Log.isLoggable(TAG, Log.VERBOSE);
- if (isLoggable) Log.v(TAG, "runSyncFinishedOrCanceled");
final ActiveSyncContext activeSyncContext = mActiveSyncContext;
mActiveSyncContext = null;
mSyncStorageEngine.setActiveSync(mActiveSyncContext);
@@ -1893,32 +1772,34 @@
int upstreamActivity;
if (syncResult != null) {
if (isLoggable) {
- Log.v(TAG, "runSyncFinishedOrCanceled: is a finished: operation "
+ Log.v(TAG, "runSyncFinishedOrCanceled [finished]: "
+ syncOperation + ", result " + syncResult);
}
if (!syncResult.hasError()) {
- if (isLoggable) {
- Log.v(TAG, "finished sync operation " + syncOperation);
- }
historyMessage = SyncStorageEngine.MESG_SUCCESS;
// TODO: set these correctly when the SyncResult is extended to include it
downstreamActivity = 0;
upstreamActivity = 0;
+ clearBackoffSetting(syncOperation);
} else {
- maybeRescheduleSync(syncResult, syncOperation);
- if (Config.LOGD) {
- Log.d(TAG, "failed sync operation " + syncOperation);
+ Log.d(TAG, "failed sync operation " + syncOperation + ", " + syncResult);
+ // the operation failed so increase the backoff time
+ if (!syncResult.syncAlreadyInProgress) {
+ increaseBackoffSetting(syncOperation);
}
+ // reschedule the sync if so indicated by the syncResult
+ maybeRescheduleSync(syncResult, syncOperation);
historyMessage = Integer.toString(syncResultToErrorNumber(syncResult));
// TODO: set these correctly when the SyncResult is extended to include it
downstreamActivity = 0;
upstreamActivity = 0;
}
+
+ setDelayUntilTime(syncOperation, syncResult.delayUntil);
} else {
if (isLoggable) {
- Log.v(TAG, "runSyncFinishedOrCanceled: is a cancel: operation "
- + syncOperation);
+ Log.v(TAG, "runSyncFinishedOrCanceled [canceled]: " + syncOperation);
}
if (activeSyncContext.mSyncAdapter != null) {
try {
@@ -2070,19 +1951,17 @@
if (mAccounts == null) return;
if (mStorageIsLow) return;
+ final long now = SystemClock.elapsedRealtime();
+
// Compute the alarm fire time:
// - not syncing: time of the next sync operation
// - syncing, no notification: time from sync start to notification create time
// - syncing, with notification: time till timeout of the active sync operation
- Long alarmTime = null;
+ Long alarmTime;
ActiveSyncContext activeSyncContext = mActiveSyncContext;
if (activeSyncContext == null) {
- SyncOperation syncOperation;
synchronized (mSyncQueue) {
- syncOperation = mSyncQueue.head();
- }
- if (syncOperation != null) {
- alarmTime = syncOperation.earliestRunTime;
+ alarmTime = mSyncQueue.nextRunTime(now);
}
} else {
final long notificationTime =
@@ -2104,7 +1983,7 @@
when += ERROR_NOTIFICATION_DELAY_MS;
// convert when fron absolute time to elapsed run time
long delay = when - System.currentTimeMillis();
- when = SystemClock.elapsedRealtime() + delay;
+ when = now + delay;
alarmTime = alarmTime != null ? Math.min(alarmTime, when) : when;
}
}
@@ -2228,221 +2107,4 @@
}
}
- static class SyncQueue {
- private SyncStorageEngine mSyncStorageEngine;
-
- private static final boolean DEBUG_CHECK_DATA_CONSISTENCY = false;
-
- // A priority queue of scheduled SyncOperations that is designed to make it quick
- // to find the next SyncOperation that should be considered for running.
- private final PriorityQueue<SyncOperation> mOpsByWhen = new PriorityQueue<SyncOperation>();
-
- // A Map of SyncOperations operationKey -> SyncOperation that is designed for
- // quick lookup of an enqueued SyncOperation.
- private final HashMap<String, SyncOperation> mOpsByKey = Maps.newHashMap();
-
- public SyncQueue(SyncStorageEngine syncStorageEngine) {
- mSyncStorageEngine = syncStorageEngine;
- ArrayList<SyncStorageEngine.PendingOperation> ops
- = mSyncStorageEngine.getPendingOperations();
- final int N = ops.size();
- for (int i=0; i<N; i++) {
- SyncStorageEngine.PendingOperation op = ops.get(i);
- SyncOperation syncOperation = new SyncOperation(
- op.account, op.syncSource, op.authority, op.extras, 0);
- syncOperation.pendingOperation = op;
- add(syncOperation, op);
- }
-
- if (DEBUG_CHECK_DATA_CONSISTENCY) debugCheckDataStructures(true /* check the DB */);
- }
-
- public boolean add(SyncOperation operation) {
- return add(new SyncOperation(operation),
- null /* this is not coming from the database */);
- }
-
- private boolean add(SyncOperation operation,
- SyncStorageEngine.PendingOperation pop) {
- if (DEBUG_CHECK_DATA_CONSISTENCY) debugCheckDataStructures(pop == null);
-
- // If this operation is expedited then set its earliestRunTime to be immediately
- // before the head of the list, or not if none are in the list.
- if (operation.delay < 0) {
- SyncOperation headOperation = head();
- if (headOperation != null) {
- operation.earliestRunTime = Math.min(SystemClock.elapsedRealtime(),
- headOperation.earliestRunTime - 1);
- } else {
- operation.earliestRunTime = SystemClock.elapsedRealtime();
- }
- }
-
- // - if an operation with the same key exists and this one should run earlier,
- // delete the old one and add the new one
- // - if an operation with the same key exists and if this one should run
- // later, ignore it
- // - if no operation exists then add the new one
- final String operationKey = operation.key;
- SyncOperation existingOperation = mOpsByKey.get(operationKey);
-
- // if this operation matches an existing operation that is being retried (delay > 0)
- // and this isn't a manual sync operation, ignore this operation
- if (existingOperation != null && existingOperation.delay > 0) {
- if (!operation.extras.getBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, false)) {
- return false;
- }
- }
-
- if (existingOperation != null
- && operation.earliestRunTime >= existingOperation.earliestRunTime) {
- if (DEBUG_CHECK_DATA_CONSISTENCY) debugCheckDataStructures(pop == null);
- return false;
- }
-
- if (existingOperation != null) {
- removeByKey(operationKey);
- }
-
- operation.pendingOperation = pop;
- if (operation.pendingOperation == null) {
- pop = new SyncStorageEngine.PendingOperation(
- operation.account, operation.syncSource,
- operation.authority, operation.extras);
- pop = mSyncStorageEngine.insertIntoPending(pop);
- if (pop == null) {
- throw new IllegalStateException("error adding pending sync operation "
- + operation);
- }
- operation.pendingOperation = pop;
- }
-
- if (DEBUG_CHECK_DATA_CONSISTENCY) {
- debugCheckDataStructures(
- false /* don't compare with the DB, since we know
- it is inconsistent right now */ );
- }
- mOpsByKey.put(operationKey, operation);
- mOpsByWhen.add(operation);
- if (DEBUG_CHECK_DATA_CONSISTENCY) debugCheckDataStructures(pop == null);
- return true;
- }
-
- public void removeByKey(String operationKey) {
- if (DEBUG_CHECK_DATA_CONSISTENCY) debugCheckDataStructures(true /* check the DB */);
- SyncOperation operationToRemove = mOpsByKey.remove(operationKey);
- if (!mOpsByWhen.remove(operationToRemove)) {
- throw new IllegalStateException(
- "unable to find " + operationToRemove + " in mOpsByWhen");
- }
-
- if (!mSyncStorageEngine.deleteFromPending(operationToRemove.pendingOperation)) {
- final String errorMessage = "unable to find pending row for " + operationToRemove;
- Log.e(TAG, errorMessage, new IllegalStateException(errorMessage));
- }
-
- if (DEBUG_CHECK_DATA_CONSISTENCY) debugCheckDataStructures(true /* check the DB */);
- }
-
- public SyncOperation head() {
- if (DEBUG_CHECK_DATA_CONSISTENCY) debugCheckDataStructures(true /* check the DB */);
- return mOpsByWhen.peek();
- }
-
- public void popHead() {
- if (DEBUG_CHECK_DATA_CONSISTENCY) debugCheckDataStructures(true /* check the DB */);
- SyncOperation operation = mOpsByWhen.remove();
- if (mOpsByKey.remove(operation.key) == null) {
- throw new IllegalStateException("unable to find " + operation + " in mOpsByKey");
- }
-
- if (!mSyncStorageEngine.deleteFromPending(operation.pendingOperation)) {
- final String errorMessage = "unable to find pending row for " + operation;
- Log.e(TAG, errorMessage, new IllegalStateException(errorMessage));
- }
-
- if (DEBUG_CHECK_DATA_CONSISTENCY) debugCheckDataStructures(true /* check the DB */);
- }
-
- public void clear(Account account, String authority) {
- Iterator<Map.Entry<String, SyncOperation>> entries = mOpsByKey.entrySet().iterator();
- while (entries.hasNext()) {
- Map.Entry<String, SyncOperation> entry = entries.next();
- SyncOperation syncOperation = entry.getValue();
- if (account != null && !syncOperation.account.equals(account)) continue;
- if (authority != null && !syncOperation.authority.equals(authority)) continue;
-
- if (DEBUG_CHECK_DATA_CONSISTENCY) debugCheckDataStructures(true /* check the DB */);
- entries.remove();
- if (!mOpsByWhen.remove(syncOperation)) {
- throw new IllegalStateException(
- "unable to find " + syncOperation + " in mOpsByWhen");
- }
-
- if (!mSyncStorageEngine.deleteFromPending(syncOperation.pendingOperation)) {
- final String errorMessage = "unable to find pending row for " + syncOperation;
- Log.e(TAG, errorMessage, new IllegalStateException(errorMessage));
- }
-
- if (DEBUG_CHECK_DATA_CONSISTENCY) debugCheckDataStructures(true /* check the DB */);
- }
- }
-
- public void dump(StringBuilder sb) {
- sb.append("SyncQueue: ").append(mOpsByWhen.size()).append(" operation(s)\n");
- for (SyncOperation operation : mOpsByWhen) {
- sb.append(operation).append("\n");
- }
- }
-
- private void debugCheckDataStructures(boolean checkDatabase) {
- if (mOpsByKey.size() != mOpsByWhen.size()) {
- throw new IllegalStateException("size mismatch: "
- + mOpsByKey .size() + " != " + mOpsByWhen.size());
- }
- for (SyncOperation operation : mOpsByWhen) {
- if (!mOpsByKey.containsKey(operation.key)) {
- throw new IllegalStateException(
- "operation " + operation + " is in mOpsByWhen but not mOpsByKey");
- }
- }
- for (Map.Entry<String, SyncOperation> entry : mOpsByKey.entrySet()) {
- final SyncOperation operation = entry.getValue();
- final String key = entry.getKey();
- if (!key.equals(operation.key)) {
- throw new IllegalStateException(
- "operation " + operation + " in mOpsByKey doesn't match key " + key);
- }
- if (!mOpsByWhen.contains(operation)) {
- throw new IllegalStateException(
- "operation " + operation + " is in mOpsByKey but not mOpsByWhen");
- }
- }
-
- if (checkDatabase) {
- final int N = mSyncStorageEngine.getPendingOperationCount();
- if (mOpsByKey.size() != N) {
- ArrayList<SyncStorageEngine.PendingOperation> ops
- = mSyncStorageEngine.getPendingOperations();
- StringBuilder sb = new StringBuilder();
- for (int i=0; i<N; i++) {
- SyncStorageEngine.PendingOperation op = ops.get(i);
- sb.append("#");
- sb.append(i);
- sb.append(": account=");
- sb.append(op.account);
- sb.append(" syncSource=");
- sb.append(op.syncSource);
- sb.append(" authority=");
- sb.append(op.authority);
- sb.append("\n");
- }
- dump(sb);
- throw new IllegalStateException("DB size mismatch: "
- + mOpsByKey.size() + " != " + N + "\n"
- + sb.toString());
- }
- }
- }
- }
}
diff --git a/core/java/android/content/SyncOperation.java b/core/java/android/content/SyncOperation.java
new file mode 100644
index 0000000..2d6e833
--- /dev/null
+++ b/core/java/android/content/SyncOperation.java
@@ -0,0 +1,95 @@
+package android.content;
+
+import android.accounts.Account;
+import android.os.Bundle;
+import android.os.SystemClock;
+
+/**
+ * Value type that represents a sync operation.
+ * @hide
+ */
+public class SyncOperation implements Comparable {
+ public final Account account;
+ public int syncSource;
+ public String authority;
+ public Bundle extras;
+ public final String key;
+ public long earliestRunTime;
+ public boolean expedited;
+ public SyncStorageEngine.PendingOperation pendingOperation;
+
+ public SyncOperation(Account account, int source, String authority, Bundle extras,
+ long delay) {
+ this.account = account;
+ this.syncSource = source;
+ this.authority = authority;
+ this.extras = new Bundle(extras);
+ removeFalseExtra(ContentResolver.SYNC_EXTRAS_UPLOAD);
+ removeFalseExtra(ContentResolver.SYNC_EXTRAS_MANUAL);
+ removeFalseExtra(ContentResolver.SYNC_EXTRAS_DISCARD_LOCAL_DELETIONS);
+ removeFalseExtra(ContentResolver.SYNC_EXTRAS_EXPEDITED);
+ removeFalseExtra(ContentResolver.SYNC_EXTRAS_OVERRIDE_TOO_MANY_DELETIONS);
+ final long now = SystemClock.elapsedRealtime();
+ if (delay < 0) {
+ this.expedited = true;
+ this.earliestRunTime = now;
+ } else {
+ this.expedited = false;
+ this.earliestRunTime = now + delay;
+ }
+ this.key = toKey();
+ }
+
+ private void removeFalseExtra(String extraName) {
+ if (!extras.getBoolean(extraName, false)) {
+ extras.remove(extraName);
+ }
+ }
+
+ SyncOperation(SyncOperation other) {
+ this.account = other.account;
+ this.syncSource = other.syncSource;
+ this.authority = other.authority;
+ this.extras = new Bundle(other.extras);
+ this.expedited = other.expedited;
+ this.earliestRunTime = SystemClock.elapsedRealtime();
+ this.key = toKey();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("authority: ").append(authority);
+ sb.append(" account: ").append(account);
+ sb.append(" extras: ");
+ extrasToStringBuilder(extras, sb);
+ sb.append(" syncSource: ").append(syncSource);
+ sb.append(" when: ").append(earliestRunTime);
+ sb.append(" expedited: ").append(expedited);
+ return sb.toString();
+ }
+
+ private String toKey() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("authority: ").append(authority);
+ sb.append(" account: ").append(account);
+ sb.append(" extras: ");
+ extrasToStringBuilder(extras, sb);
+ return sb.toString();
+ }
+
+ public static void extrasToStringBuilder(Bundle bundle, StringBuilder sb) {
+ sb.append("[");
+ for (String key : bundle.keySet()) {
+ sb.append(key).append("=").append(bundle.get(key)).append(" ");
+ }
+ sb.append("]");
+ }
+
+ public int compareTo(Object o) {
+ SyncOperation other = (SyncOperation)o;
+ if (earliestRunTime == other.earliestRunTime) {
+ return 0;
+ }
+ return (earliestRunTime < other.earliestRunTime) ? -1 : 1;
+ }
+}
diff --git a/core/java/android/content/SyncQueue.java b/core/java/android/content/SyncQueue.java
new file mode 100644
index 0000000..a9f15d9
--- /dev/null
+++ b/core/java/android/content/SyncQueue.java
@@ -0,0 +1,190 @@
+package android.content;
+
+import com.google.android.collect.Maps;
+
+import android.os.Bundle;
+import android.os.SystemClock;
+import android.util.Pair;
+import android.util.Log;
+import android.accounts.Account;
+
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Iterator;
+
+/**
+ *
+ * @hide
+ */
+public class SyncQueue {
+ private static final String TAG = "SyncManager";
+ private SyncStorageEngine mSyncStorageEngine;
+
+ // A Map of SyncOperations operationKey -> SyncOperation that is designed for
+ // quick lookup of an enqueued SyncOperation.
+ private final HashMap<String, SyncOperation> mOperationsMap = Maps.newHashMap();
+
+ public SyncQueue(SyncStorageEngine syncStorageEngine) {
+ mSyncStorageEngine = syncStorageEngine;
+ ArrayList<SyncStorageEngine.PendingOperation> ops
+ = mSyncStorageEngine.getPendingOperations();
+ final int N = ops.size();
+ for (int i=0; i<N; i++) {
+ SyncStorageEngine.PendingOperation op = ops.get(i);
+ // -1 is a special value that means expedited
+ final int delay = op.expedited ? -1 : 0;
+ SyncOperation syncOperation = new SyncOperation(
+ op.account, op.syncSource, op.authority, op.extras, delay);
+ syncOperation.pendingOperation = op;
+ add(syncOperation, op);
+ }
+ }
+
+ public boolean add(SyncOperation operation) {
+ return add(operation, null /* this is not coming from the database */);
+ }
+
+ private boolean add(SyncOperation operation,
+ SyncStorageEngine.PendingOperation pop) {
+ // - if an operation with the same key exists and this one should run earlier,
+ // update the earliestRunTime of the existing to the new time
+ // - if an operation with the same key exists and if this one should run
+ // later, ignore it
+ // - if no operation exists then add the new one
+ final String operationKey = operation.key;
+ final SyncOperation existingOperation = mOperationsMap.get(operationKey);
+
+ if (existingOperation != null) {
+ boolean changed = false;
+ if (existingOperation.expedited == operation.expedited) {
+ final long newRunTime =
+ Math.min(existingOperation.earliestRunTime, operation.earliestRunTime);
+ if (existingOperation.earliestRunTime != newRunTime) {
+ existingOperation.earliestRunTime = newRunTime;
+ changed = true;
+ }
+ } else {
+ if (operation.expedited) {
+ existingOperation.expedited = true;
+ changed = true;
+ }
+ }
+ return changed;
+ }
+
+ operation.pendingOperation = pop;
+ if (operation.pendingOperation == null) {
+ pop = new SyncStorageEngine.PendingOperation(
+ operation.account, operation.syncSource,
+ operation.authority, operation.extras, operation.expedited);
+ pop = mSyncStorageEngine.insertIntoPending(pop);
+ if (pop == null) {
+ throw new IllegalStateException("error adding pending sync operation "
+ + operation);
+ }
+ operation.pendingOperation = pop;
+ }
+
+ mOperationsMap.put(operationKey, operation);
+ return true;
+ }
+
+ public void remove(SyncOperation operation) {
+ SyncOperation operationToRemove = mOperationsMap.remove(operation.key);
+ if (!mSyncStorageEngine.deleteFromPending(operationToRemove.pendingOperation)) {
+ final String errorMessage = "unable to find pending row for " + operationToRemove;
+ Log.e(TAG, errorMessage, new IllegalStateException(errorMessage));
+ }
+ }
+
+ /**
+ * Find the operation that should run next. Operations are sorted by their earliestRunTime,
+ * prioritizing expedited operations. The earliestRunTime is adjusted by the sync adapter's
+ * backoff and delayUntil times, if any.
+ * @param now the current {@link android.os.SystemClock#elapsedRealtime()}
+ * @return the operation that should run next and when it should run. The time may be in
+ * the future. It is expressed in milliseconds since boot.
+ */
+ private Pair<SyncOperation, Long> nextOperation(long now) {
+ SyncOperation lowestOp = null;
+ long lowestOpRunTime = 0;
+ for (SyncOperation op : mOperationsMap.values()) {
+ // effectiveRunTime:
+ // - backoffTime > currentTime : backoffTime
+ // - backoffTime <= currentTime : op.runTime
+ Pair<Long, Long> backoff = null;
+ long delayUntilTime = 0;
+ final boolean isManualSync =
+ op.extras.getBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, false);
+ if (!isManualSync) {
+ backoff = mSyncStorageEngine.getBackoff(op.account, op.authority);
+ delayUntilTime = mSyncStorageEngine.getDelayUntilTime(op.account, op.authority);
+ }
+ long backoffTime = Math.max(backoff != null ? backoff.first : 0, delayUntilTime);
+ long opRunTime = backoffTime > now ? backoffTime : op.earliestRunTime;
+ if (lowestOp == null
+ || (lowestOp.expedited == op.expedited
+ ? opRunTime < lowestOpRunTime
+ : op.expedited)) {
+ lowestOp = op;
+ lowestOpRunTime = opRunTime;
+ }
+ }
+ if (lowestOp == null) {
+ return null;
+ }
+ return Pair.create(lowestOp, lowestOpRunTime);
+ }
+
+ /**
+ * Return when the next SyncOperation will be ready to run or null if there are
+ * none.
+ * @param now the current {@link android.os.SystemClock#elapsedRealtime()}, used to
+ * decide if the sync operation is ready to run
+ * @return when the next SyncOperation will be ready to run, expressed in elapsedRealtime()
+ */
+ public Long nextRunTime(long now) {
+ Pair<SyncOperation, Long> nextOpAndRunTime = nextOperation(now);
+ if (nextOpAndRunTime == null) {
+ return null;
+ }
+ return nextOpAndRunTime.second;
+ }
+
+ /**
+ * Find and return the SyncOperation that should be run next and is ready to run.
+ * @param now the current {@link android.os.SystemClock#elapsedRealtime()}, used to
+ * decide if the sync operation is ready to run
+ * @return the SyncOperation that should be run next and is ready to run.
+ */
+ public SyncOperation nextReadyToRun(long now) {
+ Pair<SyncOperation, Long> nextOpAndRunTime = nextOperation(now);
+ if (nextOpAndRunTime == null || nextOpAndRunTime.second > now) {
+ return null;
+ }
+ return nextOpAndRunTime.first;
+ }
+
+ public void clear(Account account, String authority) {
+ Iterator<Map.Entry<String, SyncOperation>> entries = mOperationsMap.entrySet().iterator();
+ while (entries.hasNext()) {
+ Map.Entry<String, SyncOperation> entry = entries.next();
+ SyncOperation syncOperation = entry.getValue();
+ if (account != null && !syncOperation.account.equals(account)) continue;
+ if (authority != null && !syncOperation.authority.equals(authority)) continue;
+ entries.remove();
+ if (!mSyncStorageEngine.deleteFromPending(syncOperation.pendingOperation)) {
+ final String errorMessage = "unable to find pending row for " + syncOperation;
+ Log.e(TAG, errorMessage, new IllegalStateException(errorMessage));
+ }
+ }
+ }
+
+ public void dump(StringBuilder sb) {
+ sb.append("SyncQueue: ").append(mOperationsMap.size()).append(" operation(s)\n");
+ for (SyncOperation operation : mOperationsMap.values()) {
+ sb.append(operation).append("\n");
+ }
+ }
+}
diff --git a/core/java/android/content/SyncResult.java b/core/java/android/content/SyncResult.java
index 57161b6..3fbe847 100644
--- a/core/java/android/content/SyncResult.java
+++ b/core/java/android/content/SyncResult.java
@@ -14,6 +14,9 @@
public boolean fullSyncRequested;
public boolean partialSyncUnavailable;
public boolean moreRecordsToGet;
+
+ // in seconds since epoch
+ public long delayUntil;
public final SyncStats stats;
public static final SyncResult ALREADY_IN_PROGRESS;
@@ -32,6 +35,7 @@
this.fullSyncRequested = false;
this.partialSyncUnavailable = false;
this.moreRecordsToGet = false;
+ this.delayUntil = 0;
this.stats = new SyncStats();
}
@@ -43,6 +47,7 @@
fullSyncRequested = parcel.readInt() != 0;
partialSyncUnavailable = parcel.readInt() != 0;
moreRecordsToGet = parcel.readInt() != 0;
+ delayUntil = parcel.readLong();
stats = new SyncStats(parcel);
}
@@ -80,6 +85,7 @@
fullSyncRequested = false;
partialSyncUnavailable = false;
moreRecordsToGet = false;
+ delayUntil = 0;
stats.clear();
}
@@ -105,6 +111,7 @@
parcel.writeInt(fullSyncRequested ? 1 : 0);
parcel.writeInt(partialSyncUnavailable ? 1 : 0);
parcel.writeInt(moreRecordsToGet ? 1 : 0);
+ parcel.writeLong(delayUntil);
stats.writeToParcel(parcel, flags);
}
@@ -123,6 +130,7 @@
sb.append(" partialSyncUnavailable: ").append(partialSyncUnavailable);
}
if (moreRecordsToGet) sb.append(" moreRecordsToGet: ").append(moreRecordsToGet);
+ if (delayUntil > 0) sb.append(" delayUntil: ").append(delayUntil);
sb.append(stats);
return sb.toString();
}
diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java
index 4c53201..db70096 100644
--- a/core/java/android/content/SyncStorageEngine.java
+++ b/core/java/android/content/SyncStorageEngine.java
@@ -36,10 +36,11 @@
import android.os.Parcel;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
-import android.os.SystemProperties;
+import android.os.SystemClock;
import android.util.Log;
import android.util.SparseArray;
import android.util.Xml;
+import android.util.Pair;
import java.io.File;
import java.io.FileInputStream;
@@ -88,6 +89,8 @@
/** Enum value for a user-initiated sync. */
public static final int SOURCE_USER = 3;
+ public static final long NOT_IN_BACKOFF_MODE = -1;
+
private static final Intent SYNC_CONNECTION_SETTING_CHANGED_INTENT =
new Intent("com.android.sync.SYNC_CONN_STATUS_CHANGED");
@@ -117,16 +120,18 @@
final int syncSource;
final String authority;
final Bundle extras; // note: read-only.
+ final boolean expedited;
int authorityId;
byte[] flatExtras;
PendingOperation(Account account, int source,
- String authority, Bundle extras) {
+ String authority, Bundle extras, boolean expedited) {
this.account = account;
this.syncSource = source;
this.authority = authority;
this.extras = extras != null ? new Bundle(extras) : extras;
+ this.expedited = expedited;
this.authorityId = -1;
}
@@ -136,6 +141,7 @@
this.authority = other.authority;
this.extras = other.extras;
this.authorityId = other.authorityId;
+ this.expedited = other.expedited;
}
}
@@ -155,6 +161,9 @@
final int ident;
boolean enabled;
int syncable;
+ long backoffTime;
+ long backoffDelay;
+ long delayUntil;
AuthorityInfo(Account account, String authority, int ident) {
this.account = account;
@@ -162,6 +171,8 @@
this.ident = ident;
enabled = SYNC_ENABLED_DEFAULT;
syncable = -1; // default to "unknown"
+ backoffTime = -1; // if < 0 then we aren't in backoff mode
+ backoffDelay = -1; // if < 0 then we aren't in backoff mode
}
}
@@ -280,7 +291,7 @@
public static void init(Context context) {
if (sSyncStorageEngine != null) {
- throw new IllegalStateException("already initialized");
+ return;
}
sSyncStorageEngine = new SyncStorageEngine(context);
}
@@ -380,7 +391,7 @@
}
if (!wasEnabled && sync) {
- mContext.getContentResolver().requestSync(account, providerName, new Bundle());
+ ContentResolver.requestSync(account, providerName, new Bundle());
}
reportChange(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS);
}
@@ -424,11 +435,91 @@
}
if (oldState <= 0 && syncable > 0) {
- mContext.getContentResolver().requestSync(account, providerName, new Bundle());
+ ContentResolver.requestSync(account, providerName, new Bundle());
}
reportChange(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS);
}
+ public Pair<Long, Long> getBackoff(Account account, String providerName) {
+ synchronized (mAuthorities) {
+ AuthorityInfo authority = getAuthorityLocked(account, providerName, "getBackoff");
+ if (authority == null || authority.backoffTime < 0) {
+ return null;
+ }
+ return Pair.create(authority.backoffTime, authority.backoffDelay);
+ }
+ }
+
+ public void setBackoff(Account account, String providerName,
+ long nextSyncTime, long nextDelay) {
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "setBackoff: " + account + ", provider " + providerName
+ + " -> nextSyncTime " + nextSyncTime + ", nextDelay " + nextDelay);
+ }
+ boolean changed = false;
+ synchronized (mAuthorities) {
+ if (account == null || providerName == null) {
+ for (AccountInfo accountInfo : mAccounts.values()) {
+ if (account != null && !account.equals(accountInfo.account)) continue;
+ for (AuthorityInfo authorityInfo : accountInfo.authorities.values()) {
+ if (providerName != null && !providerName.equals(authorityInfo.authority)) {
+ continue;
+ }
+ if (authorityInfo.backoffTime != nextSyncTime
+ || authorityInfo.backoffDelay != nextDelay) {
+ authorityInfo.backoffTime = nextSyncTime;
+ authorityInfo.backoffDelay = nextDelay;
+ changed = true;
+ }
+ }
+ }
+ } else {
+ AuthorityInfo authority =
+ getOrCreateAuthorityLocked(account, providerName, -1, false);
+ if (authority.backoffTime == nextSyncTime && authority.backoffDelay == nextDelay) {
+ return;
+ }
+ authority.backoffTime = nextSyncTime;
+ authority.backoffDelay = nextDelay;
+ changed = true;
+ }
+ if (changed) {
+ writeAccountInfoLocked();
+ }
+ }
+
+ if (changed) {
+ reportChange(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS);
+ }
+ }
+
+ public void setDelayUntilTime(Account account, String providerName, long delayUntil) {
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "setDelayUntil: " + account + ", provider " + providerName
+ + " -> delayUntil " + delayUntil);
+ }
+ synchronized (mAuthorities) {
+ AuthorityInfo authority = getOrCreateAuthorityLocked(account, providerName, -1, false);
+ if (authority.delayUntil == delayUntil) {
+ return;
+ }
+ authority.delayUntil = delayUntil;
+ writeAccountInfoLocked();
+ }
+
+ reportChange(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS);
+ }
+
+ public long getDelayUntilTime(Account account, String providerName) {
+ synchronized (mAuthorities) {
+ AuthorityInfo authority = getAuthorityLocked(account, providerName, "getDelayUntil");
+ if (authority == null) {
+ return 0;
+ }
+ return authority.delayUntil;
+ }
+ }
+
public void setMasterSyncAutomatically(boolean flag) {
boolean old;
synchronized (mAuthorities) {
@@ -437,7 +528,7 @@
writeAccountInfoLocked();
}
if (!old && flag) {
- mContext.getContentResolver().requestSync(null, null, new Bundle());
+ ContentResolver.requestSync(null, null, new Bundle());
}
reportChange(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS);
mContext.sendBroadcast(SYNC_CONNECTION_SETTING_CHANGED_INTENT);
@@ -512,9 +603,6 @@
SyncStatusInfo status = getOrCreateSyncStatusLocked(authority.ident);
status.pending = true;
- status.initialize = op.extras != null &&
- op.extras.containsKey(ContentResolver.SYNC_EXTRAS_INITIALIZE) &&
- op.extras.getBoolean(ContentResolver.SYNC_EXTRAS_INITIALIZE);
}
reportChange(ContentResolver.SYNC_OBSERVER_TYPE_PENDING);
@@ -1414,7 +1502,7 @@
}
}
- public static final int PENDING_OPERATION_VERSION = 1;
+ public static final int PENDING_OPERATION_VERSION = 2;
/**
* Read all pending operations back in to the initial engine state.
@@ -1429,7 +1517,7 @@
final int SIZE = in.dataSize();
while (in.dataPosition() < SIZE) {
int version = in.readInt();
- if (version != PENDING_OPERATION_VERSION) {
+ if (version != PENDING_OPERATION_VERSION && version != 1) {
Log.w(TAG, "Unknown pending operation version "
+ version + "; dropping all ops");
break;
@@ -1437,6 +1525,12 @@
int authorityId = in.readInt();
int syncSource = in.readInt();
byte[] flatExtras = in.createByteArray();
+ boolean expedited;
+ if (version == PENDING_OPERATION_VERSION) {
+ expedited = in.readInt() != 0;
+ } else {
+ expedited = false;
+ }
AuthorityInfo authority = mAuthorities.get(authorityId);
if (authority != null) {
Bundle extras = null;
@@ -1445,12 +1539,13 @@
}
PendingOperation op = new PendingOperation(
authority.account, syncSource,
- authority.authority, extras);
+ authority.authority, extras, expedited);
op.authorityId = authorityId;
op.flatExtras = flatExtras;
if (DEBUG_FILE) Log.v(TAG, "Adding pending op: account=" + op.account
+ " auth=" + op.authority
+ " src=" + op.syncSource
+ + " expedited=" + op.expedited
+ " extras=" + op.extras);
mPendingOperations.add(op);
}
@@ -1468,6 +1563,7 @@
op.flatExtras = flattenBundle(op.extras);
}
out.writeByteArray(op.flatExtras);
+ out.writeInt(op.expedited ? 1 : 0);
}
/**
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index a7ea507..808c839b 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -234,6 +234,14 @@
public static final int FLAG_ON_SDCARD = 1<<19;
/**
+ * Value for {@link #flags}: Set to true if the application is
+ * native-debuggable, i.e. embeds a gdbserver binary in its .apk
+ *
+ * {@hide}
+ */
+ public static final int FLAG_NATIVE_DEBUGGABLE = 1<<20;
+
+ /**
* Flags associated with the application. Any combination of
* {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},
* {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
diff --git a/core/java/android/content/pm/ComponentInfo.java b/core/java/android/content/pm/ComponentInfo.java
index 73c9244..338c62b6 100644
--- a/core/java/android/content/pm/ComponentInfo.java
+++ b/core/java/android/content/pm/ComponentInfo.java
@@ -1,3 +1,19 @@
+/*
+ * 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.content.pm;
import android.graphics.drawable.Drawable;
@@ -27,6 +43,13 @@
public String processName;
/**
+ * A string resource identifier (in the package's resources) containing
+ * a user-readable description of the component. From the "description"
+ * attribute or, if not set, 0.
+ */
+ public int descriptionRes;
+
+ /**
* Indicates whether or not this component may be instantiated. Note that this value can be
* overriden by the one in its parent {@link ApplicationInfo}.
*/
@@ -47,6 +70,7 @@
super(orig);
applicationInfo = orig.applicationInfo;
processName = orig.processName;
+ descriptionRes = orig.descriptionRes;
enabled = orig.enabled;
exported = orig.exported;
}
@@ -108,6 +132,9 @@
super.dumpFront(pw, prefix);
pw.println(prefix + "enabled=" + enabled + " exported=" + exported
+ " processName=" + processName);
+ if (descriptionRes != 0) {
+ pw.println(prefix + "description=" + descriptionRes);
+ }
}
protected void dumpBack(Printer pw, String prefix) {
@@ -124,6 +151,7 @@
super.writeToParcel(dest, parcelableFlags);
applicationInfo.writeToParcel(dest, parcelableFlags);
dest.writeString(processName);
+ dest.writeInt(descriptionRes);
dest.writeInt(enabled ? 1 : 0);
dest.writeInt(exported ? 1 : 0);
}
@@ -132,6 +160,7 @@
super(source);
applicationInfo = ApplicationInfo.CREATOR.createFromParcel(source);
processName = source.readString();
+ descriptionRes = source.readInt();
enabled = (source.readInt() != 0);
exported = (source.readInt() != 0);
}
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 8a5df32..bbde0a6 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -119,15 +119,18 @@
static class ParseComponentArgs extends ParsePackageItemArgs {
final String[] sepProcesses;
final int processRes;
+ final int descriptionRes;
final int enabledRes;
int flags;
ParseComponentArgs(Package _owner, String[] _outError,
int _nameRes, int _labelRes, int _iconRes,
- String[] _sepProcesses, int _processRes,int _enabledRes) {
+ String[] _sepProcesses, int _processRes,
+ int _descriptionRes, int _enabledRes) {
super(_owner, _outError, _nameRes, _labelRes, _iconRes);
sepProcesses = _sepProcesses;
processRes = _processRes;
+ descriptionRes = _descriptionRes;
enabledRes = _enabledRes;
}
}
@@ -1602,6 +1605,7 @@
com.android.internal.R.styleable.AndroidManifestActivity_icon,
mSeparateProcesses,
com.android.internal.R.styleable.AndroidManifestActivity_process,
+ com.android.internal.R.styleable.AndroidManifestActivity_description,
com.android.internal.R.styleable.AndroidManifestActivity_enabled);
}
@@ -1803,6 +1807,7 @@
com.android.internal.R.styleable.AndroidManifestActivityAlias_icon,
mSeparateProcesses,
0,
+ com.android.internal.R.styleable.AndroidManifestActivityAlias_description,
com.android.internal.R.styleable.AndroidManifestActivityAlias_enabled);
mParseActivityAliasArgs.tag = "<activity-alias>";
}
@@ -1837,6 +1842,9 @@
info.nonLocalizedLabel = target.info.nonLocalizedLabel;
info.launchMode = target.info.launchMode;
info.processName = target.info.processName;
+ if (info.descriptionRes == 0) {
+ info.descriptionRes = target.info.descriptionRes;
+ }
info.screenOrientation = target.info.screenOrientation;
info.taskAffinity = target.info.taskAffinity;
info.theme = target.info.theme;
@@ -1926,6 +1934,7 @@
com.android.internal.R.styleable.AndroidManifestProvider_icon,
mSeparateProcesses,
com.android.internal.R.styleable.AndroidManifestProvider_process,
+ com.android.internal.R.styleable.AndroidManifestProvider_description,
com.android.internal.R.styleable.AndroidManifestProvider_enabled);
mParseProviderArgs.tag = "<provider>";
}
@@ -2188,6 +2197,7 @@
com.android.internal.R.styleable.AndroidManifestService_icon,
mSeparateProcesses,
com.android.internal.R.styleable.AndroidManifestService_process,
+ com.android.internal.R.styleable.AndroidManifestService_description,
com.android.internal.R.styleable.AndroidManifestService_enabled);
mParseServiceArgs.tag = "<service>";
}
@@ -2640,6 +2650,11 @@
owner.applicationInfo.processName, args.sa.getNonResourceString(args.processRes),
args.flags, args.sepProcesses, args.outError);
}
+
+ if (args.descriptionRes != 0) {
+ outInfo.descriptionRes = args.sa.getResourceId(args.descriptionRes, 0);
+ }
+
outInfo.enabled = args.sa.getBoolean(args.enabledRes, true);
}
diff --git a/core/java/android/gesture/GestureStroke.java b/core/java/android/gesture/GestureStroke.java
index 68dc5a6..c3ddb28 100644
--- a/core/java/android/gesture/GestureStroke.java
+++ b/core/java/android/gesture/GestureStroke.java
@@ -31,7 +31,7 @@
* consists of a sequence of timed points. One or multiple strokes form a gesture.
*/
public class GestureStroke {
- static final float TOUCH_TOLERANCE = 8;
+ static final float TOUCH_TOLERANCE = 3;
public final RectF boundingBox;
diff --git a/core/java/android/gesture/GestureUtilities.java b/core/java/android/gesture/GestureUtilities.java
index dfe1d00..9d95ce4 100755
--- a/core/java/android/gesture/GestureUtilities.java
+++ b/core/java/android/gesture/GestureUtilities.java
@@ -26,7 +26,17 @@
import static android.gesture.GestureConstants.*;
-final class GestureUtilities {
+/**
+ * Utility functions for gesture processing & analysis, including methods for:
+ * <ul>
+ * <li>feature extraction (e.g., samplers and those for calculating bounding
+ * boxes and gesture path lengths);
+ * <li>geometric transformation (e.g., translation, rotation and scaling);
+ * <li>gesture similarity comparison (e.g., calculating Euclidean or Cosine
+ * distances between two gestures).
+ * </ul>
+ */
+public final class GestureUtilities {
private static final float SCALING_THRESHOLD = 0.26f;
private static final float NONUNIFORM_SCALE = (float) Math.sqrt(2);
@@ -49,14 +59,38 @@
}
}
- static float[] spatialSampling(Gesture gesture, int sampleMatrixDimension) {
- return spatialSampling(gesture, sampleMatrixDimension, false);
+ /**
+ * Samples the gesture spatially by rendering the gesture into a 2D
+ * grayscale bitmap. Scales the gesture to fit the size of the bitmap.
+ * The scaling does not necessarily keep the aspect ratio of the gesture.
+ *
+ * @param gesture the gesture to be sampled
+ * @param bitmapSize the size of the bitmap
+ * @return a bitmapSize x bitmapSize grayscale bitmap that is represented
+ * as a 1D array. The float at index i represents the grayscale
+ * value at pixel [i%bitmapSize, i/bitmapSize]
+ */
+ public static float[] spatialSampling(Gesture gesture, int bitmapSize) {
+ return spatialSampling(gesture, bitmapSize, false);
}
- static float[] spatialSampling(Gesture gesture, int sampleMatrixDimension,
- boolean uniformScaling) {
- final float targetPatchSize = sampleMatrixDimension - 1; // edge inclusive
- float[] sample = new float[sampleMatrixDimension * sampleMatrixDimension];
+ /**
+ * Samples the gesture spatially by rendering the gesture into a 2D
+ * grayscale bitmap. Scales the gesture to fit the size of the bitmap.
+ *
+ * @param gesture the gesture to be sampled
+ * @param bitmapSize the size of the bitmap
+ * @param keepAspectRatio if the scaling should keep the gesture's
+ * aspect ratio
+ *
+ * @return a bitmapSize x bitmapSize grayscale bitmap that is represented
+ * as a 1D array. The float at index i represents the grayscale
+ * value at pixel [i%bitmapSize, i/bitmapSize]
+ */
+ public static float[] spatialSampling(Gesture gesture, int bitmapSize,
+ boolean keepAspectRatio) {
+ final float targetPatchSize = bitmapSize - 1;
+ float[] sample = new float[bitmapSize * bitmapSize];
Arrays.fill(sample, 0);
RectF rect = gesture.getBoundingBox();
@@ -65,7 +99,7 @@
float sx = targetPatchSize / gestureWidth;
float sy = targetPatchSize / gestureHeight;
- if (uniformScaling) {
+ if (keepAspectRatio) {
float scale = sx < sy ? sx : sy;
sx = scale;
sy = scale;
@@ -122,16 +156,16 @@
if (segmentStartY > targetPatchSize) {
segmentStartY = targetPatchSize;
}
- plot(segmentStartX, segmentStartY, sample, sampleMatrixDimension);
+ plot(segmentStartX, segmentStartY, sample, bitmapSize);
if (segmentEndX != -1) {
- // evaluate horizontally
+ // Evaluate horizontally
if (segmentEndX > segmentStartX) {
xpos = (float) Math.ceil(segmentStartX);
float slope = (segmentEndY - segmentStartY) /
(segmentEndX - segmentStartX);
while (xpos < segmentEndX) {
ypos = slope * (xpos - segmentStartX) + segmentStartY;
- plot(xpos, ypos, sample, sampleMatrixDimension);
+ plot(xpos, ypos, sample, bitmapSize);
xpos++;
}
} else if (segmentEndX < segmentStartX){
@@ -140,18 +174,18 @@
(segmentEndX - segmentStartX);
while (xpos < segmentStartX) {
ypos = slope * (xpos - segmentStartX) + segmentStartY;
- plot(xpos, ypos, sample, sampleMatrixDimension);
+ plot(xpos, ypos, sample, bitmapSize);
xpos++;
}
}
- // evaluating vertically
+ // Evaluate vertically
if (segmentEndY > segmentStartY) {
ypos = (float) Math.ceil(segmentStartY);
float invertSlope = (segmentEndX - segmentStartX) /
(segmentEndY - segmentStartY);
while (ypos < segmentEndY) {
xpos = invertSlope * (ypos - segmentStartY) + segmentStartX;
- plot(xpos, ypos, sample, sampleMatrixDimension);
+ plot(xpos, ypos, sample, bitmapSize);
ypos++;
}
} else if (segmentEndY < segmentStartY) {
@@ -160,7 +194,7 @@
(segmentEndY - segmentStartY);
while (ypos < segmentStartY) {
xpos = invertSlope * (ypos - segmentStartY) + segmentStartX;
- plot(xpos, ypos, sample, sampleMatrixDimension);
+ plot(xpos, ypos, sample, bitmapSize);
ypos++;
}
}
@@ -224,15 +258,16 @@
}
/**
- * Featurizes a stroke into a vector of a given number of elements
+ * Samples a stroke temporally into a given number of evenly-distributed
+ * points.
*
- * @param stroke
- * @param sampleSize
- * @return a float array
+ * @param stroke the gesture stroke to be sampled
+ * @param numPoints the number of points
+ * @return the sampled points in the form of [x1, y1, x2, y2, ..., xn, yn]
*/
- static float[] temporalSampling(GestureStroke stroke, int sampleSize) {
- final float increment = stroke.length / (sampleSize - 1);
- int vectorLength = sampleSize * 2;
+ public static float[] temporalSampling(GestureStroke stroke, int numPoints) {
+ final float increment = stroke.length / (numPoints - 1);
+ int vectorLength = numPoints * 2;
float[] vector = new float[vectorLength];
float distanceSoFar = 0;
float[] pts = stroke.points;
@@ -287,9 +322,9 @@
}
/**
- * Calculate the centroid
+ * Calculates the centroid of a set of points.
*
- * @param points
+ * @param points the points in the form of [x1, y1, x2, y2, ..., xn, yn]
* @return the centroid
*/
static float[] computeCentroid(float[] points) {
@@ -309,10 +344,10 @@
}
/**
- * calculate the variance-covariance matrix, treat each point as a sample
+ * Calculates the variance-covariance matrix of a set of points.
*
- * @param points
- * @return the covariance matrix
+ * @param points the points in the form of [x1, y1, x2, y2, ..., xn, yn]
+ * @return the variance-covariance matrix
*/
private static float[][] computeCoVariance(float[] points) {
float[][] array = new float[2][2];
@@ -363,7 +398,7 @@
}
/**
- * Calculate the squared Euclidean distance between two vectors
+ * Calculates the squared Euclidean distance between two vectors.
*
* @param vector1
* @param vector2
@@ -380,7 +415,7 @@
}
/**
- * Calculate the cosine distance between two instances
+ * Calculates the cosine distance between two instances.
*
* @param vector1
* @param vector2
@@ -396,7 +431,7 @@
}
/**
- * Calculate the "minimum" cosine distance between two instances
+ * Calculates the "minimum" cosine distance between two instances.
*
* @param vector1
* @param vector2
@@ -426,8 +461,13 @@
}
}
-
- static OrientedBoundingBox computeOrientedBoundingBox(ArrayList<GesturePoint> originalPoints) {
+ /**
+ * Computes an oriented, minimum bounding box of a set of points.
+ *
+ * @param originalPoints
+ * @return an oriented bounding box
+ */
+ public static OrientedBoundingBox computeOrientedBoundingBox(ArrayList<GesturePoint> originalPoints) {
final int count = originalPoints.size();
float[] points = new float[count * 2];
for (int i = 0; i < count; i++) {
@@ -440,7 +480,13 @@
return computeOrientedBoundingBox(points, meanVector);
}
- static OrientedBoundingBox computeOrientedBoundingBox(float[] originalPoints) {
+ /**
+ * Computes an oriented, minimum bounding box of a set of points.
+ *
+ * @param originalPoints
+ * @return an oriented bounding box
+ */
+ public static OrientedBoundingBox computeOrientedBoundingBox(float[] originalPoints) {
int size = originalPoints.length;
float[] points = new float[size];
for (int i = 0; i < size; i++) {
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index d90536c..abb74cd 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -543,6 +543,21 @@
public native final void stopSmoothZoom();
/**
+ * Set the display orientation. This affects the preview frames and the
+ * picture displayed after snapshot. This method is useful for portrait
+ * mode applications.
+ *
+ * This does not affect the order of byte array passed in
+ * {@link PreviewCallback#onPreviewFrame}. This method is not allowed to
+ * be called during preview.
+ *
+ * @param degrees the angle that the picture will be rotated clockwise.
+ * Valid values are 0, 90, 180, and 270. The starting
+ * position is 0 (landscape).
+ */
+ public native final void setDisplayOrientation(int degrees);
+
+ /**
* Handles the zoom callback.
*
* @hide
diff --git a/core/java/android/os/IMountService.aidl b/core/java/android/os/IMountService.aidl
index c0c2d03..2124e85 100644
--- a/core/java/android/os/IMountService.aidl
+++ b/core/java/android/os/IMountService.aidl
@@ -99,6 +99,11 @@
void unmountSecureContainer(String id);
/*
+ * Rename an unmounted secure container.
+ */
+ void renameSecureContainer(String oldId, String newId);
+
+ /*
* Returns the filesystem path of a mounted secure container.
*/
String getSecureContainerPath(String id);
diff --git a/core/java/android/os/IRemoteCallback.aidl b/core/java/android/os/IRemoteCallback.aidl
new file mode 100644
index 0000000..f0c6c73
--- /dev/null
+++ b/core/java/android/os/IRemoteCallback.aidl
@@ -0,0 +1,25 @@
+/* //device/java/android/android/app/IActivityPendingResult.aidl
+**
+** 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.
+*/
+
+package android.os;
+
+import android.os.Bundle;
+
+/** @hide */
+oneway interface IRemoteCallback {
+ void sendResult(in Bundle data);
+}
diff --git a/core/java/android/os/MailboxNotAvailableException.java b/core/java/android/os/MailboxNotAvailableException.java
deleted file mode 100644
index 574adbd..0000000
--- a/core/java/android/os/MailboxNotAvailableException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-package android.os;
-
-/** @hide */
-public class MailboxNotAvailableException extends Throwable
-{
- /**
- * This exception represents the case when a request for a
- * named, published mailbox fails because the requested name has not been published
- */
-
- public
- MailboxNotAvailableException()
- {
- }
-
- public
- MailboxNotAvailableException(String s)
- {
- super(s);
- }
-}
diff --git a/core/java/android/os/Messenger.java b/core/java/android/os/Messenger.java
index 1bc554e..ad55abdd 100644
--- a/core/java/android/os/Messenger.java
+++ b/core/java/android/os/Messenger.java
@@ -29,7 +29,7 @@
* Create a new Messenger pointing to the given Handler. Any Message
* objects sent through this Messenger will appear in the Handler as if
* {@link Handler#sendMessage(Message) Handler.sendMessage(Message)} had
- * be called directly.
+ * been called directly.
*
* @param target The Handler that will receive sent messages.
*/
diff --git a/core/java/android/os/RemoteCallback.aidl b/core/java/android/os/RemoteCallback.aidl
new file mode 100644
index 0000000..7ae56f5
--- /dev/null
+++ b/core/java/android/os/RemoteCallback.aidl
@@ -0,0 +1,19 @@
+/*
+** 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.
+*/
+
+package android.os;
+
+parcelable RemoteCallback;
diff --git a/core/java/android/os/RemoteCallback.java b/core/java/android/os/RemoteCallback.java
new file mode 100644
index 0000000..ca95bdf
--- /dev/null
+++ b/core/java/android/os/RemoteCallback.java
@@ -0,0 +1,107 @@
+/*
+ * 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.os;
+
+/**
+ * TODO: Make this a public API? Let's see how it goes with a few use
+ * cases first.
+ * @hide
+ */
+public abstract class RemoteCallback implements Parcelable {
+ final Handler mHandler;
+ final IRemoteCallback mTarget;
+
+ class DeliverResult implements Runnable {
+ final Bundle mResult;
+
+ DeliverResult(Bundle result) {
+ mResult = result;
+ }
+
+ public void run() {
+ onResult(mResult);
+ }
+ }
+
+ class LocalCallback extends IRemoteCallback.Stub {
+ public void sendResult(Bundle bundle) {
+ mHandler.post(new DeliverResult(bundle));
+ }
+ }
+
+ static class RemoteCallbackProxy extends RemoteCallback {
+ RemoteCallbackProxy(IRemoteCallback target) {
+ super(target);
+ }
+
+ protected void onResult(Bundle bundle) {
+ }
+ }
+
+ public RemoteCallback(Handler handler) {
+ mHandler = handler;
+ mTarget = new LocalCallback();
+ }
+
+ RemoteCallback(IRemoteCallback target) {
+ mHandler = null;
+ mTarget = target;
+ }
+
+ public void sendResult(Bundle bundle) throws RemoteException {
+ mTarget.sendResult(bundle);
+ }
+
+ protected abstract void onResult(Bundle bundle);
+
+ public boolean equals(Object otherObj) {
+ if (otherObj == null) {
+ return false;
+ }
+ try {
+ return mTarget.asBinder().equals(((RemoteCallback)otherObj)
+ .mTarget.asBinder());
+ } catch (ClassCastException e) {
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return mTarget.asBinder().hashCode();
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeStrongBinder(mTarget.asBinder());
+ }
+
+ public static final Parcelable.Creator<RemoteCallback> CREATOR
+ = new Parcelable.Creator<RemoteCallback>() {
+ public RemoteCallback createFromParcel(Parcel in) {
+ IBinder target = in.readStrongBinder();
+ return target != null ? new RemoteCallbackProxy(
+ IRemoteCallback.Stub.asInterface(target)) : null;
+ }
+
+ public RemoteCallback[] newArray(int size) {
+ return new RemoteCallback[size];
+ }
+ };
+}
diff --git a/core/java/android/preference/PreferenceManager.java b/core/java/android/preference/PreferenceManager.java
index fe3471d..2b20946 100644
--- a/core/java/android/preference/PreferenceManager.java
+++ b/core/java/android/preference/PreferenceManager.java
@@ -134,10 +134,7 @@
private OnPreferenceTreeClickListener mOnPreferenceTreeClickListener;
- /**
- * @hide
- */
- public PreferenceManager(Activity activity, int firstRequestCode) {
+ PreferenceManager(Activity activity, int firstRequestCode) {
mActivity = activity;
mNextRequestCode = firstRequestCode;
diff --git a/core/java/android/provider/Browser.java b/core/java/android/provider/Browser.java
index d67169f..ef43afe 100644
--- a/core/java/android/provider/Browser.java
+++ b/core/java/android/provider/Browser.java
@@ -34,12 +34,6 @@
Uri.parse("content://browser/bookmarks");
/**
- * The inline scheme to show embedded content in a browser.
- * @hide
- */
- public static final Uri INLINE_URI = Uri.parse("inline:");
-
- /**
* The name of extra data when starting Browser with ACTION_VIEW or
* ACTION_SEARCH intent.
* <p>
@@ -62,24 +56,6 @@
"com.android.browser.application_id";
/**
- * The content to be rendered when url's scheme is inline.
- * @hide
- */
- public static final String EXTRA_INLINE_CONTENT ="com.android.browser.inline.content";
-
- /**
- * The encoding of the inlined content for inline scheme.
- * @hide
- */
- public static final String EXTRA_INLINE_ENCODING ="com.android.browser.inline.encoding";
-
- /**
- * The url used when the inline content is falied to render.
- * @hide
- */
- public static final String EXTRA_INLINE_FAILURL ="com.android.browser.inline.failurl";
-
- /**
* 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
@@ -102,6 +78,27 @@
*/
public static final String EXTRA_POST_DATA = "com.android.browser.post_data";
+ /**
+ * The name of the extra data in the VIEW intent. The data is in the format
+ * of String array. This should be paired with EXTRA_HEADERS_VALUE.
+ * <p>
+ * The keys will be combined with the values and sent in the HTTP request
+ * headers for the provided url. The keys can't be the standard HTTP headers
+ * as they are set by the WebView. The url's schema must be http(s).
+ * <p>
+ */
+ public static final String EXTRA_HEADERS_KEY = "com.android.browser.headers_key";
+
+ /**
+ * The name of the extra data in the VIEW intent. The data is in the format
+ * of String array. This should be paired with EXTRA_HEADERS_KEY.
+ * <p>
+ * The values will be combined with the keys and sent in the HTTP request
+ * headers for the provided url. The url's schema must be http(s).
+ * <p>
+ */
+ public static final String EXTRA_HEADERS_VALUE = "com.android.browser.headers_value";
+
/* if you change column order you must also change indices
below */
public static final String[] HISTORY_PROJECTION = new String[] {
diff --git a/core/java/android/provider/Calendar.java b/core/java/android/provider/Calendar.java
index 81a2191..f89ba91 100644
--- a/core/java/android/provider/Calendar.java
+++ b/core/java/android/provider/Calendar.java
@@ -62,7 +62,7 @@
public static final String EVENT_BEGIN_TIME = "beginTime";
public static final String EVENT_END_TIME = "endTime";
- public static final String AUTHORITY = "calendar";
+ public static final String AUTHORITY = "com.android.calendar";
/**
* The content:// style URL for the top-level calendar authority
@@ -744,9 +744,10 @@
try {
while (subCursor.moveToNext()) {
ContentValues extendedValues = new ContentValues();
- extendedValues.put(ExtendedProperties.NAME, cursor.getString(COLUMN_NAME));
+ extendedValues.put(ExtendedProperties.NAME,
+ subCursor.getString(COLUMN_NAME));
extendedValues.put(ExtendedProperties.VALUE,
- cursor.getString(COLUMN_VALUE));
+ subCursor.getString(COLUMN_VALUE));
entity.addSubValue(ExtendedProperties.CONTENT_URI, extendedValues);
}
} finally {
diff --git a/core/java/android/provider/Downloads.java b/core/java/android/provider/Downloads.java
index 6bf09b5..08ab166 100644
--- a/core/java/android/provider/Downloads.java
+++ b/core/java/android/provider/Downloads.java
@@ -517,6 +517,8 @@
/**
* This download couldn't be completed because of a storage issue.
* Typically, that's because the filesystem is missing or full.
+ * Use the more specific {@link #STATUS_INSUFFICIENT_SPACE_ERROR}
+ * and {@link #STATUS_DEVICE_NOT_FOUND_ERROR} when appropriate.
* @hide
*/
public static final int STATUS_FILE_ERROR = 492;
@@ -558,6 +560,21 @@
public static final int STATUS_TOO_MANY_REDIRECTS = 497;
/**
+ * This download couldn't be completed due to insufficient storage
+ * space. Typically, this is because the SD card is full.
+ * @hide
+ */
+ public static final int STATUS_INSUFFICIENT_SPACE_ERROR = 498;
+
+ /**
+ * This download couldn't be completed because no external storage
+ * device was found. Typically, this is because the SD card is not
+ * mounted.
+ * @hide
+ */
+ public static final int STATUS_DEVICE_NOT_FOUND_ERROR = 499;
+
+ /**
* This download is visible but only shows in the notifications
* while it's in progress.
* @hide
@@ -1019,6 +1036,8 @@
/**
* This download couldn't be completed because of a storage issue.
* Typically, that's because the filesystem is missing or full.
+ * Use the more specific {@link #STATUS_INSUFFICIENT_SPACE_ERROR}
+ * and {@link #STATUS_DEVICE_NOT_FOUND_ERROR} when appropriate.
*/
public static final int STATUS_FILE_ERROR = 492;
@@ -1054,6 +1073,19 @@
public static final int STATUS_TOO_MANY_REDIRECTS = 497;
/**
+ * This download couldn't be completed due to insufficient storage
+ * space. Typically, this is because the SD card is full.
+ */
+ public static final int STATUS_INSUFFICIENT_SPACE_ERROR = 498;
+
+ /**
+ * This download couldn't be completed because no external storage
+ * device was found. Typically, this is because the SD card is not
+ * mounted.
+ */
+ public static final int STATUS_DEVICE_NOT_FOUND_ERROR = 499;
+
+ /**
* This download is visible but only shows in the notifications
* while it's in progress.
*/
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index dc40113..23a9f49 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -450,6 +450,21 @@
public static final String ACTION_SEARCH_SETTINGS =
"android.search.action.SEARCH_SETTINGS";
+ /**
+ * Activity Action: Show general device information settings (serial
+ * number, software version, phone number, etc.).
+ * <p>
+ * In some cases, a matching Activity may not exist, so ensure you
+ * safeguard against this.
+ * <p>
+ * Input: Nothing.
+ * <p>
+ * Output: Nothing
+ */
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+ public static final String ACTION_DEVICE_INFO_SETTINGS =
+ "android.settings.DEVICE_INFO_SETTINGS";
+
// End of Intent actions for Settings
private static final String JID_RESOURCE_PREFIX = "android";
@@ -1115,19 +1130,16 @@
/**
* Control whether to enable automatic brightness mode.
- * @hide
*/
public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
/**
* SCREEN_BRIGHTNESS_MODE value for manual mode.
- * @hide
*/
public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
/**
* SCREEN_BRIGHTNESS_MODE value for manual mode.
- * @hide
*/
public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
@@ -2021,10 +2033,10 @@
public static final String ALLOW_MOCK_LOCATION = "mock_location";
/**
- * The Android ID (a unique 64-bit value) as a hex string.
- * Identical to that obtained by calling
- * GoogleLoginService.getAndroidId(); it is also placed here
- * so you can get it without binding to a service.
+ * A 64-bit number (as a hex string) that is randomly
+ * generated on the device's first boot and should remain
+ * constant for the lifetime of the device. (The value may
+ * change if a factory reset is performed on the device.)
*/
public static final String ANDROID_ID = "android_id";
@@ -2962,8 +2974,6 @@
* @param cr the content resolver to use
* @param provider the location provider to query
* @return true if the provider is enabled
- *
- * @hide
*/
public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
@@ -2981,8 +2991,6 @@
* @param cr the content resolver to use
* @param provider the location provider to enable or disable
* @param enabled true if the provider should be enabled
- *
- * @hide
*/
public static final void setLocationProviderEnabled(ContentResolver cr,
String provider, boolean enabled) {
diff --git a/core/java/android/server/search/SearchDialogWrapper.java b/core/java/android/server/search/SearchDialogWrapper.java
deleted file mode 100644
index 9ee64af..0000000
--- a/core/java/android/server/search/SearchDialogWrapper.java
+++ /dev/null
@@ -1,426 +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 android.server.search;
-
-import android.app.ISearchManagerCallback;
-import android.app.SearchDialog;
-import android.app.SearchManager;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Bundle;
-import android.os.DeadObjectException;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.os.Looper;
-import android.os.Message;
-import android.os.RemoteException;
-import android.os.SystemProperties;
-import android.text.TextUtils;
-import android.util.Log;
-
-/**
- * Runs an instance of {@link SearchDialog} on its own thread.
- */
-class SearchDialogWrapper
-implements DialogInterface.OnCancelListener, DialogInterface.OnDismissListener {
-
- private static final String TAG = "SearchManagerService";
- private static final boolean DBG = false;
-
- private static final String SEARCH_UI_THREAD_NAME = "SearchDialog";
- private static final int SEARCH_UI_THREAD_PRIORITY =
- android.os.Process.THREAD_PRIORITY_DEFAULT;
-
- // Takes no arguments
- private static final int MSG_INIT = 0;
- // Takes these arguments:
- // arg1: selectInitialQuery, 0 = false, 1 = true
- // arg2: globalSearch, 0 = false, 1 = true
- // obj: searchManagerCallback
- // data[KEY_INITIAL_QUERY]: initial query
- // data[KEY_LAUNCH_ACTIVITY]: launch activity
- // data[KEY_APP_SEARCH_DATA]: app search data
- // data[KEY_TRIGGER]: 0 = false, 1 = true
- private static final int MSG_START_SEARCH = 1;
- // Takes no arguments
- private static final int MSG_STOP_SEARCH = 2;
- // arg1 is activity id
- private static final int MSG_ACTIVITY_RESUMING = 3;
- // obj is the reason
- private static final int MSG_CLOSING_SYSTEM_DIALOGS = 4;
-
- private static final String KEY_INITIAL_QUERY = "q";
- private static final String KEY_LAUNCH_ACTIVITY = "a";
- private static final String KEY_APP_SEARCH_DATA = "d";
- private static final String KEY_IDENT = "i";
- private static final String KEY_TRIGGER = "t";
-
- // Context used for getting search UI resources
- private final Context mContext;
-
- // Handles messages on the search UI thread.
- private final SearchDialogHandler mSearchUiThread;
-
- // The search UI
- SearchDialog mSearchDialog;
-
- // If the search UI is visible, this is the callback for the client that showed it.
- ISearchManagerCallback mCallback = null;
-
- // Identity of last activity that started search.
- private int mStartedIdent = 0;
-
- // Identity of currently resumed activity.
- private int mResumedIdent = 0;
-
- // True if we have registered our receivers.
- private boolean mReceiverRegistered;
-
- private volatile boolean mVisible = false;
-
- /**
- * Creates a new search dialog wrapper and a search UI thread. The search dialog itself will
- * be created some asynchronously on the search UI thread.
- *
- * @param context Context used for getting search UI resources.
- */
- public SearchDialogWrapper(Context context) {
- mContext = context;
-
- // Create the search UI thread
- HandlerThread t = new HandlerThread(SEARCH_UI_THREAD_NAME, SEARCH_UI_THREAD_PRIORITY);
- t.start();
- mSearchUiThread = new SearchDialogHandler(t.getLooper());
-
- // Create search UI on the search UI thread
- mSearchUiThread.sendEmptyMessage(MSG_INIT);
- }
-
- public boolean isVisible() {
- return mVisible;
- }
-
- /**
- * Initializes the search UI.
- * Must be called from the search UI thread.
- */
- private void init() {
- mSearchDialog = new SearchDialog(mContext);
- mSearchDialog.setOnCancelListener(this);
- mSearchDialog.setOnDismissListener(this);
- }
-
- private void registerBroadcastReceiver() {
- if (!mReceiverRegistered) {
- IntentFilter filter = new IntentFilter(
- Intent.ACTION_CONFIGURATION_CHANGED);
- mContext.registerReceiver(mBroadcastReceiver, filter, null,
- mSearchUiThread);
- mReceiverRegistered = true;
- }
- }
-
- private void unregisterBroadcastReceiver() {
- if (mReceiverRegistered) {
- mContext.unregisterReceiver(mBroadcastReceiver);
- mReceiverRegistered = false;
- }
- }
-
- /**
- * Closes the search dialog when requested by the system (e.g. when a phone call comes in).
- */
- private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
- if (DBG) debug(Intent.ACTION_CONFIGURATION_CHANGED);
- performOnConfigurationChanged();
- }
- }
- };
-
- //
- // External API
- //
-
- /**
- * Launches the search UI.
- * Can be called from any thread.
- *
- * @see SearchManager#startSearch(String, boolean, ComponentName, Bundle, boolean)
- */
- public void startSearch(final String initialQuery,
- final boolean selectInitialQuery,
- final ComponentName launchActivity,
- final Bundle appSearchData,
- final boolean globalSearch,
- final ISearchManagerCallback searchManagerCallback,
- int ident,
- boolean trigger) {
- if (DBG) debug("startSearch()");
- Message msg = Message.obtain();
- msg.what = MSG_START_SEARCH;
- msg.arg1 = selectInitialQuery ? 1 : 0;
- msg.arg2 = globalSearch ? 1 : 0;
- msg.obj = searchManagerCallback;
- Bundle msgData = msg.getData();
- msgData.putString(KEY_INITIAL_QUERY, initialQuery);
- msgData.putParcelable(KEY_LAUNCH_ACTIVITY, launchActivity);
- msgData.putBundle(KEY_APP_SEARCH_DATA, appSearchData);
- msgData.putInt(KEY_IDENT, ident);
- msgData.putInt(KEY_TRIGGER, trigger ? 1 : 0);
- mSearchUiThread.sendMessage(msg);
- // be a little more eager in setting this so isVisible will return the correct value if
- // called immediately after startSearch
- mVisible = true;
- }
-
- /**
- * Cancels the search dialog.
- * Can be called from any thread.
- */
- public void stopSearch() {
- if (DBG) debug("stopSearch()");
- mSearchUiThread.sendEmptyMessage(MSG_STOP_SEARCH);
- // be a little more eager in setting this so isVisible will return the correct value if
- // called immediately after stopSearch
- mVisible = false;
- }
-
- /**
- * Updates the currently resumed activity.
- * Can be called from any thread.
- */
- public void activityResuming(int ident) {
- if (DBG) debug("activityResuming(ident=" + ident + ")");
- Message msg = Message.obtain();
- msg.what = MSG_ACTIVITY_RESUMING;
- msg.arg1 = ident;
- mSearchUiThread.sendMessage(msg);
- }
-
- /**
- * Handles closing of system windows/dialogs
- * Can be called from any thread.
- */
- public void closingSystemDialogs(String reason) {
- if (DBG) debug("closingSystemDialogs(reason=" + reason + ")");
- Message msg = Message.obtain();
- msg.what = MSG_CLOSING_SYSTEM_DIALOGS;
- msg.obj = reason;
- mSearchUiThread.sendMessage(msg);
- }
-
- //
- // Implementation methods that run on the search UI thread
- //
-
- private class SearchDialogHandler extends Handler {
-
- public SearchDialogHandler(Looper looper) {
- super(looper);
- }
-
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case MSG_INIT:
- init();
- break;
- case MSG_START_SEARCH:
- handleStartSearchMessage(msg);
- break;
- case MSG_STOP_SEARCH:
- performStopSearch();
- break;
- case MSG_ACTIVITY_RESUMING:
- performActivityResuming(msg.arg1);
- break;
- case MSG_CLOSING_SYSTEM_DIALOGS:
- performClosingSystemDialogs((String)msg.obj);
- break;
- }
- }
-
- private void handleStartSearchMessage(Message msg) {
- Bundle msgData = msg.getData();
- String initialQuery = msgData.getString(KEY_INITIAL_QUERY);
- boolean selectInitialQuery = msg.arg1 != 0;
- ComponentName launchActivity =
- (ComponentName) msgData.getParcelable(KEY_LAUNCH_ACTIVITY);
- Bundle appSearchData = msgData.getBundle(KEY_APP_SEARCH_DATA);
- boolean globalSearch = msg.arg2 != 0;
- ISearchManagerCallback searchManagerCallback = (ISearchManagerCallback) msg.obj;
- int ident = msgData.getInt(KEY_IDENT);
- boolean trigger = msgData.getInt(KEY_TRIGGER) != 0;
- performStartSearch(initialQuery, selectInitialQuery, launchActivity,
- appSearchData, globalSearch, searchManagerCallback, ident, trigger);
- }
-
- }
-
- /**
- * Actually launches the search UI.
- * This must be called on the search UI thread.
- */
- void performStartSearch(String initialQuery,
- boolean selectInitialQuery,
- ComponentName launchActivity,
- Bundle appSearchData,
- boolean globalSearch,
- ISearchManagerCallback searchManagerCallback,
- int ident,
- boolean trigger) {
- if (DBG) debug("performStartSearch()");
-
- registerBroadcastReceiver();
- mCallback = searchManagerCallback;
-
- // clean up any hidden dialog that we were waiting to resume
- if (mStartedIdent != 0) {
- mSearchDialog.dismiss();
- }
-
- mStartedIdent = ident;
- if (DBG) Log.v(TAG, "******************* DIALOG: start");
-
- mSearchDialog.show(initialQuery, selectInitialQuery, launchActivity, appSearchData,
- globalSearch);
- mVisible = true;
- if (trigger) {
- mSearchDialog.launchQuerySearch();
- }
- }
-
- /**
- * Actually cancels the search UI.
- * This must be called on the search UI thread.
- */
- void performStopSearch() {
- if (DBG) debug("performStopSearch()");
- if (DBG) Log.v(TAG, "******************* DIALOG: cancel");
- mSearchDialog.cancel();
- mVisible = false;
- mStartedIdent = 0;
- }
-
- /**
- * Updates the resumed activity
- * This must be called on the search UI thread.
- */
- void performActivityResuming(int ident) {
- if (DBG) debug("performResumingActivity(): mStartedIdent="
- + mStartedIdent + ", resuming: " + ident);
- this.mResumedIdent = ident;
- if (mStartedIdent != 0) {
- if (mStartedIdent == mResumedIdent) {
- // we are resuming into the activity where we previously hid the dialog, bring it
- // back
- if (DBG) Log.v(TAG, "******************* DIALOG: show");
- mSearchDialog.show();
- mVisible = true;
- } else {
- // resuming into some other activity; hide ourselves in case we ever come back
- // so we can show ourselves quickly again
- if (DBG) Log.v(TAG, "******************* DIALOG: hide");
- mSearchDialog.hide();
- mVisible = false;
- }
- }
- }
-
- /**
- * Updates due to system dialogs being closed
- * This must be called on the search UI thread.
- */
- void performClosingSystemDialogs(String reason) {
- if (DBG) debug("performClosingSystemDialogs(): mStartedIdent="
- + mStartedIdent + ", reason: " + reason);
- if (!"search".equals(reason)) {
- if (DBG) debug(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
- performStopSearch();
- }
- }
-
- /**
- * Must be called from the search UI thread.
- */
- void performOnConfigurationChanged() {
- if (DBG) debug("performOnConfigurationChanged()");
- mSearchDialog.onConfigurationChanged();
- }
-
- /**
- * Called by {@link SearchDialog} when it goes away.
- */
- public void onDismiss(DialogInterface dialog) {
- if (DBG) debug("onDismiss()");
- mStartedIdent = 0;
- mVisible = false;
- callOnDismiss();
-
- // we don't need the callback anymore, release it
- mCallback = null;
- unregisterBroadcastReceiver();
- }
-
-
- /**
- * Called by {@link SearchDialog} when the user or activity cancels search.
- * Whenever this method is called, {@link #onDismiss} is always called afterwards.
- */
- public void onCancel(DialogInterface dialog) {
- if (DBG) debug("onCancel()");
- callOnCancel();
- }
-
- private void callOnDismiss() {
- if (mCallback == null) return;
- try {
- // should be safe to do on the search UI thread, since it's a oneway interface
- mCallback.onDismiss();
- } catch (DeadObjectException ex) {
- // The process that hosted the callback has died, do nothing
- } catch (RemoteException ex) {
- Log.e(TAG, "onDismiss() failed: " + ex);
- }
- }
-
- private void callOnCancel() {
- if (mCallback != null) {
- try {
- // should be safe to do on the search UI thread, since it's a oneway interface
- mCallback.onCancel();
- } catch (DeadObjectException ex) {
- // The process that hosted the callback has died, do nothing
- } catch (RemoteException ex) {
- Log.e(TAG, "onCancel() failed: " + ex);
- }
- }
- }
-
- private static void debug(String msg) {
- Thread thread = Thread.currentThread();
- Log.d(TAG, msg + " (" + thread.getName() + "-" + thread.getId() + ")");
- }
-}
diff --git a/core/java/android/server/search/SearchManagerService.java b/core/java/android/server/search/SearchManagerService.java
index f9a0b93..9953b56 100644
--- a/core/java/android/server/search/SearchManagerService.java
+++ b/core/java/android/server/search/SearchManagerService.java
@@ -51,10 +51,6 @@
// Only accessed by ensureSearchablesCreated() and getSearchables()
private Searchables mSearchables;
- // This field is initialized in ensureSearchDialogCreated(), and then never modified.
- // Only accessed by ensureSearchDialogCreated() and getSearchDialog()
- private SearchDialogWrapper mSearchDialog;
-
/**
* Initializes the Search Manager service in the provided system context.
* Only one instance of this object should be created!
@@ -63,23 +59,6 @@
*/
public SearchManagerService(Context context) {
mContext = context;
- // call initialize() after all pending actions on the main system thread have finished
- new Handler().post(new Runnable() {
- public void run() {
- initialize();
- }
- });
- }
-
- /**
- * Initializes the list of searchable activities and the search UI.
- */
- void initialize() {
- try {
- ActivityManagerNative.getDefault().registerActivityWatcher(
- mActivityWatcher);
- } catch (RemoteException e) {
- }
}
private synchronized void ensureSearchablesCreated() {
@@ -96,22 +75,11 @@
mContext.registerReceiver(mPackageChangedReceiver, packageFilter);
}
- private synchronized void ensureSearchDialogCreated() {
- if (mSearchDialog != null) return;
-
- mSearchDialog = new SearchDialogWrapper(mContext);
- }
-
private synchronized Searchables getSearchables() {
ensureSearchablesCreated();
return mSearchables;
}
- private synchronized SearchDialogWrapper getSearchDialog() {
- ensureSearchDialogCreated();
- return mSearchDialog;
- }
-
/**
* Refreshes the "searchables" list when packages are added/removed.
*/
@@ -124,8 +92,6 @@
Intent.ACTION_PACKAGE_REMOVED.equals(action) ||
Intent.ACTION_PACKAGE_CHANGED.equals(action)) {
if (DBG) Log.d(TAG, "Got " + action);
- // Dismiss search dialog, since the search context may no longer be valid
- getSearchDialog().stopSearch();
// Update list of searchable activities
getSearchables().buildSearchableList();
broadcastSearchablesChanged();
@@ -133,19 +99,6 @@
}
};
- private IActivityWatcher.Stub mActivityWatcher = new IActivityWatcher.Stub() {
- public void activityResuming(int activityId) throws RemoteException {
- if (DBG) Log.i("foo", "********************** resuming: " + activityId);
- if (mSearchDialog == null) return;
- mSearchDialog.activityResuming(activityId);
- }
- public void closingSystemDialogs(String reason) {
- if (DBG) Log.i("foo", "********************** closing dialogs: " + reason);
- if (mSearchDialog == null) return;
- mSearchDialog.closingSystemDialogs(reason);
- }
- };
-
/**
* Informs all listeners that the list of searchables has been updated.
*/
@@ -214,62 +167,4 @@
getSearchables().setDefaultWebSearch(component);
broadcastSearchablesChanged();
}
-
- // Search UI API
-
- /**
- * Launches the search UI. Can be called from any thread.
- *
- * @see SearchManager#startSearch(String, boolean, ComponentName, Bundle, boolean)
- */
- public void startSearch(String initialQuery,
- boolean selectInitialQuery,
- ComponentName launchActivity,
- Bundle appSearchData,
- boolean globalSearch,
- ISearchManagerCallback searchManagerCallback,
- int ident) {
- getSearchDialog().startSearch(initialQuery,
- selectInitialQuery,
- launchActivity,
- appSearchData,
- globalSearch,
- searchManagerCallback,
- ident,
- false); // don't trigger
- }
-
- /**
- * Launches the search UI and triggers the search, as if the user had clicked on the
- * search button within the dialog.
- *
- * @see SearchManager#triggerSearch(String, android.content.ComponentName, android.os.Bundle)
- */
- public void triggerSearch(String query,
- ComponentName launchActivity,
- Bundle appSearchData,
- ISearchManagerCallback searchManagerCallback,
- int ident) {
- getSearchDialog().startSearch(
- query,
- false,
- launchActivity,
- appSearchData,
- false,
- searchManagerCallback,
- ident,
- true); // triger search after launching
- }
-
- /**
- * Cancels the search dialog. Can be called from any thread.
- */
- public void stopSearch() {
- getSearchDialog().stopSearch();
- }
-
- public boolean isVisible() {
- return mSearchDialog != null && mSearchDialog.isVisible();
- }
-
}
diff --git a/core/java/android/speech/IRecognitionListener.aidl b/core/java/android/speech/IRecognitionListener.aidl
index 2da2258..5b48bd2 100644
--- a/core/java/android/speech/IRecognitionListener.aidl
+++ b/core/java/android/speech/IRecognitionListener.aidl
@@ -17,7 +17,6 @@
package android.speech;
import android.os.Bundle;
-import android.speech.RecognitionResult;
/**
* Listener for speech recognition events, used with RecognitionService.
@@ -26,35 +25,55 @@
* {@hide}
*/
interface IRecognitionListener {
- /** Called when the endpointer is ready for the user to start speaking. */
- void onReadyForSpeech(in Bundle noiseParams);
+ /**
+ * Called when the endpointer is ready for the user to start speaking.
+ *
+ * @param params parameters set by the recognition service. Reserved for future use.
+ */
+ void onReadyForSpeech(in Bundle params);
- /** The user has started to speak. */
+ /**
+ * The user has started to speak.
+ */
void onBeginningOfSpeech();
- /** The sound level in the audio stream has changed. */
+ /**
+ * The sound level in the audio stream has changed.
+ *
+ * @param rmsdB the new RMS dB value
+ */
void onRmsChanged(in float rmsdB);
/**
- * More sound has been received. Buffer is a byte buffer containing
- * a sequence of 16-bit shorts.
+ * More sound has been received.
+ *
+ * @param buffer the byte buffer containing a sequence of 16-bit shorts.
*/
void onBufferReceived(in byte[] buffer);
- /** Called after the user stops speaking. */
+ /**
+ * Called after the user stops speaking.
+ */
void onEndOfSpeech();
/**
- * A network or recognition error occurred. The code is defined in
- * {@link android.speech.RecognitionResult}
+ * A network or recognition error occurred.
+ *
+ * @param error code is defined in {@link RecognitionManager}
*/
void onError(in int error);
- /**
+ /**
* Called when recognition results are ready.
- * @param results: an ordered list of the most likely results (N-best list).
- * @param key: a key associated with the results. The same results can
- * be retrieved asynchronously later using the key, if available.
+ *
+ * @param results a Bundle containing the most likely results (N-best list).
*/
- void onResults(in List<RecognitionResult> results, long key);
+ void onResults(in Bundle results);
+
+ /**
+ * Called when recognition partial results are ready.
+ *
+ * @param results a Bundle containing the current most likely result.
+ */
+ void onPartialResults(in Bundle results);
}
diff --git a/core/java/android/speech/IRecognitionService.aidl b/core/java/android/speech/IRecognitionService.aidl
index a18c380..ca9af15 100644
--- a/core/java/android/speech/IRecognitionService.aidl
+++ b/core/java/android/speech/IRecognitionService.aidl
@@ -16,22 +16,41 @@
package android.speech;
+import android.os.Bundle;
import android.content.Intent;
import android.speech.IRecognitionListener;
-import android.speech.RecognitionResult;
-// A Service interface to speech recognition. Call startListening when
-// you want to begin capturing audio; RecognitionService will automatically
-// determine when the user has finished speaking, stream the audio to the
-// recognition servers, and notify you when results are ready.
-/** {@hide} */
+/**
+* A Service interface to speech recognition. Call startListening when
+* you want to begin capturing audio; RecognitionService will automatically
+* determine when the user has finished speaking, stream the audio to the
+* recognition servers, and notify you when results are ready. In most of the cases,
+* this class should not be used directly, instead use {@link RecognitionManager} for
+* accessing recognition service.
+* {@hide}
+*/
interface IRecognitionService {
- // Start listening for speech. Can only call this from one thread at once.
- // see RecognizerIntent.java for constants used to specify the intent.
- void startListening(in Intent recognizerIntent,
- in IRecognitionListener listener);
-
- List<RecognitionResult> getRecognitionResults(in long key);
+ /**
+ * Starts listening for speech. Please note that the recognition service supports
+ * one listener only, therefore, if this function is called from two different threads,
+ * only the latest one will get the notifications
+ *
+ * @param recognizerIntent the intent from which the invocation occurred. Additionally,
+ * this intent can contain extra parameters to manipulate the behavior of the recognition
+ * client. For more information see {@link RecognizerIntent}.
+ * @param listener to receive callbacks
+ */
+ void startListening(in Intent recognizerIntent, in IRecognitionListener listener);
+ /**
+ * Stops listening for speech. Speech captured so far will be recognized as
+ * if the user had stopped speaking at this point. The function has no effect unless it
+ * is called during the speech capturing.
+ */
+ void stopListening();
+
+ /**
+ * Cancels the speech recognition.
+ */
void cancel();
}
diff --git a/core/java/android/speech/RecognitionListener.java b/core/java/android/speech/RecognitionListener.java
new file mode 100644
index 0000000..eab3f40
--- /dev/null
+++ b/core/java/android/speech/RecognitionListener.java
@@ -0,0 +1,96 @@
+/*
+ * 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 android.content.Intent;
+import android.os.Bundle;
+
+/**
+ * Used for receiving notifications from the RecognitionManager when the
+ * recognition related events occur. All the callbacks are executed on the
+ * Application main thread.
+ */
+public interface RecognitionListener {
+
+ /**
+ * Called when RecognitionManager is successfully initialized
+ */
+ void onInit();
+
+ /**
+ * Called when the endpointer is ready for the user to start speaking.
+ *
+ * @param params parameters set by the recognition service. Reserved for future use.
+ */
+ void onReadyForSpeech(Bundle params);
+
+ /**
+ * The user has started to speak.
+ */
+ void onBeginningOfSpeech();
+
+ /**
+ * The sound level in the audio stream has changed. There is no guarantee that this method will
+ * be called.
+ *
+ * @param rmsdB the new RMS dB value
+ */
+ void onRmsChanged(float rmsdB);
+
+ /**
+ * More sound has been received. The purpose of this function is to allow giving feedback to the
+ * user regarding the captured audio. There is no guarantee that this method will be called.
+ *
+ * @param buffer a buffer containing a sequence of big-endian 16-bit integers representing a
+ * single channel audio stream. The sample rate is implementation dependent.
+ */
+ void onBufferReceived(byte[] buffer);
+
+ /**
+ * Called after the user stops speaking.
+ */
+ void onEndOfSpeech();
+
+ /**
+ * A network or recognition error occurred.
+ *
+ * @param error code is defined in {@link RecognitionManager}
+ */
+ void onError(int error);
+
+ /**
+ * Called when recognition results are ready.
+ *
+ * @param results the recognition results. To retrieve the results in {@code
+ * ArrayList<String>} format use {@link Bundle#getStringArrayList(String)} with
+ * {@link RecognitionManager#RECOGNITION_RESULTS_STRING_ARRAY} as a parameter
+ */
+ void onResults(Bundle results);
+
+ /**
+ * Called when partial recognition results are available. The callback might be called at any
+ * time between {@link #onBeginningOfSpeech()} and {@link #onResults(Bundle)} when partial
+ * results are ready. This method may be called zero, one or multiple times for each call to
+ * {@link RecognitionManager#startListening(Intent)}, depending on the speech recognition
+ * service implementation.
+ *
+ * @param partialResults the returned results. To retrieve the results in
+ * ArrayList<String> format use {@link Bundle#getStringArrayList(String)} with
+ * {@link RecognitionManager#RECOGNITION_RESULTS_STRING_ARRAY} as a parameter
+ */
+ void onPartialResults(Bundle partialResults);
+
+}
diff --git a/core/java/android/speech/RecognitionManager.java b/core/java/android/speech/RecognitionManager.java
new file mode 100644
index 0000000..79ae480
--- /dev/null
+++ b/core/java/android/speech/RecognitionManager.java
@@ -0,0 +1,321 @@
+/*
+ * 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 android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.content.pm.ResolveInfo;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.util.Log;
+
+import java.util.List;
+
+/**
+ * This class provides access to the speech recognition service. This service allows access to the
+ * speech recognizer. Do not instantiate this class directly, instead, call
+ * {@link RecognitionManager#createRecognitionManager(Context, RecognitionListener, Intent)}. This
+ * class is not thread safe and must be synchronized externally if accessed from multiple threads.
+ */
+public class RecognitionManager {
+ /** DEBUG value to enable verbose debug prints */
+ private final static boolean DBG = false;
+
+ /** Log messages identifier */
+ private static final String TAG = "RecognitionManager";
+
+ /**
+ * Used to retrieve an {@code ArrayList<String>} from the {@link Bundle} passed to the
+ * {@link RecognitionListener#onResults(Bundle)} and
+ * {@link RecognitionListener#onPartialResults(Bundle)} methods. These strings are the possible
+ * recognition results, where the first element is the most likely candidate.
+ */
+ public static final String RECOGNITION_RESULTS_STRING_ARRAY =
+ "recognition_results_string_array";
+
+ /** The actual RecognitionService endpoint */
+ private IRecognitionService mService;
+
+ /** The connection to the actual service */
+ private Connection mConnection;
+
+ /** Context with which the manager was created */
+ private final Context mContext;
+
+ /** Listener that will receive all the callbacks */
+ private final RecognitionListener mListener;
+
+ /** Helper class wrapping the IRecognitionListener */
+ private final InternalRecognitionListener mInternalRecognitionListener;
+
+ /** Network operation timed out. */
+ public static final int NETWORK_TIMEOUT_ERROR = 1;
+
+ /** Other network related errors. */
+ public static final int NETWORK_ERROR = 2;
+
+ /** Audio recording error. */
+ public static final int AUDIO_ERROR = 3;
+
+ /** Server sends error status. */
+ public static final int SERVER_ERROR = 4;
+
+ /** Other client side errors. */
+ public static final int CLIENT_ERROR = 5;
+
+ /** No speech input */
+ public static final int SPEECH_TIMEOUT_ERROR = 6;
+
+ /** No recognition result matched. */
+ public static final int NO_MATCH_ERROR = 7;
+
+ /** RecognitionService busy. */
+ public static final int SERVER_BUSY_ERROR = 8;
+
+ /**
+ * RecognitionManager was not initialized yet, most probably because
+ * {@link RecognitionListener#onInit()} was not called yet.
+ */
+ public static final int MANAGER_NOT_INITIALIZED_ERROR = 9;
+
+ /**
+ * The right way to create a RecognitionManager is by using
+ * {@link #createRecognitionManager} static factory method
+ */
+ private RecognitionManager(final RecognitionListener listener, final Context context) {
+ mInternalRecognitionListener = new InternalRecognitionListener();
+ mContext = context;
+ mListener = listener;
+ }
+
+ /**
+ * Basic ServiceConnection which just records mService variable.
+ */
+ private class Connection implements ServiceConnection {
+
+ public synchronized void onServiceConnected(final ComponentName name,
+ final IBinder service) {
+ mService = IRecognitionService.Stub.asInterface(service);
+ if (mListener != null) {
+ mListener.onInit();
+ }
+ if (DBG) Log.d(TAG, "onServiceConnected - Success");
+ }
+
+ public void onServiceDisconnected(final ComponentName name) {
+ mService = null;
+ mConnection = null;
+ if (DBG) Log.d(TAG, "onServiceDisconnected - Success");
+ }
+ }
+
+ /**
+ * Checks whether a speech recognition service is available on the system. If this method
+ * returns {@code false},
+ * {@link RecognitionManager#createRecognitionManager(Context, RecognitionListener, Intent)}
+ * will fail.
+ *
+ * @param context with which RecognitionManager will be created
+ * @return {@code true} if recognition is available, {@code false} otherwise
+ */
+ public static boolean isRecognitionAvailable(final Context context) {
+ final List<ResolveInfo> list = context.getPackageManager().queryIntentServices(
+ new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
+ return list != null && list.size() != 0;
+ }
+
+ /**
+ * Factory method to create a new RecognitionManager
+ *
+ * @param context in which to create RecognitionManager
+ * @param listener that will receive all the callbacks from the created
+ * {@link RecognitionManager}
+ * @param recognizerIntent contains initialization parameters for the speech recognizer. The
+ * intent action should be {@link RecognizerIntent#ACTION_RECOGNIZE_SPEECH}. Future
+ * versions of this API may add startup parameters for speech recognizer.
+ * @return null if a recognition service implementation is not installed or if speech
+ * recognition is not supported by the device, otherwise a new RecognitionManager is
+ * returned. The created RecognitionManager can only be used after the
+ * {@link RecognitionListener#onInit()} method has been called.
+ */
+ public static RecognitionManager createRecognitionManager(final Context context,
+ final RecognitionListener listener, final Intent recognizerIntent) {
+ if (context == null || recognizerIntent == null) {
+ throw new IllegalArgumentException(
+ "Context and recognizerListener argument cannot be null)");
+ }
+ RecognitionManager manager = new RecognitionManager(listener, context);
+ manager.mConnection = manager.new Connection();
+ if (!context.bindService(recognizerIntent, manager.mConnection, Context.BIND_AUTO_CREATE)) {
+ Log.e(TAG, "bind to recognition service failed");
+ listener.onError(CLIENT_ERROR);
+ return null;
+ }
+ return manager;
+ }
+
+ /**
+ * Checks whether the service is connected
+ *
+ * @param functionName from which the call originated
+ * @return {@code true} if the service was successfully initialized, {@code false} otherwise
+ */
+ private boolean connectToService(final String functionName) {
+ if (mService != null) {
+ return true;
+ }
+ if (mConnection == null) {
+ if (DBG) Log.d(TAG, "restarting connection to the recognition service");
+ mConnection = new Connection();
+ mContext.bindService(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), mConnection,
+ Context.BIND_AUTO_CREATE);
+ }
+ mInternalRecognitionListener.onError(MANAGER_NOT_INITIALIZED_ERROR);
+ Log.e(TAG, functionName + " was called before service connection was initialized");
+ return false;
+ }
+
+ /**
+ * Starts listening for speech.
+ *
+ * @param recognizerIntent contains parameters for the recognition to be performed. The intent
+ * action should be {@link RecognizerIntent#ACTION_RECOGNIZE_SPEECH}. The intent may also
+ * contain optional extras, see {@link RecognizerIntent}. If these values are not set
+ * explicitly, default values will be used by the recognizer.
+ */
+ public void startListening(Intent recognizerIntent) {
+ if (recognizerIntent == null) {
+ throw new IllegalArgumentException("recognizerIntent argument cannot be null");
+ }
+ if (!connectToService("startListening")) {
+ return; // service is not connected yet, reconnect in progress
+ }
+ try {
+ mService.startListening(recognizerIntent, mInternalRecognitionListener);
+ if (DBG) Log.d(TAG, "service start listening command succeded");
+ } catch (final RemoteException e) {
+ Log.e(TAG, "startListening() failed", e);
+ mInternalRecognitionListener.onError(CLIENT_ERROR);
+ }
+ }
+
+ /**
+ * Stops listening for speech. Speech captured so far will be recognized as if the user had
+ * stopped speaking at this point. Note that in the default case, this does not need to be
+ * called, as the speech endpointer will automatically stop the recognizer listening when it
+ * determines speech has completed. However, you can manipulate endpointer parameters directly
+ * using the intent extras defined in {@link RecognizerIntent}, in which case you may sometimes
+ * want to manually call this method to stop listening sooner.
+ */
+ public void stopListening() {
+ if (mService == null) {
+ return; // service is not connected, but no need to reconnect at this point
+ }
+ try {
+ mService.stopListening();
+ if (DBG) Log.d(TAG, "service stop listening command succeded");
+ } catch (final RemoteException e) {
+ Log.e(TAG, "stopListening() failed", e);
+ mInternalRecognitionListener.onError(CLIENT_ERROR);
+ }
+ }
+
+ /**
+ * Cancels the speech recognition.
+ */
+ public void cancel() {
+ if (mService == null) {
+ return; // service is not connected, but no need to reconnect at this point
+ }
+ try {
+ mService.cancel();
+ if (DBG) Log.d(TAG, "service cancel command succeded");
+ } catch (final RemoteException e) {
+ Log.e(TAG, "cancel() failed", e);
+ mInternalRecognitionListener.onError(CLIENT_ERROR);
+ }
+ }
+
+ /**
+ * Destroys the RecognitionManager object. Note that after calling this method all method calls
+ * on this object will fail, triggering {@link RecognitionListener#onError}.
+ */
+ public void destroy() {
+ if (mConnection != null) {
+ mContext.unbindService(mConnection);
+ }
+ mService = null;
+ }
+
+ /**
+ * Internal wrapper of IRecognitionListener which will propagate the results
+ * to RecognitionListener
+ */
+ private class InternalRecognitionListener extends IRecognitionListener.Stub {
+
+ public void onBeginningOfSpeech() {
+ if (mListener != null) {
+ mListener.onBeginningOfSpeech();
+ }
+ }
+
+ public void onBufferReceived(final byte[] buffer) {
+ if (mListener != null) {
+ mListener.onBufferReceived(buffer);
+ }
+ }
+
+ public void onEndOfSpeech() {
+ if (mListener != null) {
+ mListener.onEndOfSpeech();
+ }
+ }
+
+ public void onError(final int error) {
+ if (mListener != null) {
+ mListener.onError(error);
+ }
+ }
+
+ public void onReadyForSpeech(final Bundle noiseParams) {
+ if (mListener != null) {
+ mListener.onReadyForSpeech(noiseParams);
+ }
+ }
+
+ public void onResults(final Bundle results) {
+ if (mListener != null) {
+ mListener.onResults(results);
+ }
+ }
+
+ public void onPartialResults(final Bundle results) {
+ if (mListener != null) {
+ mListener.onPartialResults(results);
+ }
+ }
+
+ public void onRmsChanged(final float rmsdB) {
+ if (mListener != null) {
+ mListener.onRmsChanged(rmsdB);
+ }
+ }
+ }
+}
diff --git a/core/java/android/speech/RecognitionResult.aidl b/core/java/android/speech/RecognitionResult.aidl
deleted file mode 100644
index 59e53ab..0000000
--- a/core/java/android/speech/RecognitionResult.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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 android.speech;
-
-parcelable RecognitionResult;
diff --git a/core/java/android/speech/RecognitionResult.java b/core/java/android/speech/RecognitionResult.java
deleted file mode 100644
index 95715ee..0000000
--- a/core/java/android/speech/RecognitionResult.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * 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 android.speech;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * RecognitionResult is a passive object that stores a single recognized query
- * and its search result.
- *
- * TODO: Revisit and improve this class, reconciling the different types of actions and
- * the different ways they are represented. Maybe we should have a separate result object
- * for each type, and put them (type/value) in bundle?
- * {@hide}
- */
-public class RecognitionResult implements Parcelable {
- /**
- * Status of the recognize request.
- */
- public static final int NETWORK_TIMEOUT = 1; // Network operation timed out.
-
- public static final int NETWORK_ERROR = 2; // Other network related errors.
-
- public static final int AUDIO_ERROR = 3; // Audio recording error.
-
- public static final int SERVER_ERROR = 4; // Server sends error status.
-
- public static final int CLIENT_ERROR = 5; // Other client side errors.
-
- public static final int SPEECH_TIMEOUT = 6; // No speech input
-
- public static final int NO_MATCH = 7; // No recognition result matched.
-
- public static final int SERVICE_BUSY = 8; // RecognitionService busy.
-
- /**
- * Type of the recognition results.
- */
- public static final int RAW_RECOGNITION_RESULT = 0;
-
- public static final int WEB_SEARCH_RESULT = 1;
-
- public static final int CONTACT_RESULT = 2;
-
- public static final int ACTION_RESULT = 3;
-
- /**
- * A factory method to create a raw RecognitionResult
- *
- * @param sentence the recognized text.
- */
- public static RecognitionResult newRawRecognitionResult(String sentence) {
- return new RecognitionResult(RAW_RECOGNITION_RESULT, sentence, null, null);
- }
-
- /**
- * A factory method to create a RecognitionResult for contacts.
- *
- * @param contact the contact name.
- * @param phoneType the phone type.
- * @param callAction whether this result included a command to "call", or
- * just the contact name.
- */
- public static RecognitionResult newContactResult(String contact, int phoneType,
- boolean callAction) {
- return new RecognitionResult(CONTACT_RESULT, contact, phoneType, callAction);
- }
-
- /**
- * A factory method to create a RecognitionResult for a web search query.
- *
- * @param query the query string.
- * @param html the html page of the search result.
- * @param url the url that performs the search with the query.
- */
- public static RecognitionResult newWebResult(String query, String html, String url) {
- return new RecognitionResult(WEB_SEARCH_RESULT, query, html, url);
- }
-
- /**
- * A factory method to create a RecognitionResult for an action.
- *
- * @param action the action type
- * @param query the query string associated with that action.
- */
- public static RecognitionResult newActionResult(int action, String query) {
- return new RecognitionResult(ACTION_RESULT, action, query);
- }
-
- public static final Parcelable.Creator<RecognitionResult> CREATOR =
- new Parcelable.Creator<RecognitionResult>() {
-
- public RecognitionResult createFromParcel(Parcel in) {
- return new RecognitionResult(in);
- }
-
- public RecognitionResult[] newArray(int size) {
- return new RecognitionResult[size];
- }
- };
-
- /**
- * Result type.
- */
- public final int mResultType;
-
- /**
- * The recognized string when mResultType is WEB_SEARCH_RESULT. The name of
- * the contact when mResultType is CONTACT_RESULT. The relevant query when
- * mResultType is ACTION_RESULT.
- */
- public final String mText;
-
- /**
- * The HTML result page for the query. If this is null, then the application
- * must use the url field to get the HTML result page.
- */
- public final String mHtml;
-
- /**
- * The url to get the result page for the query string. The application must
- * use this url instead of performing the search with the query.
- */
- public final String mUrl;
-
- /**
- * Phone number type. This is valid only when mResultType == CONTACT_RESULT.
- */
- public final int mPhoneType;
-
- /**
- * Action type. This is valid only when mResultType == ACTION_RESULT.
- */
- public final int mAction;
-
- /**
- * Whether a contact recognition result included a command to "call". This
- * is valid only when mResultType == CONTACT_RESULT.
- */
- public final boolean mCallAction;
-
- private RecognitionResult(int type, int action, String query) {
- mResultType = type;
- mAction = action;
- mText = query;
- mHtml = null;
- mUrl = null;
- mPhoneType = -1;
- mCallAction = false;
- }
-
- private RecognitionResult(int type, String query, String html, String url) {
- mResultType = type;
- mText = query;
- mHtml = html;
- mUrl = url;
- mPhoneType = -1;
- mAction = -1;
- mCallAction = false;
- }
-
- private RecognitionResult(int type, String query, int phoneType, boolean callAction) {
- mResultType = type;
- mText = query;
- mPhoneType = phoneType;
- mHtml = null;
- mUrl = null;
- mAction = -1;
- mCallAction = callAction;
- }
-
- private RecognitionResult(Parcel in) {
- mResultType = in.readInt();
- mText = in.readString();
- mHtml = in.readString();
- mUrl = in.readString();
- mPhoneType = in.readInt();
- mAction = in.readInt();
- mCallAction = (in.readInt() == 1);
- }
-
- public void writeToParcel(Parcel out, int flags) {
- out.writeInt(mResultType);
- out.writeString(mText);
- out.writeString(mHtml);
- out.writeString(mUrl);
- out.writeInt(mPhoneType);
- out.writeInt(mAction);
- out.writeInt(mCallAction ? 1 : 0);
- }
-
- @Override
- public String toString() {
- String resultType[] = {
- "RAW", "WEB", "CONTACT", "ACTION"
- };
- return "[type=" + resultType[mResultType] + ", text=" + mText + ", mUrl=" + mUrl
- + ", html=" + mHtml + ", mAction=" + mAction + ", mCallAction=" + mCallAction + "]";
- }
-
- public int describeContents() {
- // no special description
- return 0;
- }
-}
diff --git a/core/java/android/speech/RecognitionServiceUtil.java b/core/java/android/speech/RecognitionServiceUtil.java
deleted file mode 100644
index 4207543..0000000
--- a/core/java/android/speech/RecognitionServiceUtil.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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 android.speech;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.speech.RecognitionResult;
-import android.util.Log;
-
-import java.util.List;
-
-/**
- * Utils for Google's network-based speech recognizer, which lets you perform
- * speech-to-text translation through RecognitionService. IRecognitionService
- * and IRecognitionListener are the core interfaces; you begin recognition
- * through IRecognitionService and subscribe to callbacks about when the user
- * stopped speaking, results come in, errors, etc. through IRecognitionListener.
- * RecognitionServiceUtil includes default IRecognitionListener and
- * ServiceConnection implementations to reduce the amount of boilerplate.
- *
- * The Service provides no user interface. See RecognitionActivity if you
- * want the standard voice search UI.
- *
- * Below is a small skeleton of how to use the recognizer:
- *
- * ServiceConnection conn = new RecognitionServiceUtil.Connection();
- * mContext.bindService(RecognitionServiceUtil.sDefaultIntent,
- * conn, Context.BIND_AUTO_CREATE);
- * IRecognitionListener listener = new RecognitionServiceWrapper.NullListener() {
- * public void onResults(List<String> results) {
- * // Do something with recognition transcripts
- * }
- * }
- *
- * // Must wait for conn.mService to be populated, then call below
- * conn.mService.startListening(null, listener);
- *
- * {@hide}
- */
-public class RecognitionServiceUtil {
- public static final Intent sDefaultIntent = new Intent(
- RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
-
- // Recognize request parameters
- public static final String USE_LOCATION = "useLocation";
- public static final String CONTACT_AUTH_TOKEN = "contactAuthToken";
-
- // Bundles
- public static final String NOISE_LEVEL = "NoiseLevel";
- public static final String SIGNAL_NOISE_RATIO = "SignalNoiseRatio";
-
- private RecognitionServiceUtil() {}
-
- /**
- * IRecognitionListener which does nothing in response to recognition
- * callbacks. You can subclass from this and override only the methods
- * whose events you want to respond to.
- */
- public static class NullListener extends IRecognitionListener.Stub {
- public void onReadyForSpeech(Bundle bundle) {}
- public void onBeginningOfSpeech() {}
- public void onRmsChanged(float rmsdB) {}
- public void onBufferReceived(byte[] buf) {}
- public void onEndOfSpeech() {}
- public void onError(int error) {}
- public void onResults(List<RecognitionResult> results, long key) {}
- }
-
- /**
- * Basic ServiceConnection which just records mService variable.
- */
- public static class Connection implements ServiceConnection {
- public IRecognitionService mService;
-
- public synchronized void onServiceConnected(ComponentName name, IBinder service) {
- mService = IRecognitionService.Stub.asInterface(service);
- }
-
- public void onServiceDisconnected(ComponentName name) {
- mService = null;
- }
- }
-}
diff --git a/core/java/android/speech/RecognizerIntent.java b/core/java/android/speech/RecognizerIntent.java
index 987e763..49991bd 100644
--- a/core/java/android/speech/RecognizerIntent.java
+++ b/core/java/android/speech/RecognizerIntent.java
@@ -84,6 +84,42 @@
public static final String ACTION_WEB_SEARCH = "android.speech.action.WEB_SEARCH";
/**
+ * The minimum length of an utterance. We will not stop recording before this amount of time.
+ *
+ * Note that it is extremely rare you'd want to specify this value in an intent. If you don't
+ * have a very good reason to change these, you should leave them as they are. Note also that
+ * certain values may cause undesired or unexpected results - use judiciously! Additionally,
+ * depending on the recognizer implementation, these values may have no effect.
+ */
+ public static final String EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS =
+ "android.speech.extras.SPEECH_INPUT_MINIMUM_LENGTH_MILLIS";
+
+ /**
+ * The amount of time that it should take after we stop hearing speech to consider the input
+ * complete.
+ *
+ * Note that it is extremely rare you'd want to specify this value in an intent. If
+ * you don't have a very good reason to change these, you should leave them as they are. Note
+ * also that certain values may cause undesired or unexpected results - use judiciously!
+ * Additionally, depending on the recognizer implementation, these values may have no effect.
+ */
+ public static final String EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS =
+ "android.speech.extras.SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS";
+
+ /**
+ * The amount of time that it should take after we stop hearing speech to consider the input
+ * possibly complete. This is used to prevent the endpointer cutting off during very short
+ * mid-speech pauses.
+ *
+ * Note that it is extremely rare you'd want to specify this value in an intent. If
+ * you don't have a very good reason to change these, you should leave them as they are. Note
+ * also that certain values may cause undesired or unexpected results - use judiciously!
+ * Additionally, depending on the recognizer implementation, these values may have no effect.
+ */
+ public static final String EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS =
+ "android.speech.extras.SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS";
+
+ /**
* Informs the recognizer which speech model to prefer when performing
* {@link #ACTION_RECOGNIZE_SPEECH}. The recognizer uses this
* information to fine tune the results. This extra is required. Activities implementing
@@ -111,8 +147,9 @@
public static final String EXTRA_PROMPT = "android.speech.extra.PROMPT";
/**
- * Optional language override to inform the recognizer that it should expect speech in
- * a language different than the one set in the {@link java.util.Locale#getDefault()}.
+ * Optional IETF language tag (as defined by BCP 47), for example "en-US". This tag informs the
+ * recognizer to perform speech recognition in a language different than the one set in the
+ * {@link java.util.Locale#getDefault()}.
*/
public static final String EXTRA_LANGUAGE = "android.speech.extra.LANGUAGE";
@@ -121,7 +158,7 @@
* will choose how many results to return. Must be an integer.
*/
public static final String EXTRA_MAX_RESULTS = "android.speech.extra.MAX_RESULTS";
-
+
/**
* When the intent is {@link #ACTION_RECOGNIZE_SPEECH}, the speech input activity will
* return results to you via the activity results mechanism. Alternatively, if you use this
@@ -154,4 +191,10 @@
* {@link #ACTION_RECOGNIZE_SPEECH}. Only present when {@link Activity#RESULT_OK} is returned.
*/
public static final String EXTRA_RESULTS = "android.speech.extra.RESULTS";
+
+ /**
+ * Triggers the voice search settings activity.
+ */
+ public static final String ACTION_VOICE_SEARCH_SETTINGS =
+ "android.speech.action.VOICE_SEARCH_SETTINGS";
}
diff --git a/core/java/android/view/ScaleGestureDetector.java b/core/java/android/view/ScaleGestureDetector.java
index 50bfefc..f991df7 100644
--- a/core/java/android/view/ScaleGestureDetector.java
+++ b/core/java/android/view/ScaleGestureDetector.java
@@ -147,12 +147,9 @@
public ScaleGestureDetector(Context context, OnScaleGestureListener listener) {
ViewConfiguration config = ViewConfiguration.get(context);
- DisplayMetrics metrics = context.getResources().getDisplayMetrics();
mContext = context;
mListener = listener;
mEdgeSlop = config.getScaledEdgeSlop();
- mRightSlopEdge = metrics.widthPixels - mEdgeSlop;
- mBottomSlopEdge = metrics.heightPixels - mEdgeSlop;
}
public boolean onTouchEvent(MotionEvent event) {
@@ -165,6 +162,11 @@
event.getPointerCount() >= 2) {
// We have a new multi-finger gesture
+ // as orientation can change, query the metrics in touch down
+ DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
+ mRightSlopEdge = metrics.widthPixels - mEdgeSlop;
+ mBottomSlopEdge = metrics.heightPixels - mEdgeSlop;
+
// Be paranoid in case we missed an event
reset();
@@ -185,12 +187,16 @@
final float x1 = getRawX(event, 1);
final float y1 = getRawY(event, 1);
- boolean p0sloppy = x0 < edgeSlop || y0 < edgeSlop ||
- x1 < edgeSlop || y1 < edgeSlop;
- boolean p1sloppy = x0 > rightSlop || y0 > bottomSlop ||
- x1 > rightSlop || y1 > bottomSlop;
+ boolean p0sloppy = x0 < edgeSlop || y0 < edgeSlop
+ || x0 > rightSlop || y0 > bottomSlop;
+ boolean p1sloppy = x1 < edgeSlop || y1 < edgeSlop
+ || x1 > rightSlop || y1 > bottomSlop;
- if (p0sloppy) {
+ if(p0sloppy && p1sloppy) {
+ mFocusX = -1;
+ mFocusY = -1;
+ mSloppyGesture = true;
+ } else if (p0sloppy) {
mFocusX = event.getX(1);
mFocusY = event.getY(1);
mSloppyGesture = true;
@@ -211,12 +217,15 @@
final float x1 = getRawX(event, 1);
final float y1 = getRawY(event, 1);
- boolean p0sloppy = x0 < edgeSlop || y0 < edgeSlop ||
- x1 < edgeSlop || y1 < edgeSlop;
- boolean p1sloppy = x0 > rightSlop || y0 > bottomSlop ||
- x1 > rightSlop || y1 > bottomSlop;
+ boolean p0sloppy = x0 < edgeSlop || y0 < edgeSlop
+ || x0 > rightSlop || y0 > bottomSlop;
+ boolean p1sloppy = x1 < edgeSlop || y1 < edgeSlop
+ || x1 > rightSlop || y1 > bottomSlop;
- if (p0sloppy) {
+ if(p0sloppy && p1sloppy) {
+ mFocusX = -1;
+ mFocusY = -1;
+ } else if (p0sloppy) {
mFocusX = event.getX(1);
mFocusY = event.getY(1);
} else if (p1sloppy) {
@@ -226,6 +235,14 @@
mSloppyGesture = false;
mGestureInProgress = mListener.onScaleBegin(this);
}
+ } else if ((action == MotionEvent.ACTION_POINTER_1_UP
+ || action == MotionEvent.ACTION_POINTER_2_UP)
+ && mSloppyGesture) {
+ // Set focus point to the remaining finger
+ int id = (((action & MotionEvent.ACTION_POINTER_ID_MASK)
+ >> MotionEvent.ACTION_POINTER_ID_SHIFT) == 0) ? 1 : 0;
+ mFocusX = event.getX(id);
+ mFocusY = event.getY(id);
}
} else {
// Transform gesture in progress - attempt to handle it
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index a3d3521..31c9b08 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -3789,7 +3789,8 @@
* ViewGroups should override to route to their children.
* @param changedView The view whose visibility changed. Could be 'this' or
* an ancestor view.
- * @param visibility The new visibility of changedView.
+ * @param visibility The new visibility of changedView: {@link #VISIBLE},
+ * {@link #INVISIBLE} or {@link #GONE}.
*/
protected void dispatchVisibilityChanged(View changedView, int visibility) {
onVisibilityChanged(changedView, visibility);
@@ -3799,12 +3800,38 @@
* Called when the visibility of the view or an ancestor of the view is changed.
* @param changedView The view whose visibility changed. Could be 'this' or
* an ancestor view.
- * @param visibility The new visibility of changedView.
+ * @param visibility The new visibility of changedView: {@link #VISIBLE},
+ * {@link #INVISIBLE} or {@link #GONE}.
*/
protected void onVisibilityChanged(View changedView, int visibility) {
}
/**
+ * Dispatch a hint about whether this view is displayed. For instance, when
+ * a View moves out of the screen, it might receives a display hint indicating
+ * the view is not displayed. Applications should not <em>rely</em> on this hint
+ * as there is no guarantee that they will receive one.
+ *
+ * @param hint A hint about whether or not this view is displayed:
+ * {@link #VISIBLE} or {@link #INVISIBLE}.
+ */
+ public void dispatchDisplayHint(int hint) {
+ onDisplayHint(hint);
+ }
+
+ /**
+ * Gives this view a hint about whether is displayed or not. For instance, when
+ * a View moves out of the screen, it might receives a display hint indicating
+ * the view is not displayed. Applications should not <em>rely</em> on this hint
+ * as there is no guarantee that they will receive one.
+ *
+ * @param hint A hint about whether or not this view is displayed:
+ * {@link #VISIBLE} or {@link #INVISIBLE}.
+ */
+ protected void onDisplayHint(int hint) {
+ }
+
+ /**
* Dispatch a window visibility change down the view hierarchy.
* ViewGroups should override to route to their children.
*
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 49c2d0e..cdf9eb0 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -679,6 +679,19 @@
}
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dispatchDisplayHint(int hint) {
+ super.dispatchDisplayHint(hint);
+ final int count = mChildrenCount;
+ final View[] children = mChildren;
+ for (int i = 0; i < count; i++) {
+ children[i].dispatchDisplayHint(hint);
+ }
+ }
/**
* {@inheritDoc}
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index 1337bed..3f1672a 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -177,18 +177,21 @@
/**
* Load a url from the network or the filesystem into the main frame.
- * Following the same behaviour as Safari, javascript: URLs are not
- * passed to the main frame, instead they are evaluated immediately.
+ * Following the same behaviour as Safari, javascript: URLs are not passed
+ * to the main frame, instead they are evaluated immediately.
* @param url The url to load.
+ * @param extraHeaders The extra headers sent with this url. This should not
+ * include the common headers like "user-agent". If it does, it
+ * will be replaced by the intrinsic value of the WebView.
*/
- public void loadUrl(String url) {
+ public void loadUrl(String url, Map<String, String> extraHeaders) {
mLoadInitFromJava = true;
if (URLUtil.isJavaScriptUrl(url)) {
// strip off the scheme and evaluate the string
stringByEvaluatingJavaScriptFromString(
url.substring("javascript:".length()));
} else {
- nativeLoadUrl(url);
+ nativeLoadUrl(url, extraHeaders);
}
mLoadInitFromJava = false;
}
@@ -904,7 +907,7 @@
/**
* Returns false if the url is bad.
*/
- private native void nativeLoadUrl(String url);
+ private native void nativeLoadUrl(String url, Map<String, String> headers);
private native void nativePostUrl(String url, byte[] postData);
diff --git a/core/java/android/webkit/SslErrorHandler.java b/core/java/android/webkit/SslErrorHandler.java
index 90ed65d..d99c2c0 100644
--- a/core/java/android/webkit/SslErrorHandler.java
+++ b/core/java/android/webkit/SslErrorHandler.java
@@ -51,6 +51,11 @@
*/
private Bundle mSslPrefTable;
+ /**
+ * Flag indicating that a client reponse is pending.
+ */
+ private boolean mResponsePending;
+
// Message id for handling the response
private static final int HANDLE_RESPONSE = 100;
@@ -191,6 +196,7 @@
// if we do not have information on record, ask
// the user (display a dialog)
CallbackProxy proxy = loader.getFrame().getCallbackProxy();
+ mResponsePending = true;
proxy.onReceivedSslError(this, error);
}
@@ -202,7 +208,11 @@
* Proceed with the SSL certificate.
*/
public void proceed() {
- sendMessage(obtainMessage(HANDLE_RESPONSE, 1, 0, mLoaderQueue.poll()));
+ if (mResponsePending) {
+ mResponsePending = false;
+ sendMessage(obtainMessage(HANDLE_RESPONSE, 1, 0,
+ mLoaderQueue.poll()));
+ }
}
/**
@@ -210,7 +220,11 @@
* the error.
*/
public void cancel() {
- sendMessage(obtainMessage(HANDLE_RESPONSE, 0, 0, mLoaderQueue.poll()));
+ if (mResponsePending) {
+ mResponsePending = false;
+ sendMessage(obtainMessage(HANDLE_RESPONSE, 0, 0,
+ mLoaderQueue.poll()));
+ }
}
/**
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 56650a6..ecea55f 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1376,6 +1376,22 @@
}
/**
+ * Load the given url with the extra headers.
+ * @param url The url of the resource to load.
+ * @param extraHeaders The extra headers sent with this url. This should not
+ * include the common headers like "user-agent". If it does, it
+ * will be replaced by the intrinsic value of the WebView.
+ */
+ public void loadUrl(String url, Map<String, String> extraHeaders) {
+ switchOutDrawHistory();
+ WebViewCore.GetUrlData arg = new WebViewCore.GetUrlData();
+ arg.mUrl = url;
+ arg.mExtraHeaders = extraHeaders;
+ mWebViewCore.sendMessage(EventHub.LOAD_URL, arg);
+ clearTextEntry();
+ }
+
+ /**
* Load the given url.
* @param url The url of the resource to load.
*/
@@ -1383,9 +1399,7 @@
if (url == null) {
return;
}
- switchOutDrawHistory();
- mWebViewCore.sendMessage(EventHub.LOAD_URL, url);
- clearTextEntry();
+ loadUrl(url, null);
}
/**
@@ -4607,14 +4621,11 @@
break;
}
} else {
- if (mPreventDrag == PREVENT_DRAG_MAYBE_YES) {
- // if mPreventDrag is not confirmed, treat it as
- // no so that it won't block tap or double tap.
- mPreventDrag = PREVENT_DRAG_NO;
- mPreventLongPress = false;
- mPreventDoubleTap = false;
- }
- if (mPreventDrag == PREVENT_DRAG_NO) {
+ // mPreventDrag can be PREVENT_DRAG_MAYBE_YES in
+ // TOUCH_INIT_MODE. To give WebCoreThread a little
+ // more time to send PREVENT_TOUCH_ID, we check
+ // again in responding RELEASE_SINGLE_TAP.
+ if (mPreventDrag != PREVENT_DRAG_YES) {
if (mTouchMode == TOUCH_INIT_MODE) {
mPrivateHandler.sendMessageDelayed(
mPrivateHandler.obtainMessage(
@@ -5631,6 +5642,13 @@
break;
}
case RELEASE_SINGLE_TAP: {
+ if (mPreventDrag == PREVENT_DRAG_MAYBE_YES) {
+ // if mPreventDrag is not confirmed, treat it as
+ // no so that it won't block tap.
+ mPreventDrag = PREVENT_DRAG_NO;
+ mPreventLongPress = false;
+ mPreventDoubleTap = false;
+ }
if (mPreventDrag == PREVENT_DRAG_NO) {
mTouchMode = TOUCH_DONE_MODE;
doShortPress();
@@ -5863,7 +5881,7 @@
// updates is a C++ pointer to a Vector of
// AnimationValues that we apply to the layers.
// The Vector is deallocated in nativeUpdateLayers().
- nativeUpdateLayers(mRootLayer, updates);
+ nativeUpdateLayers(updates);
}
invalidate();
break;
@@ -5985,10 +6003,22 @@
}
mFullScreenHolder = new PluginFullScreenHolder(
WebView.this, data.mNpp);
+ // as we are sharing the View between full screen and
+ // embedded mode, we have to remove the
+ // AbsoluteLayout.LayoutParams set by embedded mode to
+ // ViewGroup.LayoutParams before adding it to the dialog
+ data.mView.setLayoutParams(new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.FILL_PARENT,
+ ViewGroup.LayoutParams.FILL_PARENT));
mFullScreenHolder.setContentView(data.mView);
mFullScreenHolder.setCancelable(false);
mFullScreenHolder.setCanceledOnTouchOutside(false);
mFullScreenHolder.show();
+ } else if (mFullScreenHolder == null) {
+ // this may happen if user dismisses the fullscreen and
+ // then the WebCore re-position message finally reached
+ // the UI thread.
+ break;
}
// move the matching embedded view fully into the view so
// that touch will be valid instead of rejected due to out
@@ -6602,7 +6632,7 @@
private native void nativeDestroyLayer(int layer);
private native int nativeEvaluateLayersAnimations(int layer);
private native boolean nativeLayersHaveAnimations(int layer);
- private native void nativeUpdateLayers(int layer, int updates);
+ private native void nativeUpdateLayers(int updates);
private native void nativeDrawLayers(int layer,
int scrollX, int scrollY,
int width, int height,
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 6700d71..1e21cb4 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -686,6 +686,11 @@
int mY;
}
+ static class GetUrlData {
+ String mUrl;
+ Map<String, String> mExtraHeaders;
+ }
+
static class PostUrlData {
String mUrl;
byte[] mPostData;
@@ -958,9 +963,11 @@
((Float) msg.obj).floatValue(), msg.arg1);
break;
- case LOAD_URL:
- loadUrl((String) msg.obj);
+ case LOAD_URL: {
+ GetUrlData param = (GetUrlData) msg.obj;
+ loadUrl(param.mUrl, param.mExtraHeaders);
break;
+ }
case POST_URL: {
PostUrlData param = (PostUrlData) msg.obj;
@@ -1545,9 +1552,9 @@
}
}
- private void loadUrl(String url) {
+ private void loadUrl(String url, Map<String, String> extraHeaders) {
if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, " CORE loadUrl " + url);
- mBrowserFrame.loadUrl(url);
+ mBrowserFrame.loadUrl(url, extraHeaders);
}
private void key(KeyEvent evt, boolean isDown) {
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index b795080..3a4b92d 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2852,6 +2852,23 @@
checkSelectionChanged();
}
+ @Override
+ protected void onDisplayHint(int hint) {
+ super.onDisplayHint(hint);
+ switch (hint) {
+ case INVISIBLE:
+ if (mPopup != null && mPopup.isShowing()) {
+ dismissPopup();
+ }
+ break;
+ case VISIBLE:
+ if (mFiltered && mPopup != null && !mPopup.isShowing()) {
+ showPopup();
+ }
+ break;
+ }
+ }
+
/**
* Removes the filter window
*/
@@ -3140,7 +3157,7 @@
}
} else {
// Hide the popup when we are no longer visible
- if (mPopup.isShowing()) {
+ if (mPopup != null && mPopup.isShowing()) {
dismissPopup();
}
}
diff --git a/core/java/android/widget/AppSecurityPermissions.java b/core/java/android/widget/AppSecurityPermissions.java
index a09f23c..aa14c81 100755
--- a/core/java/android/widget/AppSecurityPermissions.java
+++ b/core/java/android/widget/AppSecurityPermissions.java
@@ -146,6 +146,19 @@
}
}
+ /**
+ * Utility to retrieve a view displaying a single permission.
+ */
+ public static View getPermissionItemView(Context context,
+ CharSequence grpName, CharSequence description, boolean dangerous) {
+ LayoutInflater inflater = (LayoutInflater)context.getSystemService(
+ Context.LAYOUT_INFLATER_SERVICE);
+ Drawable icon = context.getResources().getDrawable(dangerous
+ ? R.drawable.ic_bullet_key_permission : R.drawable.ic_text_dot);
+ return getPermissionItemView(context, inflater, grpName,
+ description, dangerous, icon);
+ }
+
private void getAllUsedPermissions(int sharedUid, Set<PermissionInfo> permSet) {
String sharedPkgList[] = mPm.getPackagesForUid(sharedUid);
if(sharedPkgList == null || (sharedPkgList.length == 0)) {
@@ -304,15 +317,20 @@
mNoPermsView.setVisibility(View.VISIBLE);
}
- private View getPermissionItemView(CharSequence grpName, String permList,
+ private View getPermissionItemView(CharSequence grpName, CharSequence permList,
boolean dangerous) {
- View permView = mInflater.inflate(R.layout.app_permission_item, null);
- Drawable icon = dangerous ? mDangerousIcon : mNormalIcon;
+ return getPermissionItemView(mContext, mInflater, grpName, permList,
+ dangerous, dangerous ? mDangerousIcon : mNormalIcon);
+ }
+
+ private static View getPermissionItemView(Context context, LayoutInflater inflater,
+ CharSequence grpName, CharSequence permList, boolean dangerous, Drawable icon) {
+ View permView = inflater.inflate(R.layout.app_permission_item, null);
TextView permGrpView = (TextView) permView.findViewById(R.id.permission_group);
TextView permDescView = (TextView) permView.findViewById(R.id.permission_list);
if (dangerous) {
- final Resources resources = mContext.getResources();
+ final Resources resources = context.getResources();
permGrpView.setTextColor(resources.getColor(R.color.perms_dangerous_grp_color));
permDescView.setTextColor(resources.getColor(R.color.perms_dangerous_perm_color));
}
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index d53a442..0f47b96 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -1033,6 +1033,18 @@
}
@Override
+ protected void onDisplayHint(int hint) {
+ super.onDisplayHint(hint);
+ switch (hint) {
+ case INVISIBLE:
+ if (!mDropDownAlwaysVisible) {
+ dismissDropDown();
+ }
+ break;
+ }
+ }
+
+ @Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
super.onFocusChanged(focused, direction, previouslyFocusedRect);
// Perform validation if the view is losing focus.
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index 2f28d9f..1dcb203 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -177,6 +177,8 @@
Drawable drawable = a.getDrawable(R.styleable.ProgressBar_progressDrawable);
if (drawable != null) {
drawable = tileify(drawable, false);
+ // Calling this method can set mMaxHeight, make sure the corresponding
+ // XML attribute for mMaxHeight is read after calling this method
setProgressDrawable(drawable);
}
@@ -421,6 +423,13 @@
public void setProgressDrawable(Drawable d) {
if (d != null) {
d.setCallback(this);
+
+ // Make sure the ProgressBar is always tall enough
+ int drawableHeight = d.getMinimumHeight();
+ if (mMaxHeight < drawableHeight) {
+ mMaxHeight = drawableHeight;
+ requestLayout();
+ }
}
mProgressDrawable = d;
if (!mIndeterminate) {
diff --git a/core/java/android/widget/ViewAnimator.java b/core/java/android/widget/ViewAnimator.java
index 4112501..907cfb3 100644
--- a/core/java/android/widget/ViewAnimator.java
+++ b/core/java/android/widget/ViewAnimator.java
@@ -138,14 +138,15 @@
final int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
+ final boolean checkForFirst = (!mFirstTime || mAnimateFirstTime);
if (i == childIndex) {
- if ((!mFirstTime || mAnimateFirstTime) && mInAnimation != null) {
+ if (checkForFirst && mInAnimation != null) {
child.startAnimation(mInAnimation);
}
child.setVisibility(View.VISIBLE);
mFirstTime = false;
} else {
- if (mOutAnimation != null && child.getVisibility() == View.VISIBLE) {
+ if (checkForFirst && mOutAnimation != null && child.getVisibility() == View.VISIBLE) {
child.startAnimation(mOutAnimation);
} else if (child.getAnimation() == mInAnimation)
child.clearAnimation();
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListInVerticalTest.java b/core/java/com/android/internal/app/IMediaContainerService.aidl
old mode 100644
new mode 100755
similarity index 62%
copy from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListInVerticalTest.java
copy to core/java/com/android/internal/app/IMediaContainerService.aidl
index 73078b9..726e28f
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListInVerticalTest.java
+++ b/core/java/com/android/internal/app/IMediaContainerService.aidl
@@ -14,12 +14,15 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package com.android.internal.app;
-import com.android.frameworktest.listview.ListInVertical;
+import android.net.Uri;
+import android.os.ParcelFileDescriptor;
-public class ListInVerticalTest extends ListUnspecifiedMeasure<ListInVertical> {
- public ListInVerticalTest() {
- super(ListInVertical.class);
- }
-}
+interface IMediaContainerService {
+ String copyResourceToContainer(in Uri packageURI,
+ String containerId,
+ String key, String resFileName);
+ boolean copyResource(in Uri packageURI,
+ in ParcelFileDescriptor outStream);
+}
\ No newline at end of file
diff --git a/core/java/com/android/internal/util/HanziToPinyin.java b/core/java/com/android/internal/util/HanziToPinyin.java
index 4368e98..6a4adaa 100644
--- a/core/java/com/android/internal/util/HanziToPinyin.java
+++ b/core/java/com/android/internal/util/HanziToPinyin.java
@@ -16,8 +16,6 @@
package com.android.internal.util;
-import com.google.android.util.AbstractMessageParser.Token;
-
import android.text.TextUtils;
import android.util.Log;
@@ -298,8 +296,10 @@
};
/** First and last Chinese character with known Pinyin according to zh collation */
- private static final String FIRST_UNIHAN = "\u5416";
- private static final String LAST_UNIHAN = "\u5497";
+ private static final String FIRST_PINYIN_UNIHAN = "\u5416";
+ private static final String LAST_PINYIN_UNIHAN = "\u5497";
+ /** The first Chinese character in Unicode block */
+ private static final char FIRST_UNIHAN = '\u3400';
private static final Collator COLLATOR = Collator.getInstance(Locale.CHINA);
private static HanziToPinyin sInstance;
@@ -311,10 +311,18 @@
*/
public static final String SEPARATOR = " ";
- public static final int ASCII = 1;
+ public static final int LATIN = 1;
public static final int PINYIN = 2;
public static final int UNKNOWN = 3;
+ public Token() {
+ }
+
+ public Token(int type, String source, String target) {
+ this.type = type;
+ this.source = source;
+ this.target = target;
+ }
/**
* Type of this token, ASCII, PINYIN or UNKNOWN.
*/
@@ -347,6 +355,7 @@
return sInstance;
}
}
+ Log.w(TAG, "There is no Chinese collator, HanziToPinyin is disabled");
sInstance = new HanziToPinyin(false);
return sInstance;
}
@@ -359,11 +368,15 @@
int offset = -1;
int cmp;
if (character < 256) {
- token.type = Token.ASCII;
+ token.type = Token.LATIN;
+ token.target = letter;
+ return token;
+ } else if (character < FIRST_UNIHAN) {
+ token.type = Token.UNKNOWN;
token.target = letter;
return token;
} else {
- cmp = COLLATOR.compare(letter, FIRST_UNIHAN);
+ cmp = COLLATOR.compare(letter, FIRST_PINYIN_UNIHAN);
if (cmp < 0) {
token.type = Token.UNKNOWN;
token.target = letter;
@@ -372,7 +385,7 @@
token.type = Token.PINYIN;
offset = 0;
} else {
- cmp = COLLATOR.compare(letter, LAST_UNIHAN);
+ cmp = COLLATOR.compare(letter, LAST_PINYIN_UNIHAN);
if (cmp > 0) {
token.type = Token.UNKNOWN;
token.target = letter;
@@ -412,44 +425,71 @@
return token;
}
+ /**
+ * Convert the input to a array of tokens. The sequence of ASCII or Unknown
+ * characters without space will be put into a Token, One Hanzi character
+ * which has pinyin will be treated as a Token.
+ * If these is no China collator, the empty token array is returned.
+ */
public ArrayList<Token> get(final String input) {
- if (!mHasChinaCollator || TextUtils.isEmpty(input)) {
- return null;
- }
-
ArrayList<Token> tokens = new ArrayList<Token>();
- Token currentToken;
-
+ if (!mHasChinaCollator || TextUtils.isEmpty(input)) {
+ // return empty tokens.
+ return tokens;
+ }
final int inputLength = input.length();
-
- currentToken = getToken(input.charAt(0));
-
- for (int i = 1; i < inputLength; i++) {
+ final StringBuilder sb = new StringBuilder();
+ int tokenType = Token.LATIN;
+ // Go through the input, create a new token when
+ // a. Token type changed
+ // b. Get the Pinyin of current charater.
+ // c. current character is space.
+ for (int i = 0; i < inputLength; i++) {
final char character = input.charAt(i);
- Token token = getToken(character);
-
- if (token.type != currentToken.type) {
- currentToken.target = currentToken.target.trim();
- tokens.add(currentToken);
- currentToken = token;
+ if (character == ' ') {
+ if (sb.length() > 0) {
+ addToken(sb, tokens, tokenType);
+ }
+ } else if (character < 256) {
+ if (tokenType != Token.LATIN && sb.length() > 0) {
+ addToken(sb, tokens, tokenType);
+ }
+ tokenType = Token.LATIN;
+ sb.append(character);
+ } else if (character < FIRST_UNIHAN) {
+ if (tokenType != Token.UNKNOWN && sb.length() > 0) {
+ addToken(sb, tokens, tokenType);
+ }
+ tokenType = Token.UNKNOWN;
+ sb.append(character);
} else {
- switch (token.type) {
- case Token.ASCII:
- case Token.UNKNOWN:
- currentToken.source += token.source;
- currentToken.target += token.target;
- break;
- case Token.PINYIN:
- currentToken.source += token.source;
- currentToken.target += " " + token.target;
- break;
+ Token t = getToken(character);
+ if (t.type == Token.PINYIN) {
+ if (sb.length() > 0) {
+ addToken(sb, tokens, tokenType);
+ }
+ tokens.add(t);
+ tokenType = Token.PINYIN;
+ } else {
+ if (tokenType != t.type && sb.length() > 0) {
+ addToken(sb, tokens, tokenType);
+ }
+ tokenType = t.type;
+ sb.append(character);
}
}
}
-
- currentToken.target = currentToken.target.trim();
- tokens.add(currentToken);
-
+ if (sb.length() > 0) {
+ addToken(sb, tokens, tokenType);
+ }
return tokens;
}
+
+ private void addToken(final StringBuilder sb, final ArrayList<Token> tokens,
+ final int tokenType) {
+ String str = sb.toString();
+ tokens.add(new Token(tokenType, str, str));
+ sb.setLength(0);
+ }
+
}
diff --git a/core/java/com/android/internal/widget/ContactHeaderWidget.java b/core/java/com/android/internal/widget/ContactHeaderWidget.java
index 33fd936..c4f9988 100644
--- a/core/java/com/android/internal/widget/ContactHeaderWidget.java
+++ b/core/java/com/android/internal/widget/ContactHeaderWidget.java
@@ -201,7 +201,7 @@
mNoPhotoResource = R.drawable.ic_contact_picture_3;
}
- mQueryHandler = new QueryHandler(mContentResolver);
+ resetAsyncQueryHandler();
}
public void enableClickListeners() {
@@ -237,6 +237,11 @@
@Override
protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
try{
+ if (this != mQueryHandler) {
+ Log.d(TAG, "onQueryComplete: discard result, the query handler is reset!");
+ return;
+ }
+
switch (token) {
case TOKEN_PHOTO_QUERY: {
//Set the photo
@@ -263,8 +268,14 @@
bindContactInfo(cursor);
Uri lookupUri = Contacts.getLookupUri(cursor.getLong(ContactQuery._ID),
cursor.getString(ContactQuery.LOOKUP_KEY));
- startPhotoQuery(cursor.getLong(ContactQuery.PHOTO_ID), lookupUri);
+ startPhotoQuery(cursor.getLong(ContactQuery.PHOTO_ID),
+ lookupUri, false /* don't reset query handler */);
invalidate();
+ } else {
+ // shouldn't really happen
+ setDisplayName(null, null);
+ setSocialSnippet(null);
+ setPhoto(loadPlaceholderPhoto(null));
}
break;
}
@@ -273,11 +284,13 @@
long contactId = cursor.getLong(PHONE_LOOKUP_CONTACT_ID_COLUMN_INDEX);
String lookupKey = cursor.getString(
PHONE_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
- bindFromContactUri(Contacts.getLookupUri(contactId, lookupKey));
+ bindFromContactUriInternal(Contacts.getLookupUri(contactId, lookupKey),
+ false /* don't reset query handler */);
} else {
String phoneNumber = (String) cookie;
setDisplayName(phoneNumber, null);
setSocialSnippet(null);
+ setPhoto(loadPlaceholderPhoto(null));
mPhotoView.assignContactFromPhone(phoneNumber, true);
}
break;
@@ -287,11 +300,13 @@
long contactId = cursor.getLong(EMAIL_LOOKUP_CONTACT_ID_COLUMN_INDEX);
String lookupKey = cursor.getString(
EMAIL_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
- bindFromContactUri(Contacts.getLookupUri(contactId, lookupKey));
+ bindFromContactUriInternal(Contacts.getLookupUri(contactId, lookupKey),
+ false /* don't reset query handler */);
} else {
String emailAddress = (String) cookie;
setDisplayName(emailAddress, null);
setSocialSnippet(null);
+ setPhoto(loadPlaceholderPhoto(null));
mPhotoView.assignContactFromEmail(emailAddress, true);
}
break;
@@ -397,22 +412,22 @@
* Convenience method for binding all available data from an existing
* contact.
*
- * @param conatctUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
+ * @param contactLookupUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
*/
public void bindFromContactLookupUri(Uri contactLookupUri) {
- mContactUri = contactLookupUri;
- startContactQuery(contactLookupUri);
+ bindFromContactUriInternal(contactLookupUri, true /* reset query handler */);
}
/**
* Convenience method for binding all available data from an existing
* contact.
*
- * @param conatctUri a {Contacts.CONTENT_URI} style URI.
+ * @param contactUri a {Contacts.CONTENT_URI} style URI.
+ * @param resetQueryHandler whether to use a new AsyncQueryHandler or not.
*/
- public void bindFromContactUri(Uri contactUri) {
+ private void bindFromContactUriInternal(Uri contactUri, boolean resetQueryHandler) {
mContactUri = contactUri;
- startContactQuery(contactUri);
+ startContactQuery(contactUri, resetQueryHandler);
}
/**
@@ -424,6 +439,8 @@
* address, one of them will be chosen to bind to.
*/
public void bindFromEmail(String emailAddress) {
+ resetAsyncQueryHandler();
+
mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP, emailAddress,
Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(emailAddress)),
EMAIL_LOOKUP_PROJECTION, null, null, null);
@@ -438,36 +455,72 @@
* number, one of them will be chosen to bind to.
*/
public void bindFromPhoneNumber(String number) {
+ resetAsyncQueryHandler();
+
mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP, number,
Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number)),
PHONE_LOOKUP_PROJECTION, null, null, null);
}
/**
- * Method to force this widget to forget everything it knows about the contact.
- * The widget isn't automatically updated or redrawn.
+ * startContactQuery
*
+ * internal method to query contact by Uri.
+ *
+ * @param contactUri the contact uri
+ * @param resetQueryHandler whether to use a new AsyncQueryHandler or not
*/
- public void wipeClean() {
- setDisplayName(null, null);
- setPhoto(null);
- setSocialSnippet(null);
- mContactUri = null;
- mExcludeMimes = null;
- }
+ private void startContactQuery(Uri contactUri, boolean resetQueryHandler) {
+ if (resetQueryHandler) {
+ resetAsyncQueryHandler();
+ }
- private void startContactQuery(Uri contactUri) {
mQueryHandler.startQuery(TOKEN_CONTACT_INFO, null, contactUri, ContactQuery.COLUMNS,
null, null, null);
}
- protected void startPhotoQuery(long photoId, Uri lookupKey) {
+ /**
+ * startPhotoQuery
+ *
+ * internal method to query contact photo by photo id and uri.
+ *
+ * @param photoId the photo id.
+ * @param lookupKey the lookup uri.
+ * @param resetQueryHandler whether to use a new AsyncQueryHandler or not.
+ */
+ protected void startPhotoQuery(long photoId, Uri lookupKey, boolean resetQueryHandler) {
+ if (resetQueryHandler) {
+ resetAsyncQueryHandler();
+ }
+
mQueryHandler.startQuery(TOKEN_PHOTO_QUERY, lookupKey,
ContentUris.withAppendedId(Data.CONTENT_URI, photoId), PhotoQuery.COLUMNS,
null, null, null);
}
/**
+ * Method to force this widget to forget everything it knows about the contact.
+ * We need to stop any existing async queries for phone, email, contact, and photos.
+ */
+ public void wipeClean() {
+ resetAsyncQueryHandler();
+
+ setDisplayName(null, null);
+ setPhoto(loadPlaceholderPhoto(null));
+ setSocialSnippet(null);
+ setPresence(0);
+ mContactUri = null;
+ mExcludeMimes = null;
+ }
+
+
+ private void resetAsyncQueryHandler() {
+ // the api AsyncQueryHandler.cancelOperation() doesn't really work. Since we really
+ // need the old async queries to be cancelled, let's do it the hard way.
+ mQueryHandler = new QueryHandler(mContentResolver);
+ }
+
+ /**
* Bind the contact details provided by the given {@link Cursor}.
*/
protected void bindContactInfo(Cursor c) {
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index aafe453..bd41a13 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -121,11 +121,6 @@
}
- public boolean isDevicePolicyActive() {
- ComponentName admin = mDevicePolicyManager.getActiveAdmin();
- return admin != null ? mDevicePolicyManager.isAdminActive(admin) : false;
- }
-
public int getRequestedMinimumPasswordLength() {
return mDevicePolicyManager.getMinimumPasswordLength();
}
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 67a0bda..7fd58e8 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -99,6 +99,7 @@
android/graphics/Shader.cpp \
android/graphics/Typeface.cpp \
android/graphics/Xfermode.cpp \
+ android/graphics/YuvToJpegEncoder.cpp \
android_media_AudioRecord.cpp \
android_media_AudioSystem.cpp \
android_media_AudioTrack.cpp \
@@ -148,6 +149,7 @@
external/tremor/Tremor \
external/icu4c/i18n \
external/icu4c/common \
+ external/jpeg \
frameworks/opt/emoji
LOCAL_SHARED_LIBRARIES := \
@@ -175,7 +177,8 @@
libicui18n \
libicudata \
libmedia \
- libwpa_client
+ libwpa_client \
+ libjpeg
ifeq ($(BOARD_HAVE_BLUETOOTH),true)
LOCAL_C_INCLUDES += \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 8364838..fa1ee0d 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -64,6 +64,7 @@
extern int register_android_graphics_Region(JNIEnv* env);
extern int register_android_graphics_Shader(JNIEnv* env);
extern int register_android_graphics_Typeface(JNIEnv* env);
+extern int register_android_graphics_YuvImage(JNIEnv* env);
extern int register_com_google_android_gles_jni_EGLImpl(JNIEnv* env);
extern int register_com_google_android_gles_jni_GLImpl(JNIEnv* env);
@@ -1215,6 +1216,7 @@
REG_JNI(register_android_graphics_Shader),
REG_JNI(register_android_graphics_Typeface),
REG_JNI(register_android_graphics_Xfermode),
+ REG_JNI(register_android_graphics_YuvImage),
REG_JNI(register_com_android_internal_graphics_NativeUtils),
REG_JNI(register_android_database_CursorWindow),
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index 65f6845..9965fe5 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -645,6 +645,23 @@
return chunkObject;
}
+static void nativeSetDefaultConfig(JNIEnv* env, jobject, int nativeConfig) {
+ SkBitmap::Config config = static_cast<SkBitmap::Config>(nativeConfig);
+
+ // these are the only default configs that make sense for codecs right now
+ static const SkBitmap::Config gValidDefConfig[] = {
+ SkBitmap::kRGB_565_Config,
+ SkBitmap::kARGB_8888_Config,
+ };
+
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gValidDefConfig); i++) {
+ if (config == gValidDefConfig[i]) {
+ SkImageDecoder::SetDeviceConfig(config);
+ break;
+ }
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
static JNINativeMethod gMethods[] = {
@@ -671,8 +688,9 @@
{ "nativeScaleNinePatch",
"([BFLandroid/graphics/Rect;)[B",
(void*)nativeScaleNinePatch
- }
+ },
+ { "nativeSetDefaultConfig", "(I)V", (void*)nativeSetDefaultConfig },
};
static JNINativeMethod gOptionsMethods[] = {
diff --git a/core/jni/android/graphics/YuvToJpegEncoder.cpp b/core/jni/android/graphics/YuvToJpegEncoder.cpp
new file mode 100644
index 0000000..ef5c9ae
--- /dev/null
+++ b/core/jni/android/graphics/YuvToJpegEncoder.cpp
@@ -0,0 +1,252 @@
+#include "CreateJavaOutputStreamAdaptor.h"
+#include "SkJpegUtility.h"
+#include "YuvToJpegEncoder.h"
+#include "ui/PixelFormat.h"
+
+#include <jni.h>
+
+YuvToJpegEncoder* YuvToJpegEncoder::create(int format, int* strides) {
+ // Only PIXEL_FORMAT_YCbCr_420_SP and PIXEl_FOMAT_YCbCr_422_I are supported
+ // for now.
+ if (format == android::PIXEL_FORMAT_YCbCr_420_SP) {
+ return new Yuv420SpToJpegEncoder(strides);
+ } else if (format == android::PIXEL_FORMAT_YCbCr_422_I) {
+ return new Yuv422IToJpegEncoder(strides);
+ } else {
+ return NULL;
+ }
+}
+
+YuvToJpegEncoder::YuvToJpegEncoder(int* strides) : fStrides(strides) {
+}
+
+bool YuvToJpegEncoder::encode(SkWStream* stream, void* inYuv, int width,
+ int height, int* offsets, int jpegQuality) {
+ jpeg_compress_struct cinfo;
+ skjpeg_error_mgr sk_err;
+ skjpeg_destination_mgr sk_wstream(stream);
+
+ cinfo.err = jpeg_std_error(&sk_err);
+ sk_err.error_exit = skjpeg_error_exit;
+ if (setjmp(sk_err.fJmpBuf)) {
+ return false;
+ }
+ jpeg_create_compress(&cinfo);
+
+ cinfo.dest = &sk_wstream;
+
+ setJpegCompressStruct(&cinfo, width, height, jpegQuality);
+
+ jpeg_start_compress(&cinfo, TRUE);
+
+ compress(&cinfo, (uint8_t*) inYuv, offsets);
+
+ jpeg_finish_compress(&cinfo);
+
+ return true;
+}
+
+void YuvToJpegEncoder::setJpegCompressStruct(jpeg_compress_struct* cinfo,
+ int width, int height, int quality) {
+ jpeg_set_quality(cinfo, quality, TRUE);
+
+ cinfo->image_width = width;
+ cinfo->image_height = height;
+
+ cinfo->input_components = 3;
+ cinfo->in_color_space = JCS_YCbCr;
+ jpeg_set_defaults(cinfo);
+ jpeg_set_colorspace(cinfo, JCS_YCbCr);
+ cinfo->raw_data_in = TRUE;
+
+ cinfo->dct_method = JDCT_IFAST;
+
+ configSamplingFactors(cinfo);
+}
+
+///////////////////////////////////////////////////////////////////
+Yuv420SpToJpegEncoder::Yuv420SpToJpegEncoder(int* strides) :
+ YuvToJpegEncoder(strides) {
+ fNumPlanes = 2;
+}
+
+void Yuv420SpToJpegEncoder::compress(jpeg_compress_struct* cinfo,
+ uint8_t* yuv, int* offsets) {
+ SkDebugf("onFlyCompress");
+ JSAMPROW y[16];
+ JSAMPROW cb[8];
+ JSAMPROW cr[8];
+ JSAMPARRAY planes[3];
+ planes[0] = y;
+ planes[1] = cb;
+ planes[2] = cr;
+
+ int width = cinfo->image_width;
+ int height = cinfo->image_height;
+ uint8_t* yPlanar = yuv + offsets[0];
+ uint8_t* vuPlanar = yuv + offsets[1]; //width * height;
+ uint8_t* uRows = new uint8_t [8 * (width >> 1)];
+ uint8_t* vRows = new uint8_t [8 * (width >> 1)];
+
+
+ // process 16 lines of Y and 8 lines of U/V each time.
+ while (cinfo->next_scanline < cinfo->image_height) {
+ //deitnerleave u and v
+ deinterleave(vuPlanar, uRows, vRows, cinfo->next_scanline, width);
+
+ for (int i = 0; i < 16; i++) {
+ // y row
+ y[i] = yPlanar + (cinfo->next_scanline + i) * fStrides[0];
+
+ // construct u row and v row
+ if ((i & 1) == 0) {
+ // height and width are both halved because of downsampling
+ int offset = (i >> 1) * (width >> 1);
+ cb[i/2] = uRows + offset;
+ cr[i/2] = vRows + offset;
+ }
+ }
+ jpeg_write_raw_data(cinfo, planes, 16);
+ }
+ delete [] uRows;
+ delete [] vRows;
+
+}
+
+void Yuv420SpToJpegEncoder::deinterleave(uint8_t* vuPlanar, uint8_t* uRows,
+ uint8_t* vRows, int rowIndex, int width) {
+ for (int row = 0; row < 8; ++row) {
+ int offset = ((rowIndex >> 1) + row) * fStrides[1];
+ uint8_t* vu = vuPlanar + offset;
+ for (int i = 0; i < (width >> 1); ++i) {
+ int index = row * (width >> 1) + i;
+ uRows[index] = vu[1];
+ vRows[index] = vu[0];
+ vu += 2;
+ }
+ }
+}
+
+void Yuv420SpToJpegEncoder::configSamplingFactors(jpeg_compress_struct* cinfo) {
+ // cb and cr are horizontally downsampled and vertically downsampled as well.
+ cinfo->comp_info[0].h_samp_factor = 2;
+ cinfo->comp_info[0].v_samp_factor = 2;
+ cinfo->comp_info[1].h_samp_factor = 1;
+ cinfo->comp_info[1].v_samp_factor = 1;
+ cinfo->comp_info[2].h_samp_factor = 1;
+ cinfo->comp_info[2].v_samp_factor = 1;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+Yuv422IToJpegEncoder::Yuv422IToJpegEncoder(int* strides) :
+ YuvToJpegEncoder(strides) {
+ fNumPlanes = 1;
+}
+
+void Yuv422IToJpegEncoder::compress(jpeg_compress_struct* cinfo,
+ uint8_t* yuv, int* offsets) {
+ SkDebugf("onFlyCompress_422");
+ JSAMPROW y[16];
+ JSAMPROW cb[16];
+ JSAMPROW cr[16];
+ JSAMPARRAY planes[3];
+ planes[0] = y;
+ planes[1] = cb;
+ planes[2] = cr;
+
+ int width = cinfo->image_width;
+ int height = cinfo->image_height;
+ uint8_t* yRows = new uint8_t [16 * width];
+ uint8_t* uRows = new uint8_t [16 * (width >> 1)];
+ uint8_t* vRows = new uint8_t [16 * (width >> 1)];
+
+ uint8_t* yuvOffset = yuv + offsets[0];
+
+ // process 16 lines of Y and 16 lines of U/V each time.
+ while (cinfo->next_scanline < cinfo->image_height) {
+ deinterleave(yuvOffset, yRows, uRows, vRows, cinfo->next_scanline, width, height);
+
+ for (int i = 0; i < 16; i++) {
+ // y row
+ y[i] = yRows + i * width;
+
+ // construct u row and v row
+ // width is halved because of downsampling
+ int offset = i * (width >> 1);
+ cb[i] = uRows + offset;
+ cr[i] = vRows + offset;
+ }
+
+ jpeg_write_raw_data(cinfo, planes, 16);
+ }
+ delete [] yRows;
+ delete [] uRows;
+ delete [] vRows;
+}
+
+
+void Yuv422IToJpegEncoder::deinterleave(uint8_t* yuv, uint8_t* yRows, uint8_t* uRows,
+ uint8_t* vRows, int rowIndex, int width, int height) {
+ for (int row = 0; row < 16; ++row) {
+ uint8_t* yuvSeg = yuv + (rowIndex + row) * fStrides[0];
+ for (int i = 0; i < (width >> 1); ++i) {
+ int indexY = row * width + (i << 1);
+ int indexU = row * (width >> 1) + i;
+ yRows[indexY] = yuvSeg[0];
+ yRows[indexY + 1] = yuvSeg[2];
+ uRows[indexU] = yuvSeg[1];
+ vRows[indexU] = yuvSeg[3];
+ yuvSeg += 4;
+ }
+ }
+}
+
+void Yuv422IToJpegEncoder::configSamplingFactors(jpeg_compress_struct* cinfo) {
+ // cb and cr are horizontally downsampled and vertically downsampled as well.
+ cinfo->comp_info[0].h_samp_factor = 2;
+ cinfo->comp_info[0].v_samp_factor = 2;
+ cinfo->comp_info[1].h_samp_factor = 1;
+ cinfo->comp_info[1].v_samp_factor = 2;
+ cinfo->comp_info[2].h_samp_factor = 1;
+ cinfo->comp_info[2].v_samp_factor = 2;
+}
+///////////////////////////////////////////////////////////////////////////////
+
+static jboolean YuvImage_compressToJpeg(JNIEnv* env, jobject, jbyteArray inYuv,
+ int format, int width, int height, jintArray offsets,
+ jintArray strides, int jpegQuality, jobject jstream,
+ jbyteArray jstorage) {
+ jbyte* yuv = env->GetByteArrayElements(inYuv, NULL);
+ SkWStream* strm = CreateJavaOutputStreamAdaptor(env, jstream, jstorage);
+
+ jint* imgOffsets = env->GetIntArrayElements(offsets, NULL);
+ jint* imgStrides = env->GetIntArrayElements(strides, NULL);
+ YuvToJpegEncoder* encoder = YuvToJpegEncoder::create(format, imgStrides);
+ if (encoder == NULL) {
+ return false;
+ }
+ encoder->encode(strm, yuv, width, height, imgOffsets, jpegQuality);
+
+ delete encoder;
+ env->ReleaseByteArrayElements(inYuv, yuv, 0);
+ env->ReleaseIntArrayElements(offsets, imgOffsets, 0);
+ env->ReleaseIntArrayElements(strides, imgStrides, 0);
+ return true;
+}
+///////////////////////////////////////////////////////////////////////////////
+
+#include <android_runtime/AndroidRuntime.h>
+
+static JNINativeMethod gYuvImageMethods[] = {
+ { "nativeCompressToJpeg", "([BIII[I[IILjava/io/OutputStream;[B)Z",
+ (void*)YuvImage_compressToJpeg }
+};
+
+#define kClassPathName "android/graphics/YuvImage"
+
+int register_android_graphics_YuvImage(JNIEnv* env);
+int register_android_graphics_YuvImage(JNIEnv* env)
+{
+ return android::AndroidRuntime::registerNativeMethods(env, kClassPathName,
+ gYuvImageMethods, SK_ARRAY_COUNT(gYuvImageMethods));
+}
diff --git a/core/jni/android/graphics/YuvToJpegEncoder.h b/core/jni/android/graphics/YuvToJpegEncoder.h
new file mode 100644
index 0000000..97106ce
--- /dev/null
+++ b/core/jni/android/graphics/YuvToJpegEncoder.h
@@ -0,0 +1,74 @@
+#ifndef YuvToJpegEncoder_DEFINED
+#define YuvToJpegEncoder_DEFINED
+
+#include "SkTypes.h"
+#include "SkStream.h"
+extern "C" {
+ #include "jpeglib.h"
+ #include "jerror.h"
+}
+
+class YuvToJpegEncoder {
+public:
+ /** Create an encoder based on the YUV format.
+ *
+ * @param pixelFormat The yuv pixel format as defined in ui/PixelFormat.h.
+ * @param strides The number of row bytes in each image plane.
+ * @return an encoder based on the pixelFormat.
+ */
+ static YuvToJpegEncoder* create(int pixelFormat, int* strides);
+
+ YuvToJpegEncoder(int* strides);
+
+ /** Encode YUV data to jpeg, which is output to a stream.
+ *
+ * @param stream The jpeg output stream.
+ * @param inYuv The input yuv data.
+ * @param width Width of the the Yuv data in terms of pixels.
+ * @param height Height of the Yuv data in terms of pixels.
+ * @param offsets The offsets in each image plane with respect to inYuv.
+ * @param jpegQuality Picture quality in [0, 100].
+ * @return true if successfully compressed the stream.
+ */
+ bool encode(SkWStream* stream, void* inYuv, int width,
+ int height, int* offsets, int jpegQuality);
+
+ virtual ~YuvToJpegEncoder() {}
+
+protected:
+ int fNumPlanes;
+ int* fStrides;
+ void setJpegCompressStruct(jpeg_compress_struct* cinfo, int width,
+ int height, int quality);
+ virtual void configSamplingFactors(jpeg_compress_struct* cinfo) = 0;
+ virtual void compress(jpeg_compress_struct* cinfo,
+ uint8_t* yuv, int* offsets) = 0;
+};
+
+class Yuv420SpToJpegEncoder : public YuvToJpegEncoder {
+public:
+ Yuv420SpToJpegEncoder(int* strides);
+ virtual ~Yuv420SpToJpegEncoder() {}
+
+private:
+ void configSamplingFactors(jpeg_compress_struct* cinfo);
+ void deinterleaveYuv(uint8_t* yuv, int width, int height,
+ uint8_t*& yPlanar, uint8_t*& uPlanar, uint8_t*& vPlanar);
+ void deinterleave(uint8_t* vuPlanar, uint8_t* uRows, uint8_t* vRows,
+ int rowIndex, int width);
+ void compress(jpeg_compress_struct* cinfo, uint8_t* yuv, int* offsets);
+};
+
+class Yuv422IToJpegEncoder : public YuvToJpegEncoder {
+public:
+ Yuv422IToJpegEncoder(int* strides);
+ virtual ~Yuv422IToJpegEncoder() {}
+
+private:
+ void configSamplingFactors(jpeg_compress_struct* cinfo);
+ void compress(jpeg_compress_struct* cinfo, uint8_t* yuv, int* offsets);
+ void deinterleave(uint8_t* yuv, uint8_t* yRows, uint8_t* uRows,
+ uint8_t* vRows, int rowIndex, int width, int height);
+};
+
+#endif
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index 64ee4f0..1a5987c 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -546,6 +546,18 @@
}
}
+static void android_hardware_Camera_setDisplayOrientation(JNIEnv *env, jobject thiz,
+ jint value)
+{
+ LOGV("setDisplayOrientation");
+ sp<Camera> camera = get_native_camera(env, thiz, NULL);
+ if (camera == 0) return;
+
+ if (camera->sendCommand(CAMERA_CMD_SET_DISPLAY_ORIENTATION, value, 0) != NO_ERROR) {
+ jniThrowException(env, "java/lang/RuntimeException", "set display orientation failed");
+ }
+}
+
//-------------------------------------------------
static JNINativeMethod camMethods[] = {
@@ -603,6 +615,9 @@
{ "stopSmoothZoom",
"()V",
(void *)android_hardware_Camera_stopSmoothZoom },
+ { "setDisplayOrientation",
+ "(I)V",
+ (void *)android_hardware_Camera_setDisplayOrientation },
};
struct field {
diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp
index 3d8d296..3995026 100644
--- a/core/jni/android_media_AudioSystem.cpp
+++ b/core/jni/android_media_AudioSystem.cpp
@@ -64,10 +64,10 @@
}
static jboolean
-android_media_AudioSystem_isMusicActive(JNIEnv *env, jobject thiz)
+android_media_AudioSystem_isStreamActive(JNIEnv *env, jobject thiz, jint stream)
{
bool state = false;
- AudioSystem::isMusicActive(&state);
+ AudioSystem::isStreamActive(stream, &state);
return state;
}
@@ -195,7 +195,7 @@
{"getParameters", "(Ljava/lang/String;)Ljava/lang/String;", (void *)android_media_AudioSystem_getParameters},
{"muteMicrophone", "(Z)I", (void *)android_media_AudioSystem_muteMicrophone},
{"isMicrophoneMuted", "()Z", (void *)android_media_AudioSystem_isMicrophoneMuted},
- {"isMusicActive", "()Z", (void *)android_media_AudioSystem_isMusicActive},
+ {"isStreamActive", "(I)Z", (void *)android_media_AudioSystem_isStreamActive},
{"setDeviceConnectionState", "(IILjava/lang/String;)I", (void *)android_media_AudioSystem_setDeviceConnectionState},
{"getDeviceConnectionState", "(ILjava/lang/String;)I", (void *)android_media_AudioSystem_getDeviceConnectionState},
{"setPhoneState", "(I)I", (void *)android_media_AudioSystem_setPhoneState},
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index d81476a..54e15a5 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -700,6 +700,46 @@
android:label="@string/permlab_mount_format_filesystems"
android:description="@string/permdesc_mount_format_filesystems" />
+ <!-- Allows access to ASEC non-destructive API calls
+ @hide -->
+ <permission android:name="android.permission.ASEC_ACCESS"
+ android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+ android:protectionLevel="dangerous"
+ android:label="@string/permlab_asec_access"
+ android:description="@string/permdesc_asec_access" />
+
+ <!-- Allows creation of ASEC volumes
+ @hide -->
+ <permission android:name="android.permission.ASEC_CREATE"
+ android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+ android:protectionLevel="dangerous"
+ android:label="@string/permlab_asec_create"
+ android:description="@string/permdesc_asec_create" />
+
+ <!-- Allows destruction of ASEC volumes
+ @hide -->
+ <permission android:name="android.permission.ASEC_DESTROY"
+ android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+ android:protectionLevel="dangerous"
+ android:label="@string/permlab_asec_destroy"
+ android:description="@string/permdesc_asec_destroy" />
+
+ <!-- Allows mount / unmount of ASEC volumes
+ @hide -->
+ <permission android:name="android.permission.ASEC_MOUNT_UNMOUNT"
+ android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+ android:protectionLevel="dangerous"
+ android:label="@string/permlab_asec_mount_unmount"
+ android:description="@string/permdesc_asec_mount_unmount" />
+
+ <!-- Allows rename of ASEC volumes
+ @hide -->
+ <permission android:name="android.permission.ASEC_RENAME"
+ android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+ android:protectionLevel="dangerous"
+ android:label="@string/permlab_asec_rename"
+ android:description="@string/permdesc_asec_rename" />
+
<!-- Allows applications to disable the keyguard -->
<permission android:name="android.permission.DISABLE_KEYGUARD"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
@@ -1162,6 +1202,16 @@
android:description="@string/permdesc_cache_filesystem"
android:protectionLevel="signatureOrSystem" />
+ <!-- Must be required by default container service so that only
+ the system can bind to it and use it to copy
+ protected data to secure containers or files
+ accessible to the system.
+ @hide -->
+ <permission android:name="android.permission.COPY_PROTECTED_DATA"
+ android:label="@string/permlab_copyProtectedData"
+ android:description="@string/permlab_copyProtectedData"
+ android:protectionLevel="signature" />
+
<application android:process="system"
android:persistent="true"
android:hasCode="false"
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index 016900d..22cdd2c 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Není vložena SIM karta."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"V telefonu není žádná karta SIM."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Prosím vložte kartu SIM."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Pouze tísňová volání"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Síť je blokována"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"Karta SIM je zablokována pomocí kódu PUK."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Další informace naleznete v uživatelské příručce, nebo kontaktujte podporu zákazníků."</string>
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index 61ee2e7..4e49363 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Der er ikke noget SIM-kort."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Der er ikke noget SIM-kort i telefonen."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Indsæt et SIM-kort."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Kun nødopkald"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Netværket er låst"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"SIM-kortet er låst med PUK-koden."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Se brugervejledningen, eller kontakt kundeservice."</string>
diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml
index 9ad1614..a52e8bf 100644
--- a/core/res/res/values-de/strings.xml
+++ b/core/res/res/values-de/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Keine SIM-Karte."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Keine SIM-Karte im Telefon."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Bitte legen Sie eine SIM-Karte ein."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Nur Notrufe"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Netzwerk gesperrt"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"SIM-Karte ist gesperrt. PUK-Eingabe erforderlich."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Weitere Informationen finden Sie in der Bedienungsanleitung oder wenden Sie sich an den Kundendienst."</string>
diff --git a/core/res/res/values-el/strings.xml b/core/res/res/values-el/strings.xml
index 33a3a41..a55dded 100644
--- a/core/res/res/values-el/strings.xml
+++ b/core/res/res/values-el/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Δεν υπάρχει κάρτα SIM."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Δεν υπάρχει κάρτα SIM στο τηλέφωνο."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Τοποθετήστε μια κάρτα SIM."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Μόνο κλήσεις έκτακτης ανάγκης"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Το δίκτυο κλειδώθηκε"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"Η κάρτα SIM είναι κλειδωμένη με κωδικό PUK."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Ανατρέξτε στον οδηγό χρήσης ή επικοινωνήστε με την εξυπηρέτηση πελατών."</string>
diff --git a/core/res/res/values-es-rUS/strings.xml b/core/res/res/values-es-rUS/strings.xml
index 806d64e..b2aaa7d3 100644
--- a/core/res/res/values-es-rUS/strings.xml
+++ b/core/res/res/values-es-rUS/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"No hay tarjeta SIM."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"No hay tarjeta SIM en el teléfono."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Inserta una tarjeta SIM."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Sólo llamadas de emergencia"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Red bloqueada"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"La tarjeta SIM está bloqueada con PUK."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Consulta la guía del usuario o comunícate con el servicio de atención al cliente."</string>
diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml
index 4626326..032fbdc 100644
--- a/core/res/res/values-es/strings.xml
+++ b/core/res/res/values-es/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Falta la tarjeta SIM"</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"No se ha insertado ninguna tarjeta SIM en el teléfono."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Inserta una tarjeta SIM."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Sólo llamadas de emergencia"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Bloqueada para la red"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"La tarjeta SIM está bloqueada con el código PUK."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Consulta la guía del usuario o ponte en contacto con el servicio de atención al cliente."</string>
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index d46820a..3679fd2 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Aucune carte SIM n\'a été trouvée."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Aucune carte SIM n\'est insérée dans le téléphone."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Insérez une carte SIM."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Appels d\'urgence uniquement"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Réseau verrouillé"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"La carte SIM est verrouillée par clé PUK."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Veuillez consulter le guide d\'utilisation ou contacter l\'assistance clientèle."</string>
diff --git a/core/res/res/values-it/strings.xml b/core/res/res/values-it/strings.xml
index ff6107a..58229dd 100644
--- a/core/res/res/values-it/strings.xml
+++ b/core/res/res/values-it/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Nessuna SIM presente."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Nessuna SIM presente nel telefono."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Inserisci una SIM."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Solo chiamate di emergenza"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Rete bloccata"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"La SIM è bloccata tramite PUK."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Consulta il Manuale utente o contatta il servizio clienti."</string>
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index 31c823c..b6ac84e 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"SIMカードが挿入されていません"</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"SIMカードが挿入されていません"</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"SIMカードを挿入してください。"</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"緊急通報のみ"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"ネットワークがロックされました"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"SIMカードはPUKでロックされています。"</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"ユーザーガイドを参照するか、お客様サポートにお問い合わせください。"</string>
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index 8afa494..222139b 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"SIM 카드가 없습니다."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"휴대전화에 SIM 카드가 없습니다."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"SIM 카드를 삽입하세요."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"비상 전화만"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"네트워크 잠김"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"SIM 카드의 PUK가 잠겨 있습니다."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"사용자 가이드를 참조하거나 고객지원팀에 문의하세요."</string>
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index ed4f596..8eb3463 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Mangler SIM-kort."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Ikke noe SIM-kort i telefonen."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Sett inn et SIM-kort."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Kun nødsamtaler"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Nettverk ikke tillatt"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"SIM-kortet er PUK-låst."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Se manualen eller kontakt kundeservice."</string>
diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml
index a6ebcde..aad7744 100644
--- a/core/res/res/values-nl/strings.xml
+++ b/core/res/res/values-nl/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Geen SIM-kaart."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Geen SIM-kaart in telefoon."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Plaats een SIM-kaart."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Alleen noodoproepen"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Netwerk vergrendeld"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"SIM-kaart is vergrendeld met PUK-code."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Raadpleeg de gebruikershandleiding of neem contact op met de klantenservice."</string>
diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml
index 6d0539e..ce7ade5 100644
--- a/core/res/res/values-pl/strings.xml
+++ b/core/res/res/values-pl/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Brak karty SIM."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Brak karty SIM w telefonie."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Włóż kartę SIM."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Tylko połączenia alarmowe"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Sieć zablokowana"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"Karta SIM jest zablokowana kodem PUK."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Zapoznaj się z instrukcją obsługi lub skontaktuj się z działem obsługi klienta."</string>
diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml
index 1872cb4..e4e0d64 100644
--- a/core/res/res/values-pt-rPT/strings.xml
+++ b/core/res/res/values-pt-rPT/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Nenhum cartão SIM."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Nenhum cartão SIM no telefone."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Introduza um cartão SIM."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Apenas chamadas de emergência"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Rede bloqueada"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"O cartão SIM está bloqueado por PUK"</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Consulte o Manual de utilizador ou contacte a Assistência a clientes."</string>
diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml
index 6841fec..f81f332 100644
--- a/core/res/res/values-pt/strings.xml
+++ b/core/res/res/values-pt/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Sem cartão SIM."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Não há um cartão SIM no telefone."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Insira um cartão SIM."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Apenas chamadas de emergência"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Rede bloqueada"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"O cartão SIM está bloqueado pelo PUK."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Consulte o Guia do Usuário ou entre em contato com o Serviço de atendimento ao cliente."</string>
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index 0fa02dc..3864283 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Нет SIM-карты."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"SIM-карта не установлена."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Вставьте SIM-карту."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Только вызовы службы экстренной помощи"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Сеть заблокирована"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"SIM-карта заблокирована с помощью кода PUK."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"См. руководство пользователя или свяжитесь со службой поддержки."</string>
diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml
index 313073f..1737414 100644
--- a/core/res/res/values-sv/strings.xml
+++ b/core/res/res/values-sv/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Inget SIM-kort."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Inget SIM-kort i telefonen."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Sätt i ett SIM-kort."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Endast nödsamtal"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Nätverk låst"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"SIM-kortet är PUK-låst."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Se användarhandboken eller kontakta Kundtjänst."</string>
diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml
index d7a02bc..26ac5b0 100644
--- a/core/res/res/values-tr/strings.xml
+++ b/core/res/res/values-tr/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"SIM kart yok."</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Telefonda SIM kart yok."</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Lütfen SIM kart takın."</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"Yalnızca acil çağrılar için"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"Ağ kilitli"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"SIM kart PUK kilidi devrede."</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Lütfen Kullanıcı Rehberi\'ne bakın veya Müşteri Hizmetleri\'ne başvurun."</string>
diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml
index 3f3549b..5be8676 100644
--- a/core/res/res/values-zh-rCN/strings.xml
+++ b/core/res/res/values-zh-rCN/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"没有 SIM 卡"</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"手机中无 SIM 卡"</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"请插入 SIM 卡"</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"仅限于急救或报警电话"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"网络已锁定"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"SIM 卡已用 PUK 码锁定"</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"请参阅《用户指南》或联系客服人员。"</string>
diff --git a/core/res/res/values-zh-rTW/strings.xml b/core/res/res/values-zh-rTW/strings.xml
index ee31333..d500b51 100644
--- a/core/res/res/values-zh-rTW/strings.xml
+++ b/core/res/res/values-zh-rTW/strings.xml
@@ -513,6 +513,7 @@
<string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"沒有 SIM 卡。"</string>
<string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"手機未插入 SIM 卡。"</string>
<string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"請插入 SIM 卡。"</string>
+ <string name="emergency_calls_only" msgid="6733978304386365407">"只能撥打緊急電話"</string>
<string name="lockscreen_network_locked_message" msgid="143389224986028501">"網路已鎖定"</string>
<string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"SIM 的 PUK 已鎖定。"</string>
<string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"請參閱《使用者指南》或聯絡客戶服務中心。"</string>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 287e3a0..794a9f0 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1394,7 +1394,7 @@
be a dimension (such as "12dip") for a constant width or one of
the special constants. -->
<attr name="layout_width" format="dimension">
- <!-- {@deprecated Use match_parent instead.} -->
+ <!-- <strong>Deprecated.</strong> Use {@code match_parent} instead. -->
<enum name="fill_parent" value="-1" />
<!-- The view should be as big as its parent (minus padding). -->
<enum name="match_parent" value="-1" />
@@ -1407,7 +1407,7 @@
be a dimension (such as "12dip") for a constant height or one of
the special constants. -->
<attr name="layout_height" format="dimension">
- <!-- {@deprecated Use match_parent instead.} -->
+ <!-- <strong>Deprecated.</strong> Use {@code match_parent} instead. -->
<enum name="fill_parent" value="-1" />
<!-- The view should be as big as its parent (minus padding). -->
<enum name="match_parent" value="-1" />
@@ -2122,7 +2122,7 @@
to match the width of the screen, or wrap_content to match the width
of the anchored view. -->
<attr name="dropDownWidth" format="dimension">
- <!-- {@deprecated Use match_parent instead.} -->
+ <!-- <strong>Deprecated.</strong> Use {@code match_parent} instead. -->
<enum name="fill_parent" value="-1" />
<!-- The dropdown should fit the width of the screen. -->
<enum name="match_parent" value="-1" />
@@ -2134,7 +2134,7 @@
to fill the width of the screen, or wrap_content to match the height of
the content of the drop down. -->
<attr name="dropDownHeight" format="dimension">
- <!-- {@deprecated Use match_parent instead.} -->
+ <!-- <strong>Deprecated.</strong> Use {@code match_parent} instead. -->
<enum name="fill_parent" value="-1" />
<!-- The dropdown should fill the width of the screen. -->
<enum name="match_parent" value="-1" />
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index c6ef3a0..7728c50 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -938,6 +938,7 @@
is a period then it is appended to your package name. -->
<attr name="name" />
<attr name="label" />
+ <attr name="description" />
<attr name="icon" />
<attr name="process" />
<attr name="authorities" />
@@ -1016,6 +1017,7 @@
is a period then it is appended to your package name. -->
<attr name="name" />
<attr name="label" />
+ <attr name="description" />
<attr name="icon" />
<attr name="permission" />
<attr name="process" />
@@ -1047,6 +1049,7 @@
is a period then it is appended to your package name. -->
<attr name="name" />
<attr name="label" />
+ <attr name="description" />
<attr name="icon" />
<attr name="permission" />
<attr name="process" />
@@ -1078,6 +1081,7 @@
<attr name="name" />
<attr name="theme" />
<attr name="label" />
+ <attr name="description" />
<attr name="icon" />
<attr name="launchMode" />
<attr name="screenOrientation" />
@@ -1130,6 +1134,7 @@
"com.mycompany.MyName". -->
<attr name="targetActivity" format="string" />
<attr name="label" />
+ <attr name="description" />
<attr name="icon" />
<attr name="permission" />
<!-- Specify whether the activity-alias is enabled or not (that is, can be instantiated by the system).
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 265dacd..42553d4 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -877,6 +877,31 @@
<string name="permdesc_mount_format_filesystems">Allows the application to format removable storage.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_asec_access">get information on secure storage</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_asec_access">Allows the application to get information on secure storage.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_asec_create">create secure storage</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_asec_create">Allows the application to create secure storage.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_asec_destroy">destroy secure storage</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_asec_destroy">Allows the application to destroy secure storage.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_asec_mount_unmount">mount / unmount secure storage</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_asec_mount_unmount">Allows the application to mount / unmount secure storage.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_asec_rename">rename secure storage</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_asec_rename">Allows the application to rename secure storage.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_vibrate">control vibrator</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_vibrate">Allows the application to control
@@ -1157,6 +1182,40 @@
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_cache_filesystem">Allows an application to read and write the cache filesystem.</string>
+ <!-- Policy administration -->
+
+ <!-- Title of policy access to limiting the user's password choices -->
+ <string name="policylab_limitPassword">Limit password</string>
+ <!-- Description of policy access to limiting the user's password choices -->
+ <string name="policydesc_limitPassword">Restrict the types of passwords you
+ are allowed to use.</string>
+ <!-- Title of policy access to watch user login attempts -->
+ <string name="policylab_watchLogin">Watch login attempts</string>
+ <!-- Description of policy access to watch user login attempts -->
+ <string name="policydesc_watchLogin">Monitor failed attempts to login to
+ the device, to perform some action.</string>
+ <!-- Title of policy access to reset user's password -->
+ <string name="policylab_resetPassword">Reset password</string>
+ <!-- Description of policy access to reset user's password -->
+ <string name="policydesc_resetPassword">Force your password
+ to a new value, requiring the administrator give it to you
+ before you can log in.</string>
+ <!-- Title of policy access to limiting the user's unlock timeout -->
+ <string name="policylab_limitUnlock">Limit lock timeout</string>
+ <!-- Description of policy access to limiting the user's unlock timeout -->
+ <string name="policydesc_limitUnlock">Restrict the unlock timeout
+ durations you can select.</string>
+ <!-- Title of policy access to force lock the device -->
+ <string name="policylab_forceLock">Force lock</string>
+ <!-- Description of policy access to limiting the user's password choices -->
+ <string name="policydesc_forceLock">Force the device to immediately lock,
+ requiring that you re-enter its password.</string>
+ <!-- Title of policy access to wipe the user's data -->
+ <string name="policylab_wipeData">Erase all data</string>
+ <!-- Description of policy access to wipe the user's data -->
+ <string name="policydesc_wipeData">Perform a factory reset, deleting
+ all of your data without any confirmation.</string>
+
<!-- The order of these is important, don't reorder without changing Contacts.java --> <skip />
<!-- Phone number types from android.provider.Contacts. This could be used when adding a new phone number for a contact, for example. -->
<string-array name="phoneTypes">
@@ -1394,6 +1453,8 @@
<!-- Shown in the lock screen to ask the user to insert a SIM card. -->
<string name="lockscreen_missing_sim_instructions">Please insert a SIM card.</string>
+ <!-- Shown in the lock screen when there is emergency calls only mode. -->
+ <string name="emergency_calls_only" msgid="2485604591272668370">Emergency calls only</string>
<!-- When the user inserts a sim card from an unsupported network, it becomes network
locked -->
@@ -2043,6 +2104,12 @@
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_pkgUsageStats">Allows the modification of collected component usage statistics. Not for use by normal applications.</string>
+ <!-- permission attributes related to default container service -->
+ <!-- Title of an application permission that lets an application use default container service. -->
+ <string name="permlab_copyProtectedData">Allows to invoke default container service to copy content. Not for use by normal applications.</string>
+ <!-- Description of an application permission, used to invoke default container service to copy content. -->
+ <string name="permdesc_copyProtectedData">Allows to invoke default container service to copy content. Not for use by normal applications.</string>
+
<!-- Shown in the tutorial for tap twice for zoom control. -->
<string name="tutorial_double_tap_to_zoom_message_short">Tap twice for zoom control</string>
diff --git a/core/tests/coretests/Android.mk b/core/tests/coretests/Android.mk
new file mode 100644
index 0000000..77c176f
--- /dev/null
+++ b/core/tests/coretests/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 := FrameworksCoreTests
+
+include $(BUILD_PACKAGE)
+
diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml
new file mode 100644
index 0000000..02961f4
--- /dev/null
+++ b/core/tests/coretests/AndroidManifest.xml
@@ -0,0 +1,984 @@
+<?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.coretests">
+ <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" />
+
+ <!-- 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" />
+
+ <application android:theme="@style/Theme">
+ <uses-library android:name="android.test.runner" />
+ <activity android:name="StubTestBrowserActivity" android:label="Stubbed Test Browser">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.FOR_TESTS_ONLY"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:name="android.test.TestBrowserTests" android:label="Test Browser Tests">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.UNIT_TEST"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:name="android.widget.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="android.widget.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="android.widget.focus.RequestFocus" android:label="RequestFocus">
+ <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.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.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="android.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="android.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="android.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="android.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="android.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="android.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="android.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="android.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="android.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="android.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="android.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.widget.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="android.view.menu.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="android.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="android.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="android.view.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="android.view.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="android.view.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="android.app.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="android.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="android.widget.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="android.widget.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="android.view.menu.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="android.view.menu.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="android.widget.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="android.widget.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="android.os.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="android.accessibility.AccessibilityTestService">
+ <intent-filter>
+ <action android:name="android.accessibilityservice.AccessibilityService" />
+ </intent-filter>
+ </service>
+
+ <activity android:name="android.widget.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>
+
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.android.frameworks.coretests"
+ android:label="Frameworks Core Tests" />
+</manifest>
diff --git a/tests/FrameworkTest/res/drawable-hdpi/big_drawable_background.9.png b/core/tests/coretests/res/drawable-hdpi/big_drawable_background.9.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-hdpi/big_drawable_background.9.png
rename to core/tests/coretests/res/drawable-hdpi/big_drawable_background.9.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-hdpi/black_square.png b/core/tests/coretests/res/drawable-hdpi/black_square.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-hdpi/black_square.png
rename to core/tests/coretests/res/drawable-hdpi/black_square.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-hdpi/black_square_stretchable.9.png b/core/tests/coretests/res/drawable-hdpi/black_square_stretchable.9.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-hdpi/black_square_stretchable.9.png
rename to core/tests/coretests/res/drawable-hdpi/black_square_stretchable.9.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-hdpi/drawable_background.9.png b/core/tests/coretests/res/drawable-hdpi/drawable_background.9.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-hdpi/drawable_background.9.png
rename to core/tests/coretests/res/drawable-hdpi/drawable_background.9.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-hdpi/sym_now_playing_pause_1.png b/core/tests/coretests/res/drawable-hdpi/sym_now_playing_pause_1.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-hdpi/sym_now_playing_pause_1.png
rename to core/tests/coretests/res/drawable-hdpi/sym_now_playing_pause_1.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-hdpi/sym_now_playing_skip_backward_1.png b/core/tests/coretests/res/drawable-hdpi/sym_now_playing_skip_backward_1.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-hdpi/sym_now_playing_skip_backward_1.png
rename to core/tests/coretests/res/drawable-hdpi/sym_now_playing_skip_backward_1.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-hdpi/sym_now_playing_skip_forward_1.png b/core/tests/coretests/res/drawable-hdpi/sym_now_playing_skip_forward_1.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-hdpi/sym_now_playing_skip_forward_1.png
rename to core/tests/coretests/res/drawable-hdpi/sym_now_playing_skip_forward_1.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-mdpi/big_drawable_background.9.png b/core/tests/coretests/res/drawable-mdpi/big_drawable_background.9.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-mdpi/big_drawable_background.9.png
rename to core/tests/coretests/res/drawable-mdpi/big_drawable_background.9.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-mdpi/black_square.png b/core/tests/coretests/res/drawable-mdpi/black_square.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-mdpi/black_square.png
rename to core/tests/coretests/res/drawable-mdpi/black_square.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-mdpi/black_square_stretchable.9.png b/core/tests/coretests/res/drawable-mdpi/black_square_stretchable.9.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-mdpi/black_square_stretchable.9.png
rename to core/tests/coretests/res/drawable-mdpi/black_square_stretchable.9.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-mdpi/drawable_background.9.png b/core/tests/coretests/res/drawable-mdpi/drawable_background.9.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-mdpi/drawable_background.9.png
rename to core/tests/coretests/res/drawable-mdpi/drawable_background.9.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-mdpi/sym_now_playing_pause_1.png b/core/tests/coretests/res/drawable-mdpi/sym_now_playing_pause_1.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-mdpi/sym_now_playing_pause_1.png
rename to core/tests/coretests/res/drawable-mdpi/sym_now_playing_pause_1.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-mdpi/sym_now_playing_skip_backward_1.png b/core/tests/coretests/res/drawable-mdpi/sym_now_playing_skip_backward_1.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-mdpi/sym_now_playing_skip_backward_1.png
rename to core/tests/coretests/res/drawable-mdpi/sym_now_playing_skip_backward_1.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable-mdpi/sym_now_playing_skip_forward_1.png b/core/tests/coretests/res/drawable-mdpi/sym_now_playing_skip_forward_1.png
similarity index 100%
rename from tests/FrameworkTest/res/drawable-mdpi/sym_now_playing_skip_forward_1.png
rename to core/tests/coretests/res/drawable-mdpi/sym_now_playing_skip_forward_1.png
Binary files differ
diff --git a/tests/FrameworkTest/res/drawable/bitmap_drawable.xml b/core/tests/coretests/res/drawable/bitmap_drawable.xml
similarity index 100%
rename from tests/FrameworkTest/res/drawable/bitmap_drawable.xml
rename to core/tests/coretests/res/drawable/bitmap_drawable.xml
diff --git a/tests/FrameworkTest/res/drawable/box.xml b/core/tests/coretests/res/drawable/box.xml
similarity index 100%
rename from tests/FrameworkTest/res/drawable/box.xml
rename to core/tests/coretests/res/drawable/box.xml
diff --git a/tests/FrameworkTest/res/layout/add_column_in_table.xml b/core/tests/coretests/res/layout/add_column_in_table.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/add_column_in_table.xml
rename to core/tests/coretests/res/layout/add_column_in_table.xml
diff --git a/tests/FrameworkTest/res/layout/autocompletetextview_simple.xml b/core/tests/coretests/res/layout/autocompletetextview_simple.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/autocompletetextview_simple.xml
rename to core/tests/coretests/res/layout/autocompletetextview_simple.xml
diff --git a/tests/FrameworkTest/res/layout/baseline_0width_and_weight.xml b/core/tests/coretests/res/layout/baseline_0width_and_weight.xml
similarity index 96%
rename from tests/FrameworkTest/res/layout/baseline_0width_and_weight.xml
rename to core/tests/coretests/res/layout/baseline_0width_and_weight.xml
index aa3132d..acbb10b 100644
--- a/tests/FrameworkTest/res/layout/baseline_0width_and_weight.xml
+++ b/core/tests/coretests/res/layout/baseline_0width_and_weight.xml
@@ -26,7 +26,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone">
- <com.android.frameworktest.layout.linear.ExceptionTextView
+ <android.widget.layout.linear.ExceptionTextView
android:id="@+id/routeToField"
android:textSize="16sp"
android:layout_width="0dip"
diff --git a/tests/FrameworkTest/res/layout/baseline_buttons.xml b/core/tests/coretests/res/layout/baseline_buttons.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/baseline_buttons.xml
rename to core/tests/coretests/res/layout/baseline_buttons.xml
diff --git a/tests/FrameworkTest/res/layout/baseline_center_gravity.xml b/core/tests/coretests/res/layout/baseline_center_gravity.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/baseline_center_gravity.xml
rename to core/tests/coretests/res/layout/baseline_center_gravity.xml
diff --git a/tests/FrameworkTest/res/layout/brightness_limit.xml b/core/tests/coretests/res/layout/brightness_limit.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/brightness_limit.xml
rename to core/tests/coretests/res/layout/brightness_limit.xml
diff --git a/tests/FrameworkTest/res/layout/descendant_focusability.xml b/core/tests/coretests/res/layout/descendant_focusability.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/descendant_focusability.xml
rename to core/tests/coretests/res/layout/descendant_focusability.xml
diff --git a/tests/FrameworkTest/res/layout/disabled.xml b/core/tests/coretests/res/layout/disabled.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/disabled.xml
rename to core/tests/coretests/res/layout/disabled.xml
diff --git a/tests/FrameworkTest/res/layout/drawable_background_minimum_size.xml b/core/tests/coretests/res/layout/drawable_background_minimum_size.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/drawable_background_minimum_size.xml
rename to core/tests/coretests/res/layout/drawable_background_minimum_size.xml
diff --git a/tests/FrameworkTest/res/layout/fill_in_wrap.xml b/core/tests/coretests/res/layout/fill_in_wrap.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/fill_in_wrap.xml
rename to core/tests/coretests/res/layout/fill_in_wrap.xml
diff --git a/tests/FrameworkTest/res/layout/focus_after_removal.xml b/core/tests/coretests/res/layout/focus_after_removal.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/focus_after_removal.xml
rename to core/tests/coretests/res/layout/focus_after_removal.xml
diff --git a/tests/FrameworkTest/res/layout/focus_listener.xml b/core/tests/coretests/res/layout/focus_listener.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/focus_listener.xml
rename to core/tests/coretests/res/layout/focus_listener.xml
diff --git a/tests/FrameworkTest/res/layout/framelayout_gravity.xml b/core/tests/coretests/res/layout/framelayout_gravity.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/framelayout_gravity.xml
rename to core/tests/coretests/res/layout/framelayout_gravity.xml
diff --git a/tests/FrameworkTest/res/layout/framelayout_margin.xml b/core/tests/coretests/res/layout/framelayout_margin.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/framelayout_margin.xml
rename to core/tests/coretests/res/layout/framelayout_margin.xml
diff --git a/tests/FrameworkTest/res/layout/grid_in_horizontal.xml b/core/tests/coretests/res/layout/grid_in_horizontal.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/grid_in_horizontal.xml
rename to core/tests/coretests/res/layout/grid_in_horizontal.xml
diff --git a/tests/FrameworkTest/res/layout/grid_in_vertical.xml b/core/tests/coretests/res/layout/grid_in_vertical.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/grid_in_vertical.xml
rename to core/tests/coretests/res/layout/grid_in_vertical.xml
diff --git a/tests/FrameworkTest/res/layout/grid_padding.xml b/core/tests/coretests/res/layout/grid_padding.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/grid_padding.xml
rename to core/tests/coretests/res/layout/grid_padding.xml
diff --git a/tests/FrameworkTest/res/layout/grid_scroll_listener.xml b/core/tests/coretests/res/layout/grid_scroll_listener.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/grid_scroll_listener.xml
rename to core/tests/coretests/res/layout/grid_scroll_listener.xml
diff --git a/tests/FrameworkTest/res/layout/grid_thrasher.xml b/core/tests/coretests/res/layout/grid_thrasher.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/grid_thrasher.xml
rename to core/tests/coretests/res/layout/grid_thrasher.xml
diff --git a/tests/FrameworkTest/res/layout/include_button.xml b/core/tests/coretests/res/layout/include_button.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/include_button.xml
rename to core/tests/coretests/res/layout/include_button.xml
diff --git a/tests/FrameworkTest/res/layout/include_button_with_size.xml b/core/tests/coretests/res/layout/include_button_with_size.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/include_button_with_size.xml
rename to core/tests/coretests/res/layout/include_button_with_size.xml
diff --git a/tests/FrameworkTest/res/layout/include_tag.xml b/core/tests/coretests/res/layout/include_tag.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/include_tag.xml
rename to core/tests/coretests/res/layout/include_tag.xml
diff --git a/tests/FrameworkTest/res/layout/inflated_expandablelistview.xml b/core/tests/coretests/res/layout/inflated_expandablelistview.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/inflated_expandablelistview.xml
rename to core/tests/coretests/res/layout/inflated_expandablelistview.xml
diff --git a/tests/FrameworkTest/res/layout/linear_layout_buttons.xml b/core/tests/coretests/res/layout/linear_layout_buttons.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/linear_layout_buttons.xml
rename to core/tests/coretests/res/layout/linear_layout_buttons.xml
diff --git a/tests/FrameworkTest/res/layout/linear_layout_edittext_then_button.xml b/core/tests/coretests/res/layout/linear_layout_edittext_then_button.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/linear_layout_edittext_then_button.xml
rename to core/tests/coretests/res/layout/linear_layout_edittext_then_button.xml
diff --git a/tests/FrameworkTest/res/layout/linear_layout_grid.xml b/core/tests/coretests/res/layout/linear_layout_grid.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/linear_layout_grid.xml
rename to core/tests/coretests/res/layout/linear_layout_grid.xml
diff --git a/tests/FrameworkTest/res/layout/linear_layout_listview_height.xml b/core/tests/coretests/res/layout/linear_layout_listview_height.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/linear_layout_listview_height.xml
rename to core/tests/coretests/res/layout/linear_layout_listview_height.xml
diff --git a/tests/FrameworkTest/res/layout/linear_layout_spinner_then_button.xml b/core/tests/coretests/res/layout/linear_layout_spinner_then_button.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/linear_layout_spinner_then_button.xml
rename to core/tests/coretests/res/layout/linear_layout_spinner_then_button.xml
diff --git a/tests/FrameworkTest/res/layout/linear_layout_textviews.xml b/core/tests/coretests/res/layout/linear_layout_textviews.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/linear_layout_textviews.xml
rename to core/tests/coretests/res/layout/linear_layout_textviews.xml
diff --git a/tests/FrameworkTest/res/layout/linear_layout_weight.xml b/core/tests/coretests/res/layout/linear_layout_weight.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/linear_layout_weight.xml
rename to core/tests/coretests/res/layout/linear_layout_weight.xml
diff --git a/tests/FrameworkTest/res/layout/list_dividers.xml b/core/tests/coretests/res/layout/list_dividers.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/list_dividers.xml
rename to core/tests/coretests/res/layout/list_dividers.xml
diff --git a/tests/FrameworkTest/res/layout/list_filter.xml b/core/tests/coretests/res/layout/list_filter.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/list_filter.xml
rename to core/tests/coretests/res/layout/list_filter.xml
diff --git a/tests/FrameworkTest/res/layout/list_in_horizontal.xml b/core/tests/coretests/res/layout/list_in_horizontal.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/list_in_horizontal.xml
rename to core/tests/coretests/res/layout/list_in_horizontal.xml
diff --git a/tests/FrameworkTest/res/layout/list_in_vertical.xml b/core/tests/coretests/res/layout/list_in_vertical.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/list_in_vertical.xml
rename to core/tests/coretests/res/layout/list_in_vertical.xml
diff --git a/tests/FrameworkTest/res/layout/list_recycler_profiling.xml b/core/tests/coretests/res/layout/list_recycler_profiling.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/list_recycler_profiling.xml
rename to core/tests/coretests/res/layout/list_recycler_profiling.xml
diff --git a/tests/FrameworkTest/res/layout/list_scroll_listener.xml b/core/tests/coretests/res/layout/list_scroll_listener.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/list_scroll_listener.xml
rename to core/tests/coretests/res/layout/list_scroll_listener.xml
diff --git a/tests/FrameworkTest/res/layout/list_take_focus_from_side.xml b/core/tests/coretests/res/layout/list_take_focus_from_side.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/list_take_focus_from_side.xml
rename to core/tests/coretests/res/layout/list_take_focus_from_side.xml
diff --git a/tests/FrameworkTest/res/layout/list_thrasher.xml b/core/tests/coretests/res/layout/list_thrasher.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/list_thrasher.xml
rename to core/tests/coretests/res/layout/list_thrasher.xml
diff --git a/tests/FrameworkTest/res/layout/list_with_button_above.xml b/core/tests/coretests/res/layout/list_with_button_above.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/list_with_button_above.xml
rename to core/tests/coretests/res/layout/list_with_button_above.xml
diff --git a/tests/FrameworkTest/res/layout/list_with_disappearing_item_bug_item.xml b/core/tests/coretests/res/layout/list_with_disappearing_item_bug_item.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/list_with_disappearing_item_bug_item.xml
rename to core/tests/coretests/res/layout/list_with_disappearing_item_bug_item.xml
diff --git a/tests/FrameworkTest/res/layout/list_with_empty_view.xml b/core/tests/coretests/res/layout/list_with_empty_view.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/list_with_empty_view.xml
rename to core/tests/coretests/res/layout/list_with_empty_view.xml
diff --git a/tests/FrameworkTest/res/layout/longpress.xml b/core/tests/coretests/res/layout/longpress.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/longpress.xml
rename to core/tests/coretests/res/layout/longpress.xml
diff --git a/tests/FrameworkTest/res/layout/mail_message.xml b/core/tests/coretests/res/layout/mail_message.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/mail_message.xml
rename to core/tests/coretests/res/layout/mail_message.xml
diff --git a/tests/FrameworkTest/res/layout/merge_child.xml b/core/tests/coretests/res/layout/merge_child.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/merge_child.xml
rename to core/tests/coretests/res/layout/merge_child.xml
diff --git a/tests/FrameworkTest/res/layout/merge_tag.xml b/core/tests/coretests/res/layout/merge_tag.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/merge_tag.xml
rename to core/tests/coretests/res/layout/merge_tag.xml
diff --git a/tests/FrameworkTest/res/layout/popup_window_visibility.xml b/core/tests/coretests/res/layout/popup_window_visibility.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/popup_window_visibility.xml
rename to core/tests/coretests/res/layout/popup_window_visibility.xml
diff --git a/tests/FrameworkTest/res/layout/pre_draw_listener.xml b/core/tests/coretests/res/layout/pre_draw_listener.xml
similarity index 92%
rename from tests/FrameworkTest/res/layout/pre_draw_listener.xml
rename to core/tests/coretests/res/layout/pre_draw_listener.xml
index 7a8f33f..f431f14 100644
--- a/tests/FrameworkTest/res/layout/pre_draw_listener.xml
+++ b/core/tests/coretests/res/layout/pre_draw_listener.xml
@@ -26,7 +26,7 @@
android:layout_height="0dip"
android:layout_weight="1">
- <view class="com.android.frameworktest.view.PreDrawListener$MyLinearLayout" android:id="@+id/frame"
+ <view class="android.view.PreDrawListener$MyLinearLayout" android:id="@+id/frame"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" />
diff --git a/tests/FrameworkTest/res/layout/radiogroup_checkedchild.xml b/core/tests/coretests/res/layout/radiogroup_checkedchild.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/radiogroup_checkedchild.xml
rename to core/tests/coretests/res/layout/radiogroup_checkedchild.xml
diff --git a/tests/FrameworkTest/res/layout/remote_view_host.xml b/core/tests/coretests/res/layout/remote_view_host.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/remote_view_host.xml
rename to core/tests/coretests/res/layout/remote_view_host.xml
diff --git a/tests/FrameworkTest/res/layout/remote_view_test_bad_1.xml b/core/tests/coretests/res/layout/remote_view_test_bad_1.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/remote_view_test_bad_1.xml
rename to core/tests/coretests/res/layout/remote_view_test_bad_1.xml
diff --git a/tests/FrameworkTest/res/layout/remote_view_test_bad_2.xml b/core/tests/coretests/res/layout/remote_view_test_bad_2.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/remote_view_test_bad_2.xml
rename to core/tests/coretests/res/layout/remote_view_test_bad_2.xml
diff --git a/tests/FrameworkTest/res/layout/remote_view_test_good.xml b/core/tests/coretests/res/layout/remote_view_test_good.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/remote_view_test_good.xml
rename to core/tests/coretests/res/layout/remote_view_test_good.xml
diff --git a/tests/FrameworkTest/res/layout/scroll_to_rect_with_internal_scroll.xml b/core/tests/coretests/res/layout/scroll_to_rect_with_internal_scroll.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/scroll_to_rect_with_internal_scroll.xml
rename to core/tests/coretests/res/layout/scroll_to_rect_with_internal_scroll.xml
diff --git a/tests/FrameworkTest/res/layout/scroll_to_rectangle.xml b/core/tests/coretests/res/layout/scroll_to_rectangle.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/scroll_to_rectangle.xml
rename to core/tests/coretests/res/layout/scroll_to_rectangle.xml
diff --git a/tests/FrameworkTest/res/layout/scrollview_linear_layout.xml b/core/tests/coretests/res/layout/scrollview_linear_layout.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/scrollview_linear_layout.xml
rename to core/tests/coretests/res/layout/scrollview_linear_layout.xml
diff --git a/tests/FrameworkTest/res/layout/scrollview_with_webviews.xml b/core/tests/coretests/res/layout/scrollview_with_webviews.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/scrollview_with_webviews.xml
rename to core/tests/coretests/res/layout/scrollview_with_webviews.xml
diff --git a/tests/FrameworkTest/res/layout/table_layout_cell_span.xml b/core/tests/coretests/res/layout/table_layout_cell_span.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/table_layout_cell_span.xml
rename to core/tests/coretests/res/layout/table_layout_cell_span.xml
diff --git a/tests/FrameworkTest/res/layout/table_layout_fixed_width.xml b/core/tests/coretests/res/layout/table_layout_fixed_width.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/table_layout_fixed_width.xml
rename to core/tests/coretests/res/layout/table_layout_fixed_width.xml
diff --git a/tests/FrameworkTest/res/layout/table_layout_horizontal_gravity.xml b/core/tests/coretests/res/layout/table_layout_horizontal_gravity.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/table_layout_horizontal_gravity.xml
rename to core/tests/coretests/res/layout/table_layout_horizontal_gravity.xml
diff --git a/tests/FrameworkTest/res/layout/table_layout_vertical_gravity.xml b/core/tests/coretests/res/layout/table_layout_vertical_gravity.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/table_layout_vertical_gravity.xml
rename to core/tests/coretests/res/layout/table_layout_vertical_gravity.xml
diff --git a/tests/FrameworkTest/res/layout/table_layout_weight.xml b/core/tests/coretests/res/layout/table_layout_weight.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/table_layout_weight.xml
rename to core/tests/coretests/res/layout/table_layout_weight.xml
diff --git a/tests/FrameworkTest/res/layout/translucent_background.xml b/core/tests/coretests/res/layout/translucent_background.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/translucent_background.xml
rename to core/tests/coretests/res/layout/translucent_background.xml
diff --git a/tests/FrameworkTest/res/layout/viewgroupchildren.xml b/core/tests/coretests/res/layout/viewgroupchildren.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/viewgroupchildren.xml
rename to core/tests/coretests/res/layout/viewgroupchildren.xml
diff --git a/tests/FrameworkTest/res/layout/viewstub.xml b/core/tests/coretests/res/layout/viewstub.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/viewstub.xml
rename to core/tests/coretests/res/layout/viewstub.xml
diff --git a/tests/FrameworkTest/res/layout/visibility.xml b/core/tests/coretests/res/layout/visibility.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/visibility.xml
rename to core/tests/coretests/res/layout/visibility.xml
diff --git a/tests/FrameworkTest/res/layout/visibility_callback.xml b/core/tests/coretests/res/layout/visibility_callback.xml
similarity index 96%
rename from tests/FrameworkTest/res/layout/visibility_callback.xml
rename to core/tests/coretests/res/layout/visibility_callback.xml
index 322b640..9034b3f 100644
--- a/tests/FrameworkTest/res/layout/visibility_callback.xml
+++ b/core/tests/coretests/res/layout/visibility_callback.xml
@@ -40,7 +40,7 @@
<FrameLayout android:id="@+id/parent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
- <view class="com.android.frameworktest.view.VisibilityCallback$MonitoredTextView"
+ <view class="android.view.VisibilityCallback$MonitoredTextView"
android:id="@+id/victim"
android:background="@drawable/green"
android:layout_width="match_parent"
diff --git a/tests/FrameworkTest/res/layout/weight_sum.xml b/core/tests/coretests/res/layout/weight_sum.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/weight_sum.xml
rename to core/tests/coretests/res/layout/weight_sum.xml
diff --git a/tests/FrameworkTest/res/layout/with_bitmap_background.xml b/core/tests/coretests/res/layout/with_bitmap_background.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/with_bitmap_background.xml
rename to core/tests/coretests/res/layout/with_bitmap_background.xml
diff --git a/tests/FrameworkTest/res/layout/zero_sized.xml b/core/tests/coretests/res/layout/zero_sized.xml
similarity index 100%
rename from tests/FrameworkTest/res/layout/zero_sized.xml
rename to core/tests/coretests/res/layout/zero_sized.xml
diff --git a/tests/FrameworkTest/res/values/arrays.xml b/core/tests/coretests/res/values/arrays.xml
similarity index 100%
rename from tests/FrameworkTest/res/values/arrays.xml
rename to core/tests/coretests/res/values/arrays.xml
diff --git a/tests/FrameworkTest/res/values/attrs.xml b/core/tests/coretests/res/values/attrs.xml
similarity index 100%
rename from tests/FrameworkTest/res/values/attrs.xml
rename to core/tests/coretests/res/values/attrs.xml
diff --git a/tests/FrameworkTest/res/values/colors.xml b/core/tests/coretests/res/values/colors.xml
similarity index 100%
rename from tests/FrameworkTest/res/values/colors.xml
rename to core/tests/coretests/res/values/colors.xml
diff --git a/tests/FrameworkTest/res/values/strings.xml b/core/tests/coretests/res/values/strings.xml
similarity index 100%
rename from tests/FrameworkTest/res/values/strings.xml
rename to core/tests/coretests/res/values/strings.xml
diff --git a/core/tests/coretests/res/values/styles.xml b/core/tests/coretests/res/values/styles.xml
new file mode 100644
index 0000000..7a90197
--- /dev/null
+++ b/core/tests/coretests/res/values/styles.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<resources>
+ <style name="Theme" parent="android:Theme">
+ <item name="android:windowAnimationStyle">@style/Animation</item>
+ </style>
+
+ <style name="Animation">
+ <item name="android:activityOpenEnterAnimation">@null</item>
+ <item name="android:activityOpenExitAnimation">@null</item>
+ <item name="android:activityCloseEnterAnimation">@null</item>
+ <item name="android:activityCloseExitAnimation">@null</item>
+ <item name="android:taskOpenEnterAnimation">@null</item>
+ <item name="android:taskOpenExitAnimation">@null</item>
+ <item name="android:taskCloseEnterAnimation">@null</item>
+ <item name="android:taskCloseExitAnimation">@null</item>
+ <item name="android:taskToFrontEnterAnimation">@null</item>
+ <item name="android:taskToFrontExitAnimation">@null</item>
+ <item name="android:taskToBackEnterAnimation">@null</item>
+ <item name="android:taskToBackExitAnimation">@null</item>
+ </style>
+</resources>
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/accessibility/AccessibilityTestService.java b/core/tests/coretests/src/android/accessibilityservice/AccessibilityTestService.java
similarity index 98%
rename from tests/FrameworkTest/src/com/android/frameworktest/accessibility/AccessibilityTestService.java
rename to core/tests/coretests/src/android/accessibilityservice/AccessibilityTestService.java
index 83d6056..2a51eea 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/accessibility/AccessibilityTestService.java
+++ b/core/tests/coretests/src/android/accessibilityservice/AccessibilityTestService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.accessibility;
+package android.accessibilityservice;
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/activity/TranslucentFancyActivity.java b/core/tests/coretests/src/android/app/TranslucentFancyActivity.java
similarity index 96%
rename from tests/FrameworkTest/src/com/android/frameworktest/activity/TranslucentFancyActivity.java
rename to core/tests/coretests/src/android/app/TranslucentFancyActivity.java
index 9492f91..ec5ad7a 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/activity/TranslucentFancyActivity.java
+++ b/core/tests/coretests/src/android/app/TranslucentFancyActivity.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.activity;
+package android.app;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/CoreTests/android/core/AtParserTest.java b/core/tests/coretests/src/android/bluetooth/AtParserTest.java
similarity index 99%
rename from tests/CoreTests/android/core/AtParserTest.java
rename to core/tests/coretests/src/android/bluetooth/AtParserTest.java
index 09cb6e9..c5aa52b 100644
--- a/tests/CoreTests/android/core/AtParserTest.java
+++ b/core/tests/coretests/src/android/bluetooth/AtParserTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.core;
+package android.bluetooth;
import android.bluetooth.AtCommandHandler;
import android.bluetooth.AtCommandResult;
diff --git a/tests/FrameworkTest/tests/src/android/content/ContentProviderOperationTest.java b/core/tests/coretests/src/android/content/ContentProviderOperationTest.java
similarity index 100%
rename from tests/FrameworkTest/tests/src/android/content/ContentProviderOperationTest.java
rename to core/tests/coretests/src/android/content/ContentProviderOperationTest.java
diff --git a/tests/CoreTests/android/content/ObserverNodeTest.java b/core/tests/coretests/src/android/content/ObserverNodeTest.java
similarity index 100%
rename from tests/CoreTests/android/content/ObserverNodeTest.java
rename to core/tests/coretests/src/android/content/ObserverNodeTest.java
diff --git a/tests/FrameworkTest/tests/src/android/content/SearchRecentSuggestionsProviderTest.java b/core/tests/coretests/src/android/content/SearchRecentSuggestionsProviderTest.java
similarity index 100%
rename from tests/FrameworkTest/tests/src/android/content/SearchRecentSuggestionsProviderTest.java
rename to core/tests/coretests/src/android/content/SearchRecentSuggestionsProviderTest.java
diff --git a/tests/CoreTests/android/content/SyncStorageEngineTest.java b/core/tests/coretests/src/android/content/SyncStorageEngineTest.java
similarity index 100%
rename from tests/CoreTests/android/content/SyncStorageEngineTest.java
rename to core/tests/coretests/src/android/content/SyncStorageEngineTest.java
diff --git a/tests/CoreTests/android/database/MatrixCursorTest.java b/core/tests/coretests/src/android/database/MatrixCursorTest.java
similarity index 100%
rename from tests/CoreTests/android/database/MatrixCursorTest.java
rename to core/tests/coretests/src/android/database/MatrixCursorTest.java
diff --git a/tests/CoreTests/android/core/AbstractJDBCDriverTest.java b/core/tests/coretests/src/android/database/sqlite/AbstractJDBCDriverTest.java
similarity index 99%
rename from tests/CoreTests/android/core/AbstractJDBCDriverTest.java
rename to core/tests/coretests/src/android/database/sqlite/AbstractJDBCDriverTest.java
index e381a5e..19c7bcb 100644
--- a/tests/CoreTests/android/core/AbstractJDBCDriverTest.java
+++ b/core/tests/coretests/src/android/database/sqlite/AbstractJDBCDriverTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.core;
+package android.database.sqlite;
import java.io.File;
import java.sql.Connection;
diff --git a/tests/CoreTests/android/core/SQLiteJDBCDriverTest.java b/core/tests/coretests/src/android/database/sqlite/SQLiteJDBCDriverTest.java
similarity index 98%
rename from tests/CoreTests/android/core/SQLiteJDBCDriverTest.java
rename to core/tests/coretests/src/android/database/sqlite/SQLiteJDBCDriverTest.java
index eec82aa..8e677a5 100644
--- a/tests/CoreTests/android/core/SQLiteJDBCDriverTest.java
+++ b/core/tests/coretests/src/android/database/sqlite/SQLiteJDBCDriverTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.core;
+package android.database.sqlite;
import java.io.File;
import java.sql.Connection;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/settings/BrightnessLimit.java b/core/tests/coretests/src/android/os/BrightnessLimit.java
similarity index 95%
rename from tests/FrameworkTest/src/com/android/frameworktest/settings/BrightnessLimit.java
rename to core/tests/coretests/src/android/os/BrightnessLimit.java
index 6d5996c..5e9b906 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/settings/BrightnessLimit.java
+++ b/core/tests/coretests/src/android/os/BrightnessLimit.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.settings;
+package android.os;
import android.os.IPowerManager;
@@ -27,7 +27,7 @@
import android.view.View.OnClickListener;
import android.widget.Button;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Tries to set the brightness to 0. Should be silently thwarted by the framework.
diff --git a/tests/CoreTests/android/core/RecurrenceSetTest.java b/core/tests/coretests/src/android/pim/RecurrenceSetTest.java
similarity index 98%
rename from tests/CoreTests/android/core/RecurrenceSetTest.java
rename to core/tests/coretests/src/android/pim/RecurrenceSetTest.java
index cee324c..64cd6c4 100644
--- a/tests/CoreTests/android/core/RecurrenceSetTest.java
+++ b/core/tests/coretests/src/android/pim/RecurrenceSetTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.core;
+package android.pim;
import android.content.ContentValues;
import android.pim.ICalendar;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/text/HtmlTest.java b/core/tests/coretests/src/android/text/HtmlTest.java
similarity index 97%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/text/HtmlTest.java
rename to core/tests/coretests/src/android/text/HtmlTest.java
index 9b309c4..a79b93e 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/text/HtmlTest.java
+++ b/core/tests/coretests/src/android/text/HtmlTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.text;
+package android.text;
import android.test.InstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/text/SpannableStringBuilderTest.java b/core/tests/coretests/src/android/text/SpannableStringBuilderTest.java
similarity index 86%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/text/SpannableStringBuilderTest.java
rename to core/tests/coretests/src/android/text/SpannableStringBuilderTest.java
index a807977..02c7634 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/text/SpannableStringBuilderTest.java
+++ b/core/tests/coretests/src/android/text/SpannableStringBuilderTest.java
@@ -1,4 +1,4 @@
-package com.android.frameworktest.text;
+package android.text;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/text/SpannableStringTest.java b/core/tests/coretests/src/android/text/SpannableStringTest.java
similarity index 85%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/text/SpannableStringTest.java
rename to core/tests/coretests/src/android/text/SpannableStringTest.java
index 311df23..e9a3281 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/text/SpannableStringTest.java
+++ b/core/tests/coretests/src/android/text/SpannableStringTest.java
@@ -1,4 +1,4 @@
-package com.android.frameworktest.text;
+package android.text;
import android.text.Spannable;
import android.text.SpannableString;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/text/SpannableTest.java b/core/tests/coretests/src/android/text/SpannableTest.java
similarity index 96%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/text/SpannableTest.java
rename to core/tests/coretests/src/android/text/SpannableTest.java
index a5f6836..8e78912 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/text/SpannableTest.java
+++ b/core/tests/coretests/src/android/text/SpannableTest.java
@@ -1,4 +1,4 @@
-package com.android.frameworktest.text;
+package android.text;
import android.test.InstrumentationTestCase;
import android.test.MoreAsserts;
diff --git a/tests/CoreTests/android/util/DayOfMonthCursorTest.java b/core/tests/coretests/src/android/util/DayOfMonthCursorTest.java
similarity index 100%
rename from tests/CoreTests/android/util/DayOfMonthCursorTest.java
rename to core/tests/coretests/src/android/util/DayOfMonthCursorTest.java
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/util/ExpandableListScenario.java b/core/tests/coretests/src/android/util/ExpandableListScenario.java
similarity index 99%
rename from tests/FrameworkTest/src/com/android/frameworktest/util/ExpandableListScenario.java
rename to core/tests/coretests/src/android/util/ExpandableListScenario.java
index 5aa9479..4a12b0d 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/util/ExpandableListScenario.java
+++ b/core/tests/coretests/src/android/util/ExpandableListScenario.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.util;
+package android.util;
import java.util.ArrayList;
import java.util.List;
diff --git a/tests/CoreTests/android/util/FloatMathTest.java b/core/tests/coretests/src/android/util/FloatMathTest.java
similarity index 100%
rename from tests/CoreTests/android/util/FloatMathTest.java
rename to core/tests/coretests/src/android/util/FloatMathTest.java
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/util/GridScenario.java b/core/tests/coretests/src/android/util/GridScenario.java
similarity index 99%
rename from tests/FrameworkTest/src/com/android/frameworktest/util/GridScenario.java
rename to core/tests/coretests/src/android/util/GridScenario.java
index 76a1101..0f1730e 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/util/GridScenario.java
+++ b/core/tests/coretests/src/android/util/GridScenario.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.util;
+package android.util;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/util/InternalSelectionView.java b/core/tests/coretests/src/android/util/InternalSelectionView.java
similarity index 98%
rename from tests/FrameworkTest/src/com/android/frameworktest/util/InternalSelectionView.java
rename to core/tests/coretests/src/android/util/InternalSelectionView.java
index e500b94..babf38d 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/util/InternalSelectionView.java
+++ b/core/tests/coretests/src/android/util/InternalSelectionView.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.util;
+package android.util;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.view.View;
import android.view.KeyEvent;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/util/KeyUtils.java b/core/tests/coretests/src/android/util/KeyUtils.java
similarity index 98%
rename from tests/FrameworkTest/src/com/android/frameworktest/util/KeyUtils.java
rename to core/tests/coretests/src/android/util/KeyUtils.java
index 06feab4..b58fda3 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/util/KeyUtils.java
+++ b/core/tests/coretests/src/android/util/KeyUtils.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.util;
+package android.util;
import android.app.Instrumentation;
import android.os.SystemClock;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/util/ListItemFactory.java b/core/tests/coretests/src/android/util/ListItemFactory.java
similarity index 99%
rename from tests/FrameworkTest/src/com/android/frameworktest/util/ListItemFactory.java
rename to core/tests/coretests/src/android/util/ListItemFactory.java
index 2c1cf5b..e8a498d 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/util/ListItemFactory.java
+++ b/core/tests/coretests/src/android/util/ListItemFactory.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.util;
+package android.util;
import android.content.Context;
import android.view.Gravity;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/util/ListScenario.java b/core/tests/coretests/src/android/util/ListScenario.java
similarity index 99%
rename from tests/FrameworkTest/src/com/android/frameworktest/util/ListScenario.java
rename to core/tests/coretests/src/android/util/ListScenario.java
index a6ae188..22be4e7 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/util/ListScenario.java
+++ b/core/tests/coretests/src/android/util/ListScenario.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.util;
+package android.util;
import android.app.Activity;
import android.graphics.Rect;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/util/ListUtil.java b/core/tests/coretests/src/android/util/ListUtil.java
similarity index 98%
rename from tests/FrameworkTest/src/com/android/frameworktest/util/ListUtil.java
rename to core/tests/coretests/src/android/util/ListUtil.java
index 1a05fac..2a7cb96 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/util/ListUtil.java
+++ b/core/tests/coretests/src/android/util/ListUtil.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.util;
+package android.util;
import android.app.Instrumentation;
import android.view.KeyEvent;
diff --git a/tests/CoreTests/android/util/MonthDisplayHelperTest.java b/core/tests/coretests/src/android/util/MonthDisplayHelperTest.java
similarity index 100%
rename from tests/CoreTests/android/util/MonthDisplayHelperTest.java
rename to core/tests/coretests/src/android/util/MonthDisplayHelperTest.java
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/util/ScrollViewScenario.java b/core/tests/coretests/src/android/util/ScrollViewScenario.java
similarity index 99%
rename from tests/FrameworkTest/src/com/android/frameworktest/util/ScrollViewScenario.java
rename to core/tests/coretests/src/android/util/ScrollViewScenario.java
index daa168d..83afe06 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/util/ScrollViewScenario.java
+++ b/core/tests/coretests/src/android/util/ScrollViewScenario.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.util;
+package android.util;
import com.google.android.collect.Lists;
diff --git a/tests/CoreTests/android/util/StateSetTest.java b/core/tests/coretests/src/android/util/StateSetTest.java
similarity index 100%
rename from tests/CoreTests/android/util/StateSetTest.java
rename to core/tests/coretests/src/android/util/StateSetTest.java
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/util/TouchModeFlexibleAsserts.java b/core/tests/coretests/src/android/util/TouchModeFlexibleAsserts.java
similarity index 98%
rename from tests/FrameworkTest/src/com/android/frameworktest/util/TouchModeFlexibleAsserts.java
rename to core/tests/coretests/src/android/util/TouchModeFlexibleAsserts.java
index 66adb17..ca12a15 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/util/TouchModeFlexibleAsserts.java
+++ b/core/tests/coretests/src/android/util/TouchModeFlexibleAsserts.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.util;
+package android.util;
import junit.framework.Assert;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/BigCache.java b/core/tests/coretests/src/android/view/BigCache.java
similarity index 96%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/BigCache.java
rename to core/tests/coretests/src/android/view/BigCache.java
index 52f7a07..2182176 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/BigCache.java
+++ b/core/tests/coretests/src/android/view/BigCache.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.os.Bundle;
import android.app.Activity;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/BigCacheTest.java b/core/tests/coretests/src/android/view/BigCacheTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/BigCacheTest.java
rename to core/tests/coretests/src/android/view/BigCacheTest.java
index 8c5dc60..8c2c865 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/BigCacheTest.java
+++ b/core/tests/coretests/src/android/view/BigCacheTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.view.BigCache;
-import com.android.frameworktest.R;
+import android.view.BigCache;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -35,7 +35,7 @@
private View mLarge;
public BigCacheTest() {
- super("com.android.frameworktest", BigCache.class);
+ super("com.android.frameworks.coretests", BigCache.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/drawable/BitmapDrawable.java b/core/tests/coretests/src/android/view/BitmapDrawable.java
similarity index 93%
rename from tests/FrameworkTest/src/com/android/frameworktest/drawable/BitmapDrawable.java
rename to core/tests/coretests/src/android/view/BitmapDrawable.java
index e88ebf9..f7bad84 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/drawable/BitmapDrawable.java
+++ b/core/tests/coretests/src/android/view/BitmapDrawable.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.drawable;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.graphics.drawable.Drawable;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/Disabled.java b/core/tests/coretests/src/android/view/Disabled.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/Disabled.java
rename to core/tests/coretests/src/android/view/Disabled.java
index 1f1f4f4..fa92107 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/Disabled.java
+++ b/core/tests/coretests/src/android/view/Disabled.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.os.Bundle;
import android.widget.Button;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/DisabledLongpressTest.java b/core/tests/coretests/src/android/view/DisabledLongpressTest.java
similarity index 91%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/DisabledLongpressTest.java
rename to core/tests/coretests/src/android/view/DisabledLongpressTest.java
index ef3ecee..3123897 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/DisabledLongpressTest.java
+++ b/core/tests/coretests/src/android/view/DisabledLongpressTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.view.Longpress;
-import com.android.frameworktest.R;
-import com.android.frameworktest.util.KeyUtils;
+import android.view.Longpress;
+import com.android.frameworks.coretests.R;
+import android.util.KeyUtils;
import android.test.TouchUtils;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
@@ -36,7 +36,7 @@
private boolean mLongClicked;
public DisabledLongpressTest() {
- super("com.android.frameworktest", Longpress.class);
+ super("com.android.frameworks.coretests", Longpress.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/DisabledTest.java b/core/tests/coretests/src/android/view/DisabledTest.java
similarity index 94%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/DisabledTest.java
rename to core/tests/coretests/src/android/view/DisabledTest.java
index d9ed033..992c277 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/DisabledTest.java
+++ b/core/tests/coretests/src/android/view/DisabledTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.test.TouchUtils;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.LargeTest;
@@ -36,7 +36,7 @@
private boolean mParentClicked;
public DisabledTest() {
- super("com.android.frameworktest", Disabled.class);
+ super("com.android.frameworks.coretests", Disabled.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/drawable/DrawableBgMinSize.java b/core/tests/coretests/src/android/view/DrawableBgMinSize.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/drawable/DrawableBgMinSize.java
rename to core/tests/coretests/src/android/view/DrawableBgMinSize.java
index a382995..a75b23a 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/drawable/DrawableBgMinSize.java
+++ b/core/tests/coretests/src/android/view/DrawableBgMinSize.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.drawable;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.graphics.drawable.Drawable;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/drawable/DrawableBgMinSizeTest.java b/core/tests/coretests/src/android/view/DrawableBgMinSizeTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/drawable/DrawableBgMinSizeTest.java
rename to core/tests/coretests/src/android/view/DrawableBgMinSizeTest.java
index ef6297d..e705c87 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/drawable/DrawableBgMinSizeTest.java
+++ b/core/tests/coretests/src/android/view/DrawableBgMinSizeTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.drawable;
+package android.view;
-import com.android.frameworktest.R;
-import com.android.frameworktest.drawable.DrawableBgMinSize;
+import com.android.frameworks.coretests.R;
+import android.view.DrawableBgMinSize;
import android.test.TouchUtils;
import android.test.suitebuilder.annotation.MediumTest;
@@ -49,7 +49,7 @@
private AbsoluteLayout mAbsoluteLayout;
public DrawableBgMinSizeTest() {
- super("com.android.frameworktest", DrawableBgMinSize.class);
+ super("com.android.frameworks.coretests", DrawableBgMinSize.class);
}
@Override
diff --git a/tests/CoreTests/android/view/FocusFinderTest.java b/core/tests/coretests/src/android/view/FocusFinderTest.java
similarity index 98%
rename from tests/CoreTests/android/view/FocusFinderTest.java
rename to core/tests/coretests/src/android/view/FocusFinderTest.java
index 7ac8dfc..186689f 100644
--- a/tests/CoreTests/android/view/FocusFinderTest.java
+++ b/core/tests/coretests/src/android/view/FocusFinderTest.java
@@ -256,7 +256,7 @@
}
/**
- * Grabbed from {@link com.android.frameworktest.focus.VerticalFocusSearchTest#testSearchFromMidLeft()}
+ * Grabbed from {@link android.widget.focus.VerticalFocusSearchTest#testSearchFromMidLeft()}
*/
@SmallTest
public void testVerticalFocusSearchScenario() {
@@ -350,7 +350,7 @@
/**
* A dial pad with 9 squares arranged in a grid. no padding, so
- * the edges are equal. see {@link com.android.frameworktest.focus.LinearLayoutGrid}
+ * the edges are equal. see {@link android.widget.focus.LinearLayoutGrid}
*/
@SmallTest
public void testGridWithTouchingEdges() {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/GlobalFocusChange.java b/core/tests/coretests/src/android/view/GlobalFocusChange.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/GlobalFocusChange.java
rename to core/tests/coretests/src/android/view/GlobalFocusChange.java
index 1cbf05a..041c0de 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/GlobalFocusChange.java
+++ b/core/tests/coretests/src/android/view/GlobalFocusChange.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/GlobalFocusChangeTest.java b/core/tests/coretests/src/android/view/GlobalFocusChangeTest.java
similarity index 94%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/GlobalFocusChangeTest.java
rename to core/tests/coretests/src/android/view/GlobalFocusChangeTest.java
index 8a8d728..89e32e4 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/GlobalFocusChangeTest.java
+++ b/core/tests/coretests/src/android/view/GlobalFocusChangeTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
import android.test.ActivityInstrumentationTestCase;
import android.test.FlakyTest;
@@ -23,7 +23,7 @@
import android.test.TouchUtils;
import android.view.View;
import android.view.KeyEvent;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
public class GlobalFocusChangeTest extends ActivityInstrumentationTestCase<GlobalFocusChange> {
private GlobalFocusChange mActivity;
@@ -31,7 +31,7 @@
private View mRight;
public GlobalFocusChangeTest() {
- super("com.android.frameworktest", GlobalFocusChange.class);
+ super("com.android.frameworks.coretests", GlobalFocusChange.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/Include.java b/core/tests/coretests/src/android/view/Include.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/Include.java
rename to core/tests/coretests/src/android/view/Include.java
index fc36e37..e90c484 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/Include.java
+++ b/core/tests/coretests/src/android/view/Include.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.os.Bundle;
import android.app.Activity;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/IncludeTest.java b/core/tests/coretests/src/android/view/IncludeTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/IncludeTest.java
rename to core/tests/coretests/src/android/view/IncludeTest.java
index 2e0a18a..cdcfa3c 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/IncludeTest.java
+++ b/core/tests/coretests/src/android/view/IncludeTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.view.Include;
-import com.android.frameworktest.R;
+import android.view.Include;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -26,7 +26,7 @@
public class IncludeTest extends ActivityInstrumentationTestCase<Include> {
public IncludeTest() {
- super("com.android.frameworktest", Include.class);
+ super("com.android.frameworks.coretests", Include.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/menus/ListContextMenu.java b/core/tests/coretests/src/android/view/ListContextMenu.java
similarity index 98%
rename from tests/FrameworkTest/src/com/android/frameworktest/menus/ListContextMenu.java
rename to core/tests/coretests/src/android/view/ListContextMenu.java
index 13c7552..1b4ece6 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/menus/ListContextMenu.java
+++ b/core/tests/coretests/src/android/view/ListContextMenu.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.menus;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.ListActivity;
import android.content.Context;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/Longpress.java b/core/tests/coretests/src/android/view/Longpress.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/Longpress.java
rename to core/tests/coretests/src/android/view/Longpress.java
index f3483fc..e8e6f13 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/Longpress.java
+++ b/core/tests/coretests/src/android/view/Longpress.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/LongpressTest.java b/core/tests/coretests/src/android/view/LongpressTest.java
similarity index 90%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/LongpressTest.java
rename to core/tests/coretests/src/android/view/LongpressTest.java
index 37106f6..45ce331 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/LongpressTest.java
+++ b/core/tests/coretests/src/android/view/LongpressTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.view.Longpress;
-import com.android.frameworktest.R;
-import com.android.frameworktest.util.KeyUtils;
+import android.view.Longpress;
+import com.android.frameworks.coretests.R;
+import android.util.KeyUtils;
import android.test.TouchUtils;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
@@ -35,7 +35,7 @@
private boolean mLongClicked;
public LongpressTest() {
- super("com.android.frameworktest", Longpress.class);
+ super("com.android.frameworks.coretests", Longpress.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/Merge.java b/core/tests/coretests/src/android/view/Merge.java
similarity index 93%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/Merge.java
rename to core/tests/coretests/src/android/view/Merge.java
index 9596e91..bdacd81 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/Merge.java
+++ b/core/tests/coretests/src/android/view/Merge.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.os.Bundle;
import android.app.Activity;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/MergeTest.java b/core/tests/coretests/src/android/view/MergeTest.java
similarity index 89%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/MergeTest.java
rename to core/tests/coretests/src/android/view/MergeTest.java
index 612ebd4..acfee7e 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/MergeTest.java
+++ b/core/tests/coretests/src/android/view/MergeTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.view.Merge;
+import android.view.Merge;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -24,7 +24,7 @@
public class MergeTest extends ActivityInstrumentationTestCase<Merge> {
public MergeTest() {
- super("com.android.frameworktest", Merge.class);
+ super("com.android.frameworks.coretests", Merge.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/drawable/MutateDrawable.java b/core/tests/coretests/src/android/view/MutateDrawable.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/drawable/MutateDrawable.java
rename to core/tests/coretests/src/android/view/MutateDrawable.java
index 2fcaea3..39b5789 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/drawable/MutateDrawable.java
+++ b/core/tests/coretests/src/android/view/MutateDrawable.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.android.frameworktest.drawable;
+package android.view;
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.Button;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
public class MutateDrawable extends Activity {
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/drawable/MutateDrawableTest.java b/core/tests/coretests/src/android/view/MutateDrawableTest.java
similarity index 89%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/drawable/MutateDrawableTest.java
rename to core/tests/coretests/src/android/view/MutateDrawableTest.java
index 53085ca..74e011d 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/drawable/MutateDrawableTest.java
+++ b/core/tests/coretests/src/android/view/MutateDrawableTest.java
@@ -14,26 +14,27 @@
* limitations under the License.
*/
-package com.android.frameworktest.drawable;
+package android.view;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.View;
+import android.view.MutateDrawable;
public class MutateDrawableTest extends ActivityInstrumentationTestCase2<MutateDrawable> {
private View mFirstButton;
private View mSecondButton;
public MutateDrawableTest() {
- super("com.android.frameworktest", MutateDrawable.class);
+ super("com.android.frameworks.coretests", MutateDrawable.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
- mFirstButton = getActivity().findViewById(com.android.frameworktest.R.id.a);
- mSecondButton = getActivity().findViewById(com.android.frameworktest.R.id.b);
+ mFirstButton = getActivity().findViewById(com.android.frameworks.coretests.R.id.a);
+ mSecondButton = getActivity().findViewById(com.android.frameworks.coretests.R.id.b);
}
@MediumTest
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/PopupWindowVisibility.java b/core/tests/coretests/src/android/view/PopupWindowVisibility.java
similarity index 98%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/PopupWindowVisibility.java
rename to core/tests/coretests/src/android/view/PopupWindowVisibility.java
index f4d477d4..7eb0468 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/PopupWindowVisibility.java
+++ b/core/tests/coretests/src/android/view/PopupWindowVisibility.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
import android.app.Activity;
import android.os.Bundle;
@@ -25,7 +25,7 @@
import android.widget.Button;
import android.widget.Spinner;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Tests views with popupWindows becoming invisible
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/PreDrawListener.java b/core/tests/coretests/src/android/view/PreDrawListener.java
similarity index 96%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/PreDrawListener.java
rename to core/tests/coretests/src/android/view/PreDrawListener.java
index e907b24..981c6c0 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/PreDrawListener.java
+++ b/core/tests/coretests/src/android/view/PreDrawListener.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
import android.app.Activity;
import android.content.Context;
@@ -26,7 +26,7 @@
import android.widget.Button;
import android.widget.LinearLayout;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/RemoteViewsActivity.java b/core/tests/coretests/src/android/view/RemoteViewsActivity.java
similarity index 92%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/RemoteViewsActivity.java
rename to core/tests/coretests/src/android/view/RemoteViewsActivity.java
index 146c0ab..6f3ba04 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/RemoteViewsActivity.java
+++ b/core/tests/coretests/src/android/view/RemoteViewsActivity.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
import android.app.Activity;
import android.os.Bundle;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Exercise RemoteViews -- especially filtering
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/RunQueue.java b/core/tests/coretests/src/android/view/RunQueue.java
similarity index 96%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/RunQueue.java
rename to core/tests/coretests/src/android/view/RunQueue.java
index c8c3c28..85dd32e 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/RunQueue.java
+++ b/core/tests/coretests/src/android/view/RunQueue.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.view.View;
import android.view.ViewTreeObserver;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Tests views using post*() and getViewTreeObserver() before onAttachedToWindow().
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/RunQueueTest.java b/core/tests/coretests/src/android/view/RunQueueTest.java
similarity index 94%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/RunQueueTest.java
rename to core/tests/coretests/src/android/view/RunQueueTest.java
index dc8fcd8..d69860b 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/RunQueueTest.java
+++ b/core/tests/coretests/src/android/view/RunQueueTest.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
public class RunQueueTest extends ActivityInstrumentationTestCase<RunQueue> {
public RunQueueTest() {
- super("com.android.frameworktest", RunQueue.class);
+ super("com.android.frameworks.coretests", RunQueue.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/SetTagsTest.java b/core/tests/coretests/src/android/view/SetTagsTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/SetTagsTest.java
rename to core/tests/coretests/src/android/view/SetTagsTest.java
index 523eeaf..373dce6 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/SetTagsTest.java
+++ b/core/tests/coretests/src/android/view/SetTagsTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.ActivityInstrumentationTestCase2;
@@ -29,7 +29,7 @@
private Button mView;
public SetTagsTest() {
- super("com.android.frameworktest", Disabled.class);
+ super("com.android.frameworks.coretests", Disabled.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/StubbedView.java b/core/tests/coretests/src/android/view/StubbedView.java
similarity index 93%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/StubbedView.java
rename to core/tests/coretests/src/android/view/StubbedView.java
index 2b0db9d..612095c 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/StubbedView.java
+++ b/core/tests/coretests/src/android/view/StubbedView.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.os.Bundle;
import android.app.Activity;
diff --git a/tests/CoreTests/android/view/ViewGroupAttributesTest.java b/core/tests/coretests/src/android/view/ViewGroupAttributesTest.java
similarity index 100%
rename from tests/CoreTests/android/view/ViewGroupAttributesTest.java
rename to core/tests/coretests/src/android/view/ViewGroupAttributesTest.java
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/ViewGroupChildren.java b/core/tests/coretests/src/android/view/ViewGroupChildren.java
similarity index 92%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/ViewGroupChildren.java
rename to core/tests/coretests/src/android/view/ViewGroupChildren.java
index 163e03c..f39720b 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/ViewGroupChildren.java
+++ b/core/tests/coretests/src/android/view/ViewGroupChildren.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.os.Bundle;
import android.widget.Button;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/ViewGroupChildrenTest.java b/core/tests/coretests/src/android/view/ViewGroupChildrenTest.java
similarity index 97%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/ViewGroupChildrenTest.java
rename to core/tests/coretests/src/android/view/ViewGroupChildrenTest.java
index a6007e1..d1665ef 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/ViewGroupChildrenTest.java
+++ b/core/tests/coretests/src/android/view/ViewGroupChildrenTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
-import com.android.frameworktest.view.ViewGroupChildren;
+import com.android.frameworks.coretests.R;
+import android.view.ViewGroupChildren;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -35,7 +35,7 @@
private ViewGroup mGroup;
public ViewGroupChildrenTest() {
- super("com.android.frameworktest", ViewGroupChildren.class);
+ super("com.android.frameworks.coretests", ViewGroupChildren.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/ViewStubTest.java b/core/tests/coretests/src/android/view/ViewStubTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/ViewStubTest.java
rename to core/tests/coretests/src/android/view/ViewStubTest.java
index 89bd646..ebd52a6 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/ViewStubTest.java
+++ b/core/tests/coretests/src/android/view/ViewStubTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.view.StubbedView;
-import com.android.frameworktest.R;
+import android.view.StubbedView;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -27,7 +27,7 @@
public class ViewStubTest extends ActivityInstrumentationTestCase<StubbedView> {
public ViewStubTest() {
- super("com.android.frameworktest", StubbedView.class);
+ super("com.android.frameworks.coretests", StubbedView.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/Visibility.java b/core/tests/coretests/src/android/view/Visibility.java
similarity index 96%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/Visibility.java
rename to core/tests/coretests/src/android/view/Visibility.java
index e068620..97ff252 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/Visibility.java
+++ b/core/tests/coretests/src/android/view/Visibility.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.os.Bundle;
import android.widget.Button;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/VisibilityCallback.java b/core/tests/coretests/src/android/view/VisibilityCallback.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/VisibilityCallback.java
rename to core/tests/coretests/src/android/view/VisibilityCallback.java
index c601f102..7290a62 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/VisibilityCallback.java
+++ b/core/tests/coretests/src/android/view/VisibilityCallback.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.TextView;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.os.Bundle;
import android.widget.Button;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/VisibilityCallbackTest.java b/core/tests/coretests/src/android/view/VisibilityCallbackTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/VisibilityCallbackTest.java
rename to core/tests/coretests/src/android/view/VisibilityCallbackTest.java
index 6bef230..ec956d2 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/VisibilityCallbackTest.java
+++ b/core/tests/coretests/src/android/view/VisibilityCallbackTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
import android.test.ActivityInstrumentationTestCase2;
import android.test.UiThreadTest;
@@ -23,7 +23,7 @@
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Exercises {@link android.view.View}'s ability to change visibility between
@@ -39,7 +39,7 @@
private Button mGone;
public VisibilityCallbackTest() {
- super("com.android.frameworktest", VisibilityCallback.class);
+ super("com.android.frameworks.coretests", VisibilityCallback.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/VisibilityTest.java b/core/tests/coretests/src/android/view/VisibilityTest.java
similarity index 96%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/VisibilityTest.java
rename to core/tests/coretests/src/android/view/VisibilityTest.java
index 77b281d..17d2e3e 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/VisibilityTest.java
+++ b/core/tests/coretests/src/android/view/VisibilityTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.view.Visibility;
-import com.android.frameworktest.R;
+import android.view.Visibility;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -40,7 +40,7 @@
private Button mGone;
public VisibilityTest() {
- super("com.android.frameworktest", Visibility.class);
+ super("com.android.frameworks.coretests", Visibility.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/view/ZeroSized.java b/core/tests/coretests/src/android/view/ZeroSized.java
similarity index 92%
rename from tests/FrameworkTest/src/com/android/frameworktest/view/ZeroSized.java
rename to core/tests/coretests/src/android/view/ZeroSized.java
index e858fc0..f2a6b3e 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/view/ZeroSized.java
+++ b/core/tests/coretests/src/android/view/ZeroSized.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.os.Bundle;
import android.app.Activity;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/ZeroSizedTest.java b/core/tests/coretests/src/android/view/ZeroSizedTest.java
similarity index 94%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/view/ZeroSizedTest.java
rename to core/tests/coretests/src/android/view/ZeroSizedTest.java
index cd646e4..193fc98 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/ZeroSizedTest.java
+++ b/core/tests/coretests/src/android/view/ZeroSizedTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.view;
+package android.view;
-import com.android.frameworktest.view.ZeroSized;
-import com.android.frameworktest.R;
+import android.view.ZeroSized;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -36,7 +36,7 @@
private View mWithNoDimension;
public ZeroSizedTest() {
- super("com.android.frameworktest", ZeroSized.class);
+ super("com.android.frameworks.coretests", ZeroSized.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/accessibility/RecycleAccessibilityEventTest.java b/core/tests/coretests/src/android/view/accessibility/RecycleAccessibilityEventTest.java
similarity index 97%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/accessibility/RecycleAccessibilityEventTest.java
rename to core/tests/coretests/src/android/view/accessibility/RecycleAccessibilityEventTest.java
index d6380f9..df8d836 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/accessibility/RecycleAccessibilityEventTest.java
+++ b/core/tests/coretests/src/android/view/accessibility/RecycleAccessibilityEventTest.java
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.accessibility;
+package android.view.accessibility;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.accessibility.AccessibilityEvent;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/menus/MenuLayout.java b/core/tests/coretests/src/android/view/menu/MenuLayout.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/menus/MenuLayout.java
rename to core/tests/coretests/src/android/view/menu/MenuLayout.java
index 6ed6433..356c948 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/menus/MenuLayout.java
+++ b/core/tests/coretests/src/android/view/menu/MenuLayout.java
@@ -14,9 +14,9 @@
* under the License.
*/
-package com.android.frameworktest.menus;
+package android.view.menu;
-import com.android.frameworktest.menus.MenuScenario.Params;
+import android.view.menu.MenuScenario.Params;
import android.os.Bundle;
import android.view.Menu;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/menus/MenuLayoutLandscape.java b/core/tests/coretests/src/android/view/menu/MenuLayoutLandscape.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/menus/MenuLayoutLandscape.java
rename to core/tests/coretests/src/android/view/menu/MenuLayoutLandscape.java
index 8a98610..662cb6a 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/menus/MenuLayoutLandscape.java
+++ b/core/tests/coretests/src/android/view/menu/MenuLayoutLandscape.java
@@ -14,7 +14,7 @@
* under the License.
*/
-package com.android.frameworktest.menus;
+package android.view.menu;
/**
* An activity (inherits from MenuLayout) that shows in landscape.
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/menus/MenuLayoutLandscapeTest.java b/core/tests/coretests/src/android/view/menu/MenuLayoutLandscapeTest.java
similarity index 97%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/menus/MenuLayoutLandscapeTest.java
rename to core/tests/coretests/src/android/view/menu/MenuLayoutLandscapeTest.java
index 38cb6a1..d9bf860 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/menus/MenuLayoutLandscapeTest.java
+++ b/core/tests/coretests/src/android/view/menu/MenuLayoutLandscapeTest.java
@@ -14,9 +14,9 @@
* under the License.
*/
-package com.android.frameworktest.menus;
+package android.view.menu;
-import com.android.frameworktest.util.KeyUtils;
+import android.util.KeyUtils;
import com.android.internal.view.menu.IconMenuView;
import com.android.internal.view.menu.MenuBuilder;
@@ -30,7 +30,7 @@
private MenuLayout mActivity;
public MenuLayoutLandscapeTest() {
- super("com.android.frameworktest", MenuLayoutLandscape.class);
+ super("com.android.frameworks.coretests", MenuLayoutLandscape.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/menus/MenuLayoutPortrait.java b/core/tests/coretests/src/android/view/menu/MenuLayoutPortrait.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/menus/MenuLayoutPortrait.java
rename to core/tests/coretests/src/android/view/menu/MenuLayoutPortrait.java
index 71e7e49..5e94bd7 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/menus/MenuLayoutPortrait.java
+++ b/core/tests/coretests/src/android/view/menu/MenuLayoutPortrait.java
@@ -14,7 +14,7 @@
* under the License.
*/
-package com.android.frameworktest.menus;
+package android.view.menu;
/**
* An activity (inherits from MenuLayout) that shows in portrait.
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/menus/MenuLayoutPortraitTest.java b/core/tests/coretests/src/android/view/menu/MenuLayoutPortraitTest.java
similarity index 97%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/menus/MenuLayoutPortraitTest.java
rename to core/tests/coretests/src/android/view/menu/MenuLayoutPortraitTest.java
index a04ec62..ad746b07 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/menus/MenuLayoutPortraitTest.java
+++ b/core/tests/coretests/src/android/view/menu/MenuLayoutPortraitTest.java
@@ -14,9 +14,9 @@
* under the License.
*/
-package com.android.frameworktest.menus;
+package android.view.menu;
-import com.android.frameworktest.util.KeyUtils;
+import android.util.KeyUtils;
import com.android.internal.view.menu.IconMenuView;
import com.android.internal.view.menu.MenuBuilder;
@@ -30,7 +30,7 @@
private MenuLayout mActivity;
public MenuLayoutPortraitTest() {
- super("com.android.frameworktest", MenuLayoutPortrait.class);
+ super("com.android.frameworks.coretests", MenuLayoutPortrait.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/menus/MenuScenario.java b/core/tests/coretests/src/android/view/menu/MenuScenario.java
similarity index 98%
rename from tests/FrameworkTest/src/com/android/frameworktest/menus/MenuScenario.java
rename to core/tests/coretests/src/android/view/menu/MenuScenario.java
index 4df9b1b..b0b8802 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/menus/MenuScenario.java
+++ b/core/tests/coretests/src/android/view/menu/MenuScenario.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.menus;
+package android.view.menu;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
import com.android.internal.view.menu.MenuBuilder;
import com.android.internal.view.menu.MenuBuilder.MenuAdapter;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/menus/MenuWith1Item.java b/core/tests/coretests/src/android/view/menu/MenuWith1Item.java
similarity index 96%
rename from tests/FrameworkTest/src/com/android/frameworktest/menus/MenuWith1Item.java
rename to core/tests/coretests/src/android/view/menu/MenuWith1Item.java
index d7468f5..293c44b 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/menus/MenuWith1Item.java
+++ b/core/tests/coretests/src/android/view/menu/MenuWith1Item.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.menus;
+package android.view.menu;
import android.os.Bundle;
import android.widget.Button;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/menus/MenuWith1ItemTest.java b/core/tests/coretests/src/android/view/menu/MenuWith1ItemTest.java
similarity index 92%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/menus/MenuWith1ItemTest.java
rename to core/tests/coretests/src/android/view/menu/MenuWith1ItemTest.java
index 286533c..4e71053 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/menus/MenuWith1ItemTest.java
+++ b/core/tests/coretests/src/android/view/menu/MenuWith1ItemTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.menus;
+package android.view.menu;
-import com.android.frameworktest.menus.MenuWith1Item;
-import com.android.frameworktest.util.KeyUtils;
+import android.view.menu.MenuWith1Item;
+import android.util.KeyUtils;
import com.android.internal.view.menu.MenuBuilder;
import android.test.suitebuilder.annotation.LargeTest;
@@ -32,7 +32,7 @@
private MenuWith1Item mActivity;
public MenuWith1ItemTest() {
- super("com.android.frameworktest", MenuWith1Item.class);
+ super("com.android.frameworks.coretests", MenuWith1Item.class);
}
@Override
diff --git a/tests/CoreTests/android/webkit/UrlInterceptRegistryTest.java b/core/tests/coretests/src/android/webkit/UrlInterceptRegistryTest.java
similarity index 100%
rename from tests/CoreTests/android/webkit/UrlInterceptRegistryTest.java
rename to core/tests/coretests/src/android/webkit/UrlInterceptRegistryTest.java
diff --git a/tests/FrameworkTest/tests/src/android/widget/AutoCompleteTextViewCallbacks.java b/core/tests/coretests/src/android/widget/AutoCompleteTextViewCallbacks.java
similarity index 98%
rename from tests/FrameworkTest/tests/src/android/widget/AutoCompleteTextViewCallbacks.java
rename to core/tests/coretests/src/android/widget/AutoCompleteTextViewCallbacks.java
index 1b81c98..8e73b52 100644
--- a/tests/FrameworkTest/tests/src/android/widget/AutoCompleteTextViewCallbacks.java
+++ b/core/tests/coretests/src/android/widget/AutoCompleteTextViewCallbacks.java
@@ -27,7 +27,7 @@
private static final int WAIT_TIME = 200;
public AutoCompleteTextViewCallbacks() {
- super("com.android.frameworktest", AutoCompleteTextViewSimple.class);
+ super("com.android.frameworks.coretests", AutoCompleteTextViewSimple.class);
}
/** Test that the initial popup of the suggestions does not select anything.
diff --git a/tests/FrameworkTest/tests/src/android/widget/AutoCompleteTextViewPopup.java b/core/tests/coretests/src/android/widget/AutoCompleteTextViewPopup.java
similarity index 98%
rename from tests/FrameworkTest/tests/src/android/widget/AutoCompleteTextViewPopup.java
rename to core/tests/coretests/src/android/widget/AutoCompleteTextViewPopup.java
index c48c056..ee0abae 100644
--- a/tests/FrameworkTest/tests/src/android/widget/AutoCompleteTextViewPopup.java
+++ b/core/tests/coretests/src/android/widget/AutoCompleteTextViewPopup.java
@@ -37,7 +37,7 @@
public AutoCompleteTextViewPopup() {
- super("com.android.frameworktest", AutoCompleteTextViewSimple.class);
+ super("com.android.frameworks.coretests", AutoCompleteTextViewSimple.class);
}
/** Test that we can move the selection and it responds as expected */
diff --git a/tests/FrameworkTest/src/android/widget/AutoCompleteTextViewSimple.java b/core/tests/coretests/src/android/widget/AutoCompleteTextViewSimple.java
similarity index 98%
rename from tests/FrameworkTest/src/android/widget/AutoCompleteTextViewSimple.java
rename to core/tests/coretests/src/android/widget/AutoCompleteTextViewSimple.java
index af16cf8..f6cec26 100644
--- a/tests/FrameworkTest/src/android/widget/AutoCompleteTextViewSimple.java
+++ b/core/tests/coretests/src/android/widget/AutoCompleteTextViewSimple.java
@@ -16,7 +16,7 @@
package android.widget;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/widget/ListViewTest.java b/core/tests/coretests/src/android/widget/ListViewTest.java
similarity index 98%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/widget/ListViewTest.java
rename to core/tests/coretests/src/android/widget/ListViewTest.java
index ecb7d3a..d09a16f 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/widget/ListViewTest.java
+++ b/core/tests/coretests/src/android/widget/ListViewTest.java
@@ -1,4 +1,4 @@
-package com.android.frameworktest.widget;
+package android.widget;
import com.google.android.collect.Lists;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/radiogroup/RadioGroupActivity.java b/core/tests/coretests/src/android/widget/RadioGroupActivity.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/radiogroup/RadioGroupActivity.java
rename to core/tests/coretests/src/android/widget/RadioGroupActivity.java
index ac9e870..c87aa3a 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/radiogroup/RadioGroupActivity.java
+++ b/core/tests/coretests/src/android/widget/RadioGroupActivity.java
@@ -15,9 +15,9 @@
*/
-package com.android.frameworktest.radiogroup;
+package android.widget;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/radiogroup/RadioGroupPreCheckedTest.java b/core/tests/coretests/src/android/widget/RadioGroupPreCheckedTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/radiogroup/RadioGroupPreCheckedTest.java
rename to core/tests/coretests/src/android/widget/RadioGroupPreCheckedTest.java
index 8771830..855caae 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/radiogroup/RadioGroupPreCheckedTest.java
+++ b/core/tests/coretests/src/android/widget/RadioGroupPreCheckedTest.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.android.frameworktest.radiogroup;
+package android.widget;
import android.test.TouchUtils;
import android.widget.RadioButton;
import android.widget.RadioGroup;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;
@@ -29,7 +29,7 @@
*/
public class RadioGroupPreCheckedTest extends ActivityInstrumentationTestCase2<RadioGroupActivity> {
public RadioGroupPreCheckedTest() {
- super("com.android.frameworktest", RadioGroupActivity.class);
+ super("com.android.frameworks.coretests", RadioGroupActivity.class);
}
@LargeTest
diff --git a/tests/FrameworkTest/tests/src/android/widget/SimpleCursorAdapterTest.java b/core/tests/coretests/src/android/widget/SimpleCursorAdapterTest.java
similarity index 100%
rename from tests/FrameworkTest/tests/src/android/widget/SimpleCursorAdapterTest.java
rename to core/tests/coretests/src/android/widget/SimpleCursorAdapterTest.java
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/expandablelistview/ExpandableListBasicTest.java b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListBasicTest.java
similarity index 92%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/expandablelistview/ExpandableListBasicTest.java
rename to core/tests/coretests/src/android/widget/expandablelistview/ExpandableListBasicTest.java
index 163e084..23a4cde 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/expandablelistview/ExpandableListBasicTest.java
+++ b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListBasicTest.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.android.frameworktest.expandablelistview;
+package android.widget.expandablelistview;
-import com.android.frameworktest.expandablelistview.ExpandableListSimple;
-import com.android.frameworktest.util.ExpandableListScenario;
-import com.android.frameworktest.util.ListUtil;
-import com.android.frameworktest.util.ExpandableListScenario.MyGroup;
+import android.widget.expandablelistview.ExpandableListSimple;
+import android.util.ExpandableListScenario;
+import android.util.ListUtil;
+import android.util.ExpandableListScenario.MyGroup;
import java.util.List;
@@ -37,7 +37,7 @@
private ListUtil mListUtil;
public ExpandableListBasicTest() {
- super("com.android.frameworktest",
+ super("com.android.frameworks.coretests",
ExpandableListSimple.class);
}
@@ -126,4 +126,4 @@
mListView.isGroupExpanded(0));
}
-}
\ No newline at end of file
+}
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/expandablelistview/ExpandableListSimple.java b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListSimple.java
similarity index 92%
rename from tests/FrameworkTest/src/com/android/frameworktest/expandablelistview/ExpandableListSimple.java
rename to core/tests/coretests/src/android/widget/expandablelistview/ExpandableListSimple.java
index cee1d4d..78db28c 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/expandablelistview/ExpandableListSimple.java
+++ b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListSimple.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.android.frameworktest.expandablelistview;
+package android.widget.expandablelistview;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.widget.BaseExpandableListAdapter;
-import com.android.frameworktest.util.ExpandableListScenario;
+import android.util.ExpandableListScenario;
public class ExpandableListSimple extends ExpandableListScenario {
private static final int[] NUM_CHILDREN = {4, 3, 2, 1, 0};
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/expandablelistview/ExpandableListWithHeaders.java b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListWithHeaders.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/expandablelistview/ExpandableListWithHeaders.java
rename to core/tests/coretests/src/android/widget/expandablelistview/ExpandableListWithHeaders.java
index 0155f09..7965f9f 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/expandablelistview/ExpandableListWithHeaders.java
+++ b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListWithHeaders.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.expandablelistview;
+package android.widget.expandablelistview;
-import com.android.frameworktest.util.ExpandableListScenario;
+import android.util.ExpandableListScenario;
import android.os.Bundle;
import android.widget.Button;
diff --git a/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListWithHeadersTest.java b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListWithHeadersTest.java
new file mode 100644
index 0000000..50d0929
--- /dev/null
+++ b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListWithHeadersTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.widget.expandablelistview;
+
+import android.test.ActivityInstrumentationTestCase;
+import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.view.KeyEvent;
+import android.widget.ExpandableListView;
+
+import android.widget.expandablelistview.ExpandableListWithHeaders;
+import android.util.ListUtil;
+
+public class ExpandableListWithHeadersTest extends ActivityInstrumentationTestCase<ExpandableListWithHeaders> {
+ private ExpandableListView mExpandableListView;
+ private ListUtil mListUtil;
+
+ public ExpandableListWithHeadersTest() {
+ super("com.android.frameworks.coretests",
+ ExpandableListWithHeaders.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ mExpandableListView = getActivity().getExpandableListView();
+ mListUtil = new ListUtil(mExpandableListView, getInstrumentation());
+ }
+
+ @MediumTest
+ public void testPreconditions() {
+ assertNotNull(mExpandableListView);
+ }
+
+ @MediumTest
+ public void testExpandOnFirstPosition() {
+ // Should be a header, and hence the first group should NOT have expanded
+ mListUtil.arrowScrollToSelectedPosition(0);
+ sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
+ getInstrumentation().waitForIdleSync();
+ assertFalse(mExpandableListView.isGroupExpanded(0));
+ }
+
+ @LargeTest
+ public void testExpandOnFirstGroup() {
+ mListUtil.arrowScrollToSelectedPosition(getActivity().getNumOfHeadersAndFooters());
+ sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
+ getInstrumentation().waitForIdleSync();
+ assertTrue(mExpandableListView.isGroupExpanded(0));
+ }
+}
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/expandablelistview/InflatedExpandableListView.java b/core/tests/coretests/src/android/widget/expandablelistview/InflatedExpandableListView.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/expandablelistview/InflatedExpandableListView.java
rename to core/tests/coretests/src/android/widget/expandablelistview/InflatedExpandableListView.java
index aff0507..08b0d31 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/expandablelistview/InflatedExpandableListView.java
+++ b/core/tests/coretests/src/android/widget/expandablelistview/InflatedExpandableListView.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.expandablelistview;
+package android.view.widget.expandablelistview;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/AdjacentVerticalRectLists.java b/core/tests/coretests/src/android/widget/focus/AdjacentVerticalRectLists.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/AdjacentVerticalRectLists.java
rename to core/tests/coretests/src/android/widget/focus/AdjacentVerticalRectLists.java
index 09bec2c..75da6fe 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/AdjacentVerticalRectLists.java
+++ b/core/tests/coretests/src/android/widget/focus/AdjacentVerticalRectLists.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.util.InternalSelectionView;
+import android.util.InternalSelectionView;
import android.app.Activity;
import android.os.Bundle;
@@ -31,7 +31,7 @@
* rectangle of the previously focused view. The view taking focus can use this
* to set an internal selection more appropriate using this rect.
*
- * This Activity excercises that behavior using three adjacent {@link com.android.frameworktest.util.InternalSelectionView}
+ * This Activity excercises that behavior using three adjacent {@link android.util.InternalSelectionView}
* that report interesting rects when giving up focus, and use interesting rects
* when taking focus to best select the internal row to show as selected.
*/
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/DescendantFocusability.java b/core/tests/coretests/src/android/widget/focus/DescendantFocusability.java
similarity index 95%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/DescendantFocusability.java
rename to core/tests/coretests/src/android/widget/focus/DescendantFocusability.java
index f0c1980..f7d91aa 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/DescendantFocusability.java
+++ b/core/tests/coretests/src/android/widget/focus/DescendantFocusability.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/DescendantFocusabilityTest.java b/core/tests/coretests/src/android/widget/focus/DescendantFocusabilityTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/focus/DescendantFocusabilityTest.java
rename to core/tests/coretests/src/android/widget/focus/DescendantFocusabilityTest.java
index 6bdd416..2af42ac 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/DescendantFocusabilityTest.java
+++ b/core/tests/coretests/src/android/widget/focus/DescendantFocusabilityTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.focus.DescendantFocusability;
+import android.widget.focus.DescendantFocusability;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -30,7 +30,7 @@
private DescendantFocusability a;
public DescendantFocusabilityTest() {
- super("com.android.frameworktest", DescendantFocusability.class);
+ super("com.android.frameworks.coretests", DescendantFocusability.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/FocusAfterRemoval.java b/core/tests/coretests/src/android/widget/focus/FocusAfterRemoval.java
similarity index 96%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/FocusAfterRemoval.java
rename to core/tests/coretests/src/android/widget/focus/FocusAfterRemoval.java
index 6c5f1c4..93245e7 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/FocusAfterRemoval.java
+++ b/core/tests/coretests/src/android/widget/focus/FocusAfterRemoval.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/FocusAfterRemovalTest.java b/core/tests/coretests/src/android/widget/focus/FocusAfterRemovalTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/focus/FocusAfterRemovalTest.java
rename to core/tests/coretests/src/android/widget/focus/FocusAfterRemovalTest.java
index 8fb9b01..a1b7bcb 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/FocusAfterRemovalTest.java
+++ b/core/tests/coretests/src/android/widget/focus/FocusAfterRemovalTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.focus.FocusAfterRemoval;
-import com.android.frameworktest.R;
+import android.widget.focus.FocusAfterRemoval;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -39,7 +39,7 @@
private Button mBottomRightButton;
public FocusAfterRemovalTest() {
- super("com.android.frameworktest", FocusAfterRemoval.class);
+ super("com.android.frameworks.coretests", FocusAfterRemoval.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/FocusChangeWithInterestingRectHintTest.java b/core/tests/coretests/src/android/widget/focus/FocusChangeWithInterestingRectHintTest.java
similarity index 91%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/focus/FocusChangeWithInterestingRectHintTest.java
rename to core/tests/coretests/src/android/widget/focus/FocusChangeWithInterestingRectHintTest.java
index 6bdb1ca..8f8f184 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/FocusChangeWithInterestingRectHintTest.java
+++ b/core/tests/coretests/src/android/widget/focus/FocusChangeWithInterestingRectHintTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.focus.AdjacentVerticalRectLists;
-import com.android.frameworktest.util.InternalSelectionView;
+import android.widget.focus.AdjacentVerticalRectLists;
+import android.util.InternalSelectionView;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -32,7 +32,7 @@
* rectangle of the previously focused view. The view taking focus can use this
* to set an internal selection more appropriate using this rect.
*
- * This tests that behavior using three adjacent {@link com.android.frameworktest.util.InternalSelectionView}
+ * This tests that behavior using three adjacent {@link android.util.InternalSelectionView}
* that report interesting rects when giving up focus, and use interesting rects
* when taking focus to best select the internal row to show as selected.
*
@@ -44,7 +44,7 @@
private InternalSelectionView mRightColumn;
public FocusChangeWithInterestingRectHintTest() {
- super("com.android.frameworktest", AdjacentVerticalRectLists.class);
+ super("com.android.frameworks.coretests", AdjacentVerticalRectLists.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/GoneParentFocusedChild.java b/core/tests/coretests/src/android/widget/focus/GoneParentFocusedChild.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/GoneParentFocusedChild.java
rename to core/tests/coretests/src/android/widget/focus/GoneParentFocusedChild.java
index 8f2245f..af90997 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/GoneParentFocusedChild.java
+++ b/core/tests/coretests/src/android/widget/focus/GoneParentFocusedChild.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/GoneParentFocusedChildTest.java b/core/tests/coretests/src/android/widget/focus/GoneParentFocusedChildTest.java
similarity index 90%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/focus/GoneParentFocusedChildTest.java
rename to core/tests/coretests/src/android/widget/focus/GoneParentFocusedChildTest.java
index a490322..dcbddef 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/GoneParentFocusedChildTest.java
+++ b/core/tests/coretests/src/android/widget/focus/GoneParentFocusedChildTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.KeyEvent;
import android.view.View;
-import com.android.frameworktest.focus.GoneParentFocusedChild;
+import android.widget.focus.GoneParentFocusedChild;
/**
* When a parent is GONE, key events shouldn't go to its children, even if they
@@ -31,7 +31,7 @@
public GoneParentFocusedChildTest() {
- super("com.android.frameworktest", GoneParentFocusedChild.class);
+ super("com.android.frameworks.coretests", GoneParentFocusedChild.class);
}
@MediumTest
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/HorizontalFocusSearch.java b/core/tests/coretests/src/android/widget/focus/HorizontalFocusSearch.java
similarity index 98%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/HorizontalFocusSearch.java
rename to core/tests/coretests/src/android/widget/focus/HorizontalFocusSearch.java
index 05f05ee..11cac1e 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/HorizontalFocusSearch.java
+++ b/core/tests/coretests/src/android/widget/focus/HorizontalFocusSearch.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
import android.app.Activity;
import android.widget.LinearLayout;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/HorizontalFocusSearchTest.java b/core/tests/coretests/src/android/widget/focus/HorizontalFocusSearchTest.java
similarity index 92%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/focus/HorizontalFocusSearchTest.java
rename to core/tests/coretests/src/android/widget/focus/HorizontalFocusSearchTest.java
index ca7cd7e..b591e5f 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/HorizontalFocusSearchTest.java
+++ b/core/tests/coretests/src/android/widget/focus/HorizontalFocusSearchTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.focus.HorizontalFocusSearch;
+import android.widget.focus.HorizontalFocusSearch;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.Suppress;
@@ -24,8 +24,8 @@
import android.widget.Button;
import android.view.View;
-import static com.android.frameworktest.focus.VerticalFocusSearchTest.FocusSearchAlg;
-import static com.android.frameworktest.focus.VerticalFocusSearchTest.NewFocusSearchAlg;
+import static android.widget.focus.VerticalFocusSearchTest.FocusSearchAlg;
+import static android.widget.focus.VerticalFocusSearchTest.NewFocusSearchAlg;
/**
* Tests that focus searching works on a horizontal linear layout of buttons of
@@ -45,7 +45,7 @@
public HorizontalFocusSearchTest() {
- super("com.android.frameworktest", HorizontalFocusSearch.class);
+ super("com.android.frameworks.coretests", HorizontalFocusSearch.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/LinearLayoutGrid.java b/core/tests/coretests/src/android/widget/focus/LinearLayoutGrid.java
similarity index 95%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/LinearLayoutGrid.java
rename to core/tests/coretests/src/android/widget/focus/LinearLayoutGrid.java
index 9aec0d5..db082ec 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/LinearLayoutGrid.java
+++ b/core/tests/coretests/src/android/widget/focus/LinearLayoutGrid.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
public class LinearLayoutGrid extends Activity {
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/LinearLayoutGridTest.java b/core/tests/coretests/src/android/widget/focus/LinearLayoutGridTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/focus/LinearLayoutGridTest.java
rename to core/tests/coretests/src/android/widget/focus/LinearLayoutGridTest.java
index c26c331..89cb8bb 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/LinearLayoutGridTest.java
+++ b/core/tests/coretests/src/android/widget/focus/LinearLayoutGridTest.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
import android.test.SingleLaunchActivityTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.FocusFinder;
import android.view.View;
import android.view.ViewGroup;
-import com.android.frameworktest.focus.LinearLayoutGrid;
+import android.widget.focus.LinearLayoutGrid;
/**
* Tests focus searching between buttons within a grid that are touching, for example,
@@ -34,7 +34,7 @@
private ViewGroup mRootView;
public LinearLayoutGridTest() {
- super("com.android.frameworktest", LinearLayoutGrid.class);
+ super("com.android.frameworks.coretests", LinearLayoutGrid.class);
}
protected void setUp() throws Exception {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/ListOfButtons.java b/core/tests/coretests/src/android/widget/focus/ListOfButtons.java
similarity index 95%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/ListOfButtons.java
rename to core/tests/coretests/src/android/widget/focus/ListOfButtons.java
index 0abcebb..308861d 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/ListOfButtons.java
+++ b/core/tests/coretests/src/android/widget/focus/ListOfButtons.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.ListActivity;
import android.content.Context;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/ListOfButtonsTest.java b/core/tests/coretests/src/android/widget/focus/ListOfButtonsTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/focus/ListOfButtonsTest.java
rename to core/tests/coretests/src/android/widget/focus/ListOfButtonsTest.java
index 902fc1c..3dba4e5 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/ListOfButtonsTest.java
+++ b/core/tests/coretests/src/android/widget/focus/ListOfButtonsTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.focus.ListOfButtons;
-import com.android.frameworktest.R;
+import android.widget.focus.ListOfButtons;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -39,7 +39,7 @@
private ListView mListView;
public ListOfButtonsTest() {
- super("com.android.frameworktest", ListOfButtons.class);
+ super("com.android.frameworks.coretests", ListOfButtons.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/ListOfEditTexts.java b/core/tests/coretests/src/android/widget/focus/ListOfEditTexts.java
similarity index 98%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/ListOfEditTexts.java
rename to core/tests/coretests/src/android/widget/focus/ListOfEditTexts.java
index 41a276a..c2e7a26 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/ListOfEditTexts.java
+++ b/core/tests/coretests/src/android/widget/focus/ListOfEditTexts.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/ListOfInternalSelectionViews.java b/core/tests/coretests/src/android/widget/focus/ListOfInternalSelectionViews.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/ListOfInternalSelectionViews.java
rename to core/tests/coretests/src/android/widget/focus/ListOfInternalSelectionViews.java
index 6104068..6518341 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/ListOfInternalSelectionViews.java
+++ b/core/tests/coretests/src/android/widget/focus/ListOfInternalSelectionViews.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
import android.app.Activity;
import android.os.Bundle;
@@ -22,7 +22,7 @@
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
-import com.android.frameworktest.util.InternalSelectionView;
+import android.util.InternalSelectionView;
/**
* A list of {@link InternalSelectionView}s paramatarized by the number of items,
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/ListWithFooterViewAndNewLabels.java b/core/tests/coretests/src/android/widget/focus/ListWithFooterViewAndNewLabels.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/ListWithFooterViewAndNewLabels.java
rename to core/tests/coretests/src/android/widget/focus/ListWithFooterViewAndNewLabels.java
index 730f9aa..ceb0e95 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/ListWithFooterViewAndNewLabels.java
+++ b/core/tests/coretests/src/android/widget/focus/ListWithFooterViewAndNewLabels.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
import android.app.ListActivity;
import android.content.Context;
@@ -28,7 +28,7 @@
import android.widget.TextView;
import com.google.android.collect.Lists;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import java.util.List;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/ListWithFooterViewAndNewLabelsTest.java b/core/tests/coretests/src/android/widget/focus/ListWithFooterViewAndNewLabelsTest.java
similarity index 91%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/focus/ListWithFooterViewAndNewLabelsTest.java
rename to core/tests/coretests/src/android/widget/focus/ListWithFooterViewAndNewLabelsTest.java
index c094882..57dbb78 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/ListWithFooterViewAndNewLabelsTest.java
+++ b/core/tests/coretests/src/android/widget/focus/ListWithFooterViewAndNewLabelsTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.focus.ListWithFooterViewAndNewLabels;
-import com.android.frameworktest.R;
+import android.widget.focus.ListWithFooterViewAndNewLabels;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.widget.Button;
@@ -35,7 +35,7 @@
public ListWithFooterViewAndNewLabelsTest() {
- super("com.android.frameworktest",
+ super("com.android.frameworks.coretests",
ListWithFooterViewAndNewLabels.class);
}
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/ListWithMailMessages.java b/core/tests/coretests/src/android/widget/focus/ListWithMailMessages.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/ListWithMailMessages.java
rename to core/tests/coretests/src/android/widget/focus/ListWithMailMessages.java
index 27c642a..5de4ad5 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/ListWithMailMessages.java
+++ b/core/tests/coretests/src/android/widget/focus/ListWithMailMessages.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import com.google.android.collect.Lists;
import android.app.ListActivity;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/RequestFocus.java b/core/tests/coretests/src/android/widget/focus/RequestFocus.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/RequestFocus.java
rename to core/tests/coretests/src/android/widget/focus/RequestFocus.java
index 803815b..af9ee17 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/RequestFocus.java
+++ b/core/tests/coretests/src/android/widget/focus/RequestFocus.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/RequestFocusTest.java b/core/tests/coretests/src/android/widget/focus/RequestFocusTest.java
similarity index 94%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/focus/RequestFocusTest.java
rename to core/tests/coretests/src/android/widget/focus/RequestFocusTest.java
index 5fb3a29..477831e 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/RequestFocusTest.java
+++ b/core/tests/coretests/src/android/widget/focus/RequestFocusTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.focus.RequestFocus;
-import com.android.frameworktest.R;
+import android.widget.focus.RequestFocus;
+import com.android.frameworks.coretests.R;
import android.os.Handler;
import android.test.ActivityInstrumentationTestCase;
@@ -39,7 +39,7 @@
private Handler mHandler;
public RequestFocusTest() {
- super("com.android.frameworktest", RequestFocus.class);
+ super("com.android.frameworks.coretests", RequestFocus.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/ScrollingThroughListOfFocusablesTest.java b/core/tests/coretests/src/android/widget/focus/ScrollingThroughListOfFocusablesTest.java
similarity index 96%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/focus/ScrollingThroughListOfFocusablesTest.java
rename to core/tests/coretests/src/android/widget/focus/ScrollingThroughListOfFocusablesTest.java
index 6fa9533..eb9192a 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/ScrollingThroughListOfFocusablesTest.java
+++ b/core/tests/coretests/src/android/widget/focus/ScrollingThroughListOfFocusablesTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
import android.graphics.Rect;
import android.test.InstrumentationTestCase;
@@ -22,8 +22,8 @@
import android.test.suitebuilder.annotation.MediumTest;
import android.view.KeyEvent;
import android.widget.ListView;
-import com.android.frameworktest.focus.ListOfInternalSelectionViews;
-import com.android.frameworktest.util.InternalSelectionView;
+import android.widget.focus.ListOfInternalSelectionViews;
+import android.util.InternalSelectionView;
/**
@@ -44,7 +44,7 @@
@Override
protected void setUp() throws Exception {
mActivity = launchActivity(
- "com.android.frameworktest",
+ "com.android.frameworks.coretests",
ListOfInternalSelectionViews.class,
ListOfInternalSelectionViews.getBundleFor(
mNumItems, // 4 items
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/focus/VerticalFocusSearch.java b/core/tests/coretests/src/android/widget/focus/VerticalFocusSearch.java
similarity index 98%
rename from tests/FrameworkTest/src/com/android/frameworktest/focus/VerticalFocusSearch.java
rename to core/tests/coretests/src/android/widget/focus/VerticalFocusSearch.java
index a8f12d8..deb9e67 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/focus/VerticalFocusSearch.java
+++ b/core/tests/coretests/src/android/widget/focus/VerticalFocusSearch.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/VerticalFocusSearchTest.java b/core/tests/coretests/src/android/widget/focus/VerticalFocusSearchTest.java
similarity index 96%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/focus/VerticalFocusSearchTest.java
rename to core/tests/coretests/src/android/widget/focus/VerticalFocusSearchTest.java
index 47a81fb..f05d83a 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/focus/VerticalFocusSearchTest.java
+++ b/core/tests/coretests/src/android/widget/focus/VerticalFocusSearchTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.focus;
+package android.widget.focus;
-import com.android.frameworktest.focus.VerticalFocusSearch;
+import android.widget.focus.VerticalFocusSearch;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.Suppress;
@@ -59,7 +59,7 @@
}
public VerticalFocusSearchTest() {
- super("com.android.frameworktest", VerticalFocusSearch.class);
+ super("com.android.frameworks.coretests", VerticalFocusSearch.class);
}
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridDelete.java b/core/tests/coretests/src/android/widget/gridview/GridDelete.java
similarity index 96%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridDelete.java
rename to core/tests/coretests/src/android/widget/gridview/GridDelete.java
index 4c0d23b..57ae8f39 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridDelete.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridDelete.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
import android.view.KeyEvent;
import android.view.View;
@@ -23,7 +23,7 @@
import android.widget.GridView;
import android.widget.ListAdapter;
-import com.android.frameworktest.util.GridScenario;
+import android.util.GridScenario;
import java.util.ArrayList;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridInHorizontal.java b/core/tests/coretests/src/android/widget/gridview/GridInHorizontal.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridInHorizontal.java
rename to core/tests/coretests/src/android/widget/gridview/GridInHorizontal.java
index c10a53b..493c2cd 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridInHorizontal.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridInHorizontal.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
import android.app.Activity;
import android.os.Bundle;
@@ -23,7 +23,7 @@
import android.widget.GridView;
import android.widget.TextView;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Exercises a grid in a horizontal linear layout
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridInHorizontalTest.java b/core/tests/coretests/src/android/widget/gridview/GridInHorizontalTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridInHorizontalTest.java
rename to core/tests/coretests/src/android/widget/gridview/GridInHorizontalTest.java
index 8af6214..21ca655 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridInHorizontalTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridInHorizontalTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.GridView;
-import com.android.frameworktest.gridview.GridInHorizontal;
+import android.widget.gridview.GridInHorizontal;
public class GridInHorizontalTest extends ActivityInstrumentationTestCase<GridInHorizontal> {
@@ -28,7 +28,7 @@
private GridView mGridView;
public GridInHorizontalTest() {
- super("com.android.frameworktest", GridInHorizontal.class);
+ super("com.android.frameworks.coretests", GridInHorizontal.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridInVertical.java b/core/tests/coretests/src/android/widget/gridview/GridInVertical.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridInVertical.java
rename to core/tests/coretests/src/android/widget/gridview/GridInVertical.java
index acde73e..aeceb23 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridInVertical.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridInVertical.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
import android.app.Activity;
import android.os.Bundle;
@@ -23,7 +23,7 @@
import android.widget.GridView;
import android.widget.TextView;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Exercises a grid in a vertical linear layout
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridInVerticalTest.java b/core/tests/coretests/src/android/widget/gridview/GridInVerticalTest.java
similarity index 89%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridInVerticalTest.java
rename to core/tests/coretests/src/android/widget/gridview/GridInVerticalTest.java
index 61e1c8b..a674db2 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridInVerticalTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridInVerticalTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.GridView;
-import com.android.frameworktest.gridview.GridInVertical;
+import android.widget.gridview.GridInVertical;
public class GridInVerticalTest extends ActivityInstrumentationTestCase<GridInVertical> {
@@ -28,7 +28,7 @@
private GridView mGridView;
public GridInVerticalTest() {
- super("com.android.frameworktest", GridInVertical.class);
+ super("com.android.frameworks.coretests", GridInVertical.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridPadding.java b/core/tests/coretests/src/android/widget/gridview/GridPadding.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridPadding.java
rename to core/tests/coretests/src/android/widget/gridview/GridPadding.java
index 41909ac2..0b9e4c5 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridPadding.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridPadding.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.GridView;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Exercises a grid with padding
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridPaddingTest.java b/core/tests/coretests/src/android/widget/gridview/GridPaddingTest.java
similarity index 92%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridPaddingTest.java
rename to core/tests/coretests/src/android/widget/gridview/GridPaddingTest.java
index 43581c6..ecd4b1c 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridPaddingTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridPaddingTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.MediumTest;
@@ -24,7 +24,7 @@
private GridView mGridView;
public GridPaddingTest() {
- super("com.android.frameworktest", GridPadding.class);
+ super("com.android.frameworks.coretests", GridPadding.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridScrollListener.java b/core/tests/coretests/src/android/widget/gridview/GridScrollListener.java
similarity index 95%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridScrollListener.java
rename to core/tests/coretests/src/android/widget/gridview/GridScrollListener.java
index 4655230..4290941 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridScrollListener.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridScrollListener.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
import android.app.Activity;
import android.os.Bundle;
@@ -24,7 +24,7 @@
import android.widget.GridView;
import android.widget.TextView;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Exercises change notification in a list
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridScrollListenerTest.java b/core/tests/coretests/src/android/widget/gridview/GridScrollListenerTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridScrollListenerTest.java
rename to core/tests/coretests/src/android/widget/gridview/GridScrollListenerTest.java
index f939f16..8f62b2c 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridScrollListenerTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridScrollListenerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase;
@@ -25,7 +25,7 @@
import android.widget.AbsListView;
import android.widget.GridView;
-import com.android.frameworktest.gridview.GridScrollListener;
+import android.widget.gridview.GridScrollListener;
public class GridScrollListenerTest extends ActivityInstrumentationTestCase<GridScrollListener> implements
AbsListView.OnScrollListener {
@@ -36,7 +36,7 @@
private int mTotalItemCount = -1;
public GridScrollListenerTest() {
- super("com.android.frameworktest", GridScrollListener.class);
+ super("com.android.frameworks.coretests", GridScrollListener.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelection.java b/core/tests/coretests/src/android/widget/gridview/GridSetSelection.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelection.java
rename to core/tests/coretests/src/android/widget/gridview/GridSetSelection.java
index 38f629d..a3cda3b 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelection.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridSetSelection.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.util.GridScenario;
+import android.util.GridScenario;
/**
* Basic stacking from top scenario, nothing fancy. Items do not
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionBaseTest.java b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionBaseTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionBaseTest.java
rename to core/tests/coretests/src/android/widget/gridview/GridSetSelectionBaseTest.java
index 3ca9b09..0e362b6 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionBaseTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionBaseTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.util.GridScenario;
+import android.util.GridScenario;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -28,7 +28,7 @@
private GridView mGridView;
protected GridSetSelectionBaseTest(Class<T> klass) {
- super("com.android.frameworktest", klass);
+ super("com.android.frameworks.coretests", klass);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelectionMany.java b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionMany.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelectionMany.java
rename to core/tests/coretests/src/android/widget/gridview/GridSetSelectionMany.java
index 34aeb75..a6d481f 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelectionMany.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionMany.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.util.GridScenario;
+import android.util.GridScenario;
/**
* Basic stacking from top scenario, nothing fancy. Items do
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionManyTest.java b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionManyTest.java
similarity index 87%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionManyTest.java
rename to core/tests/coretests/src/android/widget/gridview/GridSetSelectionManyTest.java
index aadc185..6739645 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionManyTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionManyTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.gridview.GridSetSelectionMany;
+import android.widget.gridview.GridSetSelectionMany;
public class GridSetSelectionManyTest extends GridSetSelectionBaseTest<GridSetSelectionMany> {
public GridSetSelectionManyTest() {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottom.java b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionStackFromBottom.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottom.java
rename to core/tests/coretests/src/android/widget/gridview/GridSetSelectionStackFromBottom.java
index 6a2445f..dfcd5fc 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottom.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionStackFromBottom.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.util.GridScenario;
+import android.util.GridScenario;
/**
* Basic stacking from bottom scenario, nothing fancy. Items do not
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottomMany.java b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionStackFromBottomMany.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottomMany.java
rename to core/tests/coretests/src/android/widget/gridview/GridSetSelectionStackFromBottomMany.java
index 838c431..26a567e 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottomMany.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionStackFromBottomMany.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.util.GridScenario;
+import android.util.GridScenario;
/**
* Basic stacking from bottom scenario, nothing fancy. Items do
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottomManyTest.java b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionStackFromBottomManyTest.java
similarity index 87%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottomManyTest.java
rename to core/tests/coretests/src/android/widget/gridview/GridSetSelectionStackFromBottomManyTest.java
index 831ba85..46922b97 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottomManyTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionStackFromBottomManyTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.gridview.GridSetSelectionStackFromBottomMany;
+import android.widget.gridview.GridSetSelectionStackFromBottomMany;
public class GridSetSelectionStackFromBottomManyTest extends GridSetSelectionBaseTest<GridSetSelectionStackFromBottomMany> {
public GridSetSelectionStackFromBottomManyTest() {
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottomTest.java b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionStackFromBottomTest.java
similarity index 87%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottomTest.java
rename to core/tests/coretests/src/android/widget/gridview/GridSetSelectionStackFromBottomTest.java
index c4d0513..67dd6f1 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottomTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionStackFromBottomTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.gridview.GridSetSelectionStackFromBottom;
+import android.widget.gridview.GridSetSelectionStackFromBottom;
public class GridSetSelectionStackFromBottomTest extends GridSetSelectionBaseTest<GridSetSelectionStackFromBottom> {
public GridSetSelectionStackFromBottomTest() {
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionTest.java b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionTest.java
rename to core/tests/coretests/src/android/widget/gridview/GridSetSelectionTest.java
index 5a584a5..2127b3c 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridSetSelectionTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.gridview.GridSetSelection;
+import android.widget.gridview.GridSetSelection;
public class GridSetSelectionTest extends GridSetSelectionBaseTest<GridSetSelection> {
public GridSetSelectionTest() {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSimple.java b/core/tests/coretests/src/android/widget/gridview/GridSimple.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSimple.java
rename to core/tests/coretests/src/android/widget/gridview/GridSimple.java
index f7f68f5..7c2c696 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSimple.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridSimple.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
import android.graphics.drawable.PaintDrawable;
import android.os.Bundle;
@@ -22,7 +22,7 @@
import android.view.ViewGroup;
import android.widget.TextView;
-import com.android.frameworktest.util.GridScenario;
+import android.util.GridScenario;
public class GridSimple extends GridScenario {
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSingleColumn.java b/core/tests/coretests/src/android/widget/gridview/GridSingleColumn.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSingleColumn.java
rename to core/tests/coretests/src/android/widget/gridview/GridSingleColumn.java
index a909bd8..566e71b 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSingleColumn.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridSingleColumn.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.util.GridScenario;
+import android.util.GridScenario;
import android.widget.GridView;
/**
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSingleColumnTest.java b/core/tests/coretests/src/android/widget/gridview/GridSingleColumnTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSingleColumnTest.java
rename to core/tests/coretests/src/android/widget/gridview/GridSingleColumnTest.java
index b72a2e0..3b2504e 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSingleColumnTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridSingleColumnTest.java
@@ -14,20 +14,20 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.GridView;
-import com.android.frameworktest.gridview.GridSingleColumn;
+import android.widget.gridview.GridSingleColumn;
public class GridSingleColumnTest extends ActivityInstrumentationTestCase<GridSingleColumn> {
private GridSingleColumn mActivity;
private GridView mGridView;
public GridSingleColumnTest() {
- super("com.android.frameworktest", GridSingleColumn.class);
+ super("com.android.frameworks.coretests", GridSingleColumn.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridStackFromBottom.java b/core/tests/coretests/src/android/widget/gridview/GridStackFromBottom.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridStackFromBottom.java
rename to core/tests/coretests/src/android/widget/gridview/GridStackFromBottom.java
index 304110e..2f0a88f 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridStackFromBottom.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridStackFromBottom.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.util.GridScenario;
+import android.util.GridScenario;
/**
* Basic bottom stacking from bottom scenario, nothing fancy. Items do not
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridStackFromBottomMany.java b/core/tests/coretests/src/android/widget/gridview/GridStackFromBottomMany.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridStackFromBottomMany.java
rename to core/tests/coretests/src/android/widget/gridview/GridStackFromBottomMany.java
index 94d801e..33a9592 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridStackFromBottomMany.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridStackFromBottomMany.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.util.GridScenario;
+import android.util.GridScenario;
/**
* Basic bottom stacking from bottom scenario, nothing fancy. The grid items do not fit on the
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridStackFromBottomManyTest.java b/core/tests/coretests/src/android/widget/gridview/GridStackFromBottomManyTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridStackFromBottomManyTest.java
rename to core/tests/coretests/src/android/widget/gridview/GridStackFromBottomManyTest.java
index a0b819e..640737e 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridStackFromBottomManyTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridStackFromBottomManyTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.gridview.GridStackFromBottomMany;
+import android.widget.gridview.GridStackFromBottomMany;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.GridView;
@@ -27,7 +27,7 @@
private GridView mGridView;
public GridStackFromBottomManyTest() {
- super("com.android.frameworktest", GridStackFromBottomMany.class);
+ super("com.android.frameworks.coretests", GridStackFromBottomMany.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridStackFromBottomTest.java b/core/tests/coretests/src/android/widget/gridview/GridStackFromBottomTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridStackFromBottomTest.java
rename to core/tests/coretests/src/android/widget/gridview/GridStackFromBottomTest.java
index 821c7a5..8fec241 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridStackFromBottomTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridStackFromBottomTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.gridview.GridStackFromBottom;
+import android.widget.gridview.GridStackFromBottom;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -27,7 +27,7 @@
private GridView mGridView;
public GridStackFromBottomTest() {
- super("com.android.frameworktest", GridStackFromBottom.class);
+ super("com.android.frameworks.coretests", GridStackFromBottom.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridThrasher.java b/core/tests/coretests/src/android/widget/gridview/GridThrasher.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridThrasher.java
rename to core/tests/coretests/src/android/widget/gridview/GridThrasher.java
index d628f2d..0ef5db9 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridThrasher.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridThrasher.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.content.Context;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridVerticalSpacing.java b/core/tests/coretests/src/android/widget/gridview/GridVerticalSpacing.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridVerticalSpacing.java
rename to core/tests/coretests/src/android/widget/gridview/GridVerticalSpacing.java
index 3f6b8d6..0d01d30 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridVerticalSpacing.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridVerticalSpacing.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.util.GridScenario;
+import android.util.GridScenario;
/**
* A grid with vertical spacing between rows
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridVerticalSpacingStackFromBottom.java b/core/tests/coretests/src/android/widget/gridview/GridVerticalSpacingStackFromBottom.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/gridview/GridVerticalSpacingStackFromBottom.java
rename to core/tests/coretests/src/android/widget/gridview/GridVerticalSpacingStackFromBottom.java
index 1a39ffb..bd68680 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/gridview/GridVerticalSpacingStackFromBottom.java
+++ b/core/tests/coretests/src/android/widget/gridview/GridVerticalSpacingStackFromBottom.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview;
+package android.widget.gridview;
-import com.android.frameworktest.util.GridScenario;
+import android.util.GridScenario;
/**
* A grid with vertical spacing between rows that stacks from the bottom
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchSetSelectionTest.java b/core/tests/coretests/src/android/widget/gridview/touch/GridTouchSetSelectionTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchSetSelectionTest.java
rename to core/tests/coretests/src/android/widget/gridview/touch/GridTouchSetSelectionTest.java
index 926d662..ca789af 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchSetSelectionTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/touch/GridTouchSetSelectionTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview.touch;
+package android.widget.gridview.touch;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -23,7 +23,7 @@
import android.view.View;
import android.widget.GridView;
-import com.android.frameworktest.gridview.GridSimple;
+import android.widget.gridview.GridSimple;
/**
* Tests setting the selection in touch mode
@@ -33,7 +33,7 @@
private GridView mGridView;
public GridTouchSetSelectionTest() {
- super("com.android.frameworktest", GridSimple.class);
+ super("com.android.frameworks.coretests", GridSimple.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchStackFromBottomManyTest.java b/core/tests/coretests/src/android/widget/gridview/touch/GridTouchStackFromBottomManyTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchStackFromBottomManyTest.java
rename to core/tests/coretests/src/android/widget/gridview/touch/GridTouchStackFromBottomManyTest.java
index 710617e..f8e6ae7 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchStackFromBottomManyTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/touch/GridTouchStackFromBottomManyTest.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview.touch;
+package android.widget.gridview.touch;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.TouchUtils;
-import com.android.frameworktest.gridview.GridStackFromBottomMany;
+import android.widget.gridview.GridStackFromBottomMany;
import android.widget.GridView;
import android.view.View;
@@ -30,7 +30,7 @@
private GridView mGridView;
public GridTouchStackFromBottomManyTest() {
- super("com.android.frameworktest", GridStackFromBottomMany.class);
+ super("com.android.frameworks.coretests", GridStackFromBottomMany.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchStackFromBottomTest.java b/core/tests/coretests/src/android/widget/gridview/touch/GridTouchStackFromBottomTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchStackFromBottomTest.java
rename to core/tests/coretests/src/android/widget/gridview/touch/GridTouchStackFromBottomTest.java
index e085105..d8d4e43 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchStackFromBottomTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/touch/GridTouchStackFromBottomTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview.touch;
+package android.widget.gridview.touch;
-import com.android.frameworktest.gridview.GridStackFromBottom;
+import android.widget.gridview.GridStackFromBottom;
import android.test.TouchUtils;
import android.test.suitebuilder.annotation.MediumTest;
@@ -29,7 +29,7 @@
private GridView mGridView;
public GridTouchStackFromBottomTest() {
- super("com.android.frameworktest", GridStackFromBottom.class);
+ super("com.android.frameworks.coretests", GridStackFromBottom.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchVerticalSpacingStackFromBottomTest.java b/core/tests/coretests/src/android/widget/gridview/touch/GridTouchVerticalSpacingStackFromBottomTest.java
similarity index 96%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchVerticalSpacingStackFromBottomTest.java
rename to core/tests/coretests/src/android/widget/gridview/touch/GridTouchVerticalSpacingStackFromBottomTest.java
index d11a39ba..55a66d9 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchVerticalSpacingStackFromBottomTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/touch/GridTouchVerticalSpacingStackFromBottomTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview.touch;
+package android.widget.gridview.touch;
import android.content.Context;
import android.test.ActivityInstrumentationTestCase;
@@ -26,7 +26,7 @@
import android.view.ViewConfiguration;
import android.widget.GridView;
-import com.android.frameworktest.gridview.GridVerticalSpacingStackFromBottom;
+import android.widget.gridview.GridVerticalSpacingStackFromBottom;
public class GridTouchVerticalSpacingStackFromBottomTest extends ActivityInstrumentationTestCase<GridVerticalSpacingStackFromBottom> {
private GridVerticalSpacingStackFromBottom mActivity;
@@ -34,7 +34,7 @@
private ViewConfiguration mViewConfig;
public GridTouchVerticalSpacingStackFromBottomTest() {
- super("com.android.frameworktest", GridVerticalSpacingStackFromBottom.class);
+ super("com.android.frameworks.coretests", GridVerticalSpacingStackFromBottom.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchVerticalSpacingTest.java b/core/tests/coretests/src/android/widget/gridview/touch/GridTouchVerticalSpacingTest.java
similarity index 96%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchVerticalSpacingTest.java
rename to core/tests/coretests/src/android/widget/gridview/touch/GridTouchVerticalSpacingTest.java
index 355c5a4..bae4ee7 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchVerticalSpacingTest.java
+++ b/core/tests/coretests/src/android/widget/gridview/touch/GridTouchVerticalSpacingTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.gridview.touch;
+package android.widget.gridview.touch;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -25,14 +25,14 @@
import android.view.ViewConfiguration;
import android.widget.GridView;
-import com.android.frameworktest.gridview.GridVerticalSpacing;
+import android.widget.gridview.GridVerticalSpacing;
public class GridTouchVerticalSpacingTest extends ActivityInstrumentationTestCase<GridVerticalSpacing> {
private GridVerticalSpacing mActivity;
private GridView mGridView;
public GridTouchVerticalSpacingTest() {
- super("com.android.frameworktest", GridVerticalSpacing.class);
+ super("com.android.frameworks.coretests", GridVerticalSpacing.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/frame/FrameLayoutGravity.java b/core/tests/coretests/src/android/widget/layout/frame/FrameLayoutGravity.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/frame/FrameLayoutGravity.java
rename to core/tests/coretests/src/android/widget/layout/frame/FrameLayoutGravity.java
index 1383dae..9791e36 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/frame/FrameLayoutGravity.java
+++ b/core/tests/coretests/src/android/widget/layout/frame/FrameLayoutGravity.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.frame;
+package android.widget.layout.frame;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/frame/FrameLayoutGravityTest.java b/core/tests/coretests/src/android/widget/layout/frame/FrameLayoutGravityTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/frame/FrameLayoutGravityTest.java
rename to core/tests/coretests/src/android/widget/layout/frame/FrameLayoutGravityTest.java
index 239bd7d..fe4e932 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/frame/FrameLayoutGravityTest.java
+++ b/core/tests/coretests/src/android/widget/layout/frame/FrameLayoutGravityTest.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.frame;
+package android.widget.layout.frame;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.ViewAsserts;
import android.app.Activity;
import android.view.View;
-import com.android.frameworktest.layout.frame.FrameLayoutGravity;
-import com.android.frameworktest.R;
+import android.widget.layout.frame.FrameLayoutGravity;
+import com.android.frameworks.coretests.R;
public class FrameLayoutGravityTest extends ActivityInstrumentationTestCase<FrameLayoutGravity> {
private View mLeftView;
@@ -37,7 +37,7 @@
private View mParent;
public FrameLayoutGravityTest() {
- super("com.android.frameworktest", FrameLayoutGravity.class);
+ super("com.android.frameworks.coretests", FrameLayoutGravity.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/frame/FrameLayoutMargin.java b/core/tests/coretests/src/android/widget/layout/frame/FrameLayoutMargin.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/frame/FrameLayoutMargin.java
rename to core/tests/coretests/src/android/widget/layout/frame/FrameLayoutMargin.java
index 0434726..81b3ea1 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/frame/FrameLayoutMargin.java
+++ b/core/tests/coretests/src/android/widget/layout/frame/FrameLayoutMargin.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.frame;
+package android.widget.layout.frame;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/frame/FrameLayoutMarginTest.java b/core/tests/coretests/src/android/widget/layout/frame/FrameLayoutMarginTest.java
similarity index 92%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/frame/FrameLayoutMarginTest.java
rename to core/tests/coretests/src/android/widget/layout/frame/FrameLayoutMarginTest.java
index 4df4805..c052d65 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/frame/FrameLayoutMarginTest.java
+++ b/core/tests/coretests/src/android/widget/layout/frame/FrameLayoutMarginTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.frame;
+package android.widget.layout.frame;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -22,8 +22,8 @@
import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
-import com.android.frameworktest.layout.frame.FrameLayoutMargin;
-import com.android.frameworktest.R;
+import android.widget.layout.frame.FrameLayoutMargin;
+import com.android.frameworks.coretests.R;
public class FrameLayoutMarginTest extends ActivityInstrumentationTestCase<FrameLayoutMargin> {
private View mLeftView;
@@ -33,7 +33,7 @@
private View mParent;
public FrameLayoutMarginTest() {
- super("com.android.frameworktest", FrameLayoutMargin.class);
+ super("com.android.frameworks.coretests", FrameLayoutMargin.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/BaselineAlignmentCenterGravity.java b/core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentCenterGravity.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/BaselineAlignmentCenterGravity.java
rename to core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentCenterGravity.java
index 5087c62..766dd0a 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/BaselineAlignmentCenterGravity.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentCenterGravity.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineAlignmentCenterGravityTest.java b/core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentCenterGravityTest.java
similarity index 90%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineAlignmentCenterGravityTest.java
rename to core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentCenterGravityTest.java
index 0b6360e..079e9d0 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineAlignmentCenterGravityTest.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentCenterGravityTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
import android.app.Activity;
import android.test.ActivityInstrumentationTestCase;
@@ -23,8 +23,8 @@
import android.view.View;
import android.widget.Button;
-import com.android.frameworktest.R;
-import com.android.frameworktest.layout.linear.BaselineAlignmentCenterGravity;
+import com.android.frameworks.coretests.R;
+import android.widget.layout.linear.BaselineAlignmentCenterGravity;
public class BaselineAlignmentCenterGravityTest extends ActivityInstrumentationTestCase<BaselineAlignmentCenterGravity> {
private Button mButton1;
@@ -32,7 +32,7 @@
private Button mButton3;
public BaselineAlignmentCenterGravityTest() {
- super("com.android.frameworktest", BaselineAlignmentCenterGravity.class);
+ super("com.android.frameworks.coretests", BaselineAlignmentCenterGravity.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineAlignmentSpinnerButton.java b/core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentSpinnerButton.java
similarity index 85%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineAlignmentSpinnerButton.java
rename to core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentSpinnerButton.java
index 050e053..c3bfe3a 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineAlignmentSpinnerButton.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentSpinnerButton.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
import android.app.Activity;
import android.test.ActivityInstrumentationTestCase;
@@ -22,15 +22,15 @@
import android.test.ViewAsserts;
import android.view.View;
-import com.android.frameworktest.R;
-import com.android.frameworktest.layout.linear.HorizontalOrientationVerticalAlignment;
+import com.android.frameworks.coretests.R;
+import android.widget.layout.linear.HorizontalOrientationVerticalAlignment;
public class BaselineAlignmentSpinnerButton extends ActivityInstrumentationTestCase<HorizontalOrientationVerticalAlignment> {
private View mSpinner;
private View mButton;
public BaselineAlignmentSpinnerButton() {
- super("com.android.frameworktest", HorizontalOrientationVerticalAlignment.class);
+ super("com.android.frameworks.coretests", HorizontalOrientationVerticalAlignment.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/BaselineAlignmentZeroWidthAndWeight.java b/core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentZeroWidthAndWeight.java
similarity index 92%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/BaselineAlignmentZeroWidthAndWeight.java
rename to core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentZeroWidthAndWeight.java
index 3c1d7fd..5ed5e71 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/BaselineAlignmentZeroWidthAndWeight.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentZeroWidthAndWeight.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineAlignmentZeroWidthAndWeightTest.java b/core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentZeroWidthAndWeightTest.java
similarity index 85%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineAlignmentZeroWidthAndWeightTest.java
rename to core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentZeroWidthAndWeightTest.java
index a315d81..2dd2bb8 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineAlignmentZeroWidthAndWeightTest.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/BaselineAlignmentZeroWidthAndWeightTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
-import com.android.frameworktest.R;
-import com.android.frameworktest.layout.linear.BaselineAlignmentZeroWidthAndWeight;
-import com.android.frameworktest.layout.linear.ExceptionTextView;
+import com.android.frameworks.coretests.R;
+import android.widget.layout.linear.BaselineAlignmentZeroWidthAndWeight;
+import android.widget.layout.linear.ExceptionTextView;
import android.app.Activity;
import android.test.ActivityInstrumentationTestCase;
@@ -30,7 +30,7 @@
private Button mShowButton;
public BaselineAlignmentZeroWidthAndWeightTest() {
- super("com.android.frameworktest", BaselineAlignmentZeroWidthAndWeight.class);
+ super("com.android.frameworks.coretests", BaselineAlignmentZeroWidthAndWeight.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/BaselineButtons.java b/core/tests/coretests/src/android/widget/layout/linear/BaselineButtons.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/BaselineButtons.java
rename to core/tests/coretests/src/android/widget/layout/linear/BaselineButtons.java
index 9bb9bff..c9ad831 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/BaselineButtons.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/BaselineButtons.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineButtonsTest.java b/core/tests/coretests/src/android/widget/layout/linear/BaselineButtonsTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineButtonsTest.java
rename to core/tests/coretests/src/android/widget/layout/linear/BaselineButtonsTest.java
index 9f2e138..6f1fc90 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineButtonsTest.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/BaselineButtonsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
import android.app.Activity;
import android.test.ActivityInstrumentationTestCase;
@@ -22,8 +22,8 @@
import android.view.View;
import android.widget.ImageButton;
-import com.android.frameworktest.R;
-import com.android.frameworktest.layout.linear.BaselineButtons;
+import com.android.frameworks.coretests.R;
+import android.widget.layout.linear.BaselineButtons;
public class BaselineButtonsTest extends ActivityInstrumentationTestCase<BaselineButtons> {
private View mCurrentTime;
@@ -34,7 +34,7 @@
private View mLayout;
public BaselineButtonsTest() {
- super("com.android.frameworktest", BaselineButtons.class);
+ super("com.android.frameworks.coretests", BaselineButtons.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/ExceptionTextView.java b/core/tests/coretests/src/android/widget/layout/linear/ExceptionTextView.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/ExceptionTextView.java
rename to core/tests/coretests/src/android/widget/layout/linear/ExceptionTextView.java
index 54f6b98..9fa9be9 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/ExceptionTextView.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/ExceptionTextView.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
import junit.framework.Assert;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/FillInWrap.java b/core/tests/coretests/src/android/widget/layout/linear/FillInWrap.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/FillInWrap.java
rename to core/tests/coretests/src/android/widget/layout/linear/FillInWrap.java
index a95cf17..50aa5b7 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/FillInWrap.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/FillInWrap.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/FillInWrapTest.java b/core/tests/coretests/src/android/widget/layout/linear/FillInWrapTest.java
similarity index 90%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/FillInWrapTest.java
rename to core/tests/coretests/src/android/widget/layout/linear/FillInWrapTest.java
index 0e7a4a0..f161802 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/FillInWrapTest.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/FillInWrapTest.java
@@ -14,21 +14,21 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
import android.app.Activity;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.View;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
public class FillInWrapTest extends ActivityInstrumentationTestCase<FillInWrap> {
private View mChild;
private View mContainer;
public FillInWrapTest() {
- super("com.android.frameworktest", FillInWrap.class);
+ super("com.android.frameworks.coretests", FillInWrap.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/HorizontalOrientationVerticalAlignment.java b/core/tests/coretests/src/android/widget/layout/linear/HorizontalOrientationVerticalAlignment.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/HorizontalOrientationVerticalAlignment.java
rename to core/tests/coretests/src/android/widget/layout/linear/HorizontalOrientationVerticalAlignment.java
index 1308b8b..9f937a9 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/HorizontalOrientationVerticalAlignment.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/HorizontalOrientationVerticalAlignment.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLEditTextThenButton.java b/core/tests/coretests/src/android/widget/layout/linear/LLEditTextThenButton.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLEditTextThenButton.java
rename to core/tests/coretests/src/android/widget/layout/linear/LLEditTextThenButton.java
index db868cb..fe2525f 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLEditTextThenButton.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/LLEditTextThenButton.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLOfButtons1.java b/core/tests/coretests/src/android/widget/layout/linear/LLOfButtons1.java
similarity index 95%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLOfButtons1.java
rename to core/tests/coretests/src/android/widget/layout/linear/LLOfButtons1.java
index 33189e5..3d0144f 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLOfButtons1.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/LLOfButtons1.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
import android.app.Activity;
import android.os.Bundle;
@@ -22,7 +22,7 @@
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* One of two simple vertical linear layouts of buttons used to test out
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLOfButtons2.java b/core/tests/coretests/src/android/widget/layout/linear/LLOfButtons2.java
similarity index 93%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLOfButtons2.java
rename to core/tests/coretests/src/android/widget/layout/linear/LLOfButtons2.java
index 1e0c97a..77f564d 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLOfButtons2.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/LLOfButtons2.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
/**
* One of two simple vertical linear layouts of buttons used to test out
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLOfTwoFocusableInTouchMode.java b/core/tests/coretests/src/android/widget/layout/linear/LLOfTwoFocusableInTouchMode.java
similarity index 96%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLOfTwoFocusableInTouchMode.java
rename to core/tests/coretests/src/android/widget/layout/linear/LLOfTwoFocusableInTouchMode.java
index 201c8f9..1ba56ba 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLOfTwoFocusableInTouchMode.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/LLOfTwoFocusableInTouchMode.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LinearLayoutEditTexts.java b/core/tests/coretests/src/android/widget/layout/linear/LinearLayoutEditTexts.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LinearLayoutEditTexts.java
rename to core/tests/coretests/src/android/widget/layout/linear/LinearLayoutEditTexts.java
index 4877a63..90db788 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LinearLayoutEditTexts.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/LinearLayoutEditTexts.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/LinearLayoutEditTextsTest.java b/core/tests/coretests/src/android/widget/layout/linear/LinearLayoutEditTextsTest.java
similarity index 87%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/LinearLayoutEditTextsTest.java
rename to core/tests/coretests/src/android/widget/layout/linear/LinearLayoutEditTextsTest.java
index 9dde62c..d5998b7 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/LinearLayoutEditTextsTest.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/LinearLayoutEditTextsTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
-import com.android.frameworktest.layout.linear.LinearLayoutEditTexts;
-import com.android.frameworktest.R;
+import android.widget.layout.linear.LinearLayoutEditTexts;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -29,7 +29,7 @@
private View mContainer;
public LinearLayoutEditTextsTest() {
- super("com.android.frameworktest", LinearLayoutEditTexts.class);
+ super("com.android.frameworks.coretests", LinearLayoutEditTexts.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/Weight.java b/core/tests/coretests/src/android/widget/layout/linear/Weight.java
similarity index 90%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/Weight.java
rename to core/tests/coretests/src/android/widget/layout/linear/Weight.java
index 0535f00..20edd7c 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/Weight.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/Weight.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/WeightSum.java b/core/tests/coretests/src/android/widget/layout/linear/WeightSum.java
similarity index 90%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/linear/WeightSum.java
rename to core/tests/coretests/src/android/widget/layout/linear/WeightSum.java
index 8b9a497..2e421da 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/linear/WeightSum.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/WeightSum.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/WeightSumTest.java b/core/tests/coretests/src/android/widget/layout/linear/WeightSumTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/WeightSumTest.java
rename to core/tests/coretests/src/android/widget/layout/linear/WeightSumTest.java
index a51743b..f9a94ce 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/WeightSumTest.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/WeightSumTest.java
@@ -14,22 +14,22 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
import android.app.Activity;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.View;
-import com.android.frameworktest.R;
-import com.android.frameworktest.layout.linear.WeightSum;
+import com.android.frameworks.coretests.R;
+import android.widget.layout.linear.WeightSum;
public class WeightSumTest extends ActivityInstrumentationTestCase<WeightSum> {
private View mChild;
private View mContainer;
public WeightSumTest() {
- super("com.android.frameworktest", WeightSum.class);
+ super("com.android.frameworks.coretests", WeightSum.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/WeightTest.java b/core/tests/coretests/src/android/widget/layout/linear/WeightTest.java
similarity index 87%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/WeightTest.java
rename to core/tests/coretests/src/android/widget/layout/linear/WeightTest.java
index f7fec78..0349d7f 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/WeightTest.java
+++ b/core/tests/coretests/src/android/widget/layout/linear/WeightTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.linear;
+package android.widget.layout.linear;
import android.app.Activity;
import android.test.ActivityInstrumentationTestCase;
@@ -22,15 +22,15 @@
import android.test.ViewAsserts;
import android.view.View;
-import com.android.frameworktest.R;
-import com.android.frameworktest.layout.linear.Weight;
+import com.android.frameworks.coretests.R;
+import android.widget.layout.linear.Weight;
public class WeightTest extends ActivityInstrumentationTestCase<Weight> {
private View mChild;
private View mContainer;
public WeightTest() {
- super("com.android.frameworktest", Weight.class);
+ super("com.android.frameworks.coretests", Weight.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/table/AddColumn.java b/core/tests/coretests/src/android/widget/layout/table/AddColumn.java
similarity index 95%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/table/AddColumn.java
rename to core/tests/coretests/src/android/widget/layout/table/AddColumn.java
index c490e0f..400c32c 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/table/AddColumn.java
+++ b/core/tests/coretests/src/android/widget/layout/table/AddColumn.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.table;
+package android.widget.layout.table;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/AddColumnTest.java b/core/tests/coretests/src/android/widget/layout/table/AddColumnTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/AddColumnTest.java
rename to core/tests/coretests/src/android/widget/layout/table/AddColumnTest.java
index 9d713c8..bfb4d17 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/AddColumnTest.java
+++ b/core/tests/coretests/src/android/widget/layout/table/AddColumnTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.table;
+package android.widget.layout.table;
-import com.android.frameworktest.layout.table.AddColumn;
-import com.android.frameworktest.R;
+import android.widget.layout.table.AddColumn;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -27,7 +27,7 @@
import android.widget.TableRow;
/**
- * {@link com.android.frameworktest.layout.table.AddColumn} is
+ * {@link android.widget.layout.table.AddColumn} is
* setup to exercise the case of adding row programmatically in a table.
*/
public class AddColumnTest extends ActivityInstrumentationTestCase<AddColumn> {
@@ -35,7 +35,7 @@
private TableLayout mTable;
public AddColumnTest() {
- super("com.android.frameworktest", AddColumn.class);
+ super("com.android.frameworks.coretests", AddColumn.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/table/CellSpan.java b/core/tests/coretests/src/android/widget/layout/table/CellSpan.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/table/CellSpan.java
rename to core/tests/coretests/src/android/widget/layout/table/CellSpan.java
index 243efc7..d91cf56 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/table/CellSpan.java
+++ b/core/tests/coretests/src/android/widget/layout/table/CellSpan.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.table;
+package android.widget.layout.table;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/CellSpanTest.java b/core/tests/coretests/src/android/widget/layout/table/CellSpanTest.java
similarity index 90%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/CellSpanTest.java
rename to core/tests/coretests/src/android/widget/layout/table/CellSpanTest.java
index 85f9c2c..331ec45 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/CellSpanTest.java
+++ b/core/tests/coretests/src/android/widget/layout/table/CellSpanTest.java
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.table;
+package android.widget.layout.table;
-import com.android.frameworktest.layout.table.CellSpan;
-import com.android.frameworktest.R;
+import android.widget.layout.table.CellSpan;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.View;
/**
- * {@link com.android.frameworktest.layout.table.CellSpan} is
+ * {@link android.widget.layout.table.CellSpan} is
* setup to exercise tables in which cells use spanning.
*/
public class CellSpanTest extends ActivityInstrumentationTestCase<CellSpan> {
@@ -36,7 +36,7 @@
private View mSpan;
public CellSpanTest() {
- super("com.android.frameworktest", CellSpan.class);
+ super("com.android.frameworks.coretests", CellSpan.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/table/FixedWidth.java b/core/tests/coretests/src/android/widget/layout/table/FixedWidth.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/table/FixedWidth.java
rename to core/tests/coretests/src/android/widget/layout/table/FixedWidth.java
index 2e2defc..435815a4 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/table/FixedWidth.java
+++ b/core/tests/coretests/src/android/widget/layout/table/FixedWidth.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.table;
+package android.widget.layout.table;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/FixedWidthTest.java b/core/tests/coretests/src/android/widget/layout/table/FixedWidthTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/FixedWidthTest.java
rename to core/tests/coretests/src/android/widget/layout/table/FixedWidthTest.java
index 3ca03b7..b20ec84 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/FixedWidthTest.java
+++ b/core/tests/coretests/src/android/widget/layout/table/FixedWidthTest.java
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.table;
+package android.widget.layout.table;
-import com.android.frameworktest.layout.table.FixedWidth;
-import com.android.frameworktest.R;
+import android.widget.layout.table.FixedWidth;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.View;
/**
- * {@link com.android.frameworktest.layout.table.FixedWidth} is
+ * {@link android.widget.layout.table.FixedWidth} is
* setup to exercise tables in which cells use fixed width and height.
*/
public class FixedWidthTest extends ActivityInstrumentationTestCase<FixedWidth> {
@@ -33,7 +33,7 @@
private View mNonFixedWidth;
public FixedWidthTest() {
- super("com.android.frameworktest", FixedWidth.class);
+ super("com.android.frameworks.coretests", FixedWidth.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/table/HorizontalGravity.java b/core/tests/coretests/src/android/widget/layout/table/HorizontalGravity.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/table/HorizontalGravity.java
rename to core/tests/coretests/src/android/widget/layout/table/HorizontalGravity.java
index fdafa12..1444f60f 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/table/HorizontalGravity.java
+++ b/core/tests/coretests/src/android/widget/layout/table/HorizontalGravity.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.table;
+package android.widget.layout.table;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/HorizontalGravityTest.java b/core/tests/coretests/src/android/widget/layout/table/HorizontalGravityTest.java
similarity index 87%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/HorizontalGravityTest.java
rename to core/tests/coretests/src/android/widget/layout/table/HorizontalGravityTest.java
index 1355cb3..964df82 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/HorizontalGravityTest.java
+++ b/core/tests/coretests/src/android/widget/layout/table/HorizontalGravityTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.table;
+package android.widget.layout.table;
-import com.android.frameworktest.layout.table.HorizontalGravity;
-import com.android.frameworktest.R;
+import android.widget.layout.table.HorizontalGravity;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -25,7 +25,7 @@
import android.view.View;
/**
- * {@link com.android.frameworktest.layout.table.HorizontalGravity} is
+ * {@link android.widget.layout.table.HorizontalGravity} is
* setup to exercise tables in which cells use horizontal gravity.
*/
public class HorizontalGravityTest extends ActivityInstrumentationTestCase<HorizontalGravity> {
@@ -35,7 +35,7 @@
private View mLeft;
public HorizontalGravityTest() {
- super("com.android.frameworktest", HorizontalGravity.class);
+ super("com.android.frameworks.coretests", HorizontalGravity.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/table/VerticalGravity.java b/core/tests/coretests/src/android/widget/layout/table/VerticalGravity.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/table/VerticalGravity.java
rename to core/tests/coretests/src/android/widget/layout/table/VerticalGravity.java
index 1f161d9..4fdb378 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/table/VerticalGravity.java
+++ b/core/tests/coretests/src/android/widget/layout/table/VerticalGravity.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.table;
+package android.widget.layout.table;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/VerticalGravityTest.java b/core/tests/coretests/src/android/widget/layout/table/VerticalGravityTest.java
similarity index 89%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/VerticalGravityTest.java
rename to core/tests/coretests/src/android/widget/layout/table/VerticalGravityTest.java
index d731243..1d6be3f 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/VerticalGravityTest.java
+++ b/core/tests/coretests/src/android/widget/layout/table/VerticalGravityTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.table;
+package android.widget.layout.table;
-import com.android.frameworktest.layout.table.VerticalGravity;
-import com.android.frameworktest.R;
+import android.widget.layout.table.VerticalGravity;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -26,7 +26,7 @@
import android.view.View;
/**
- * {@link com.android.frameworktest.layout.table.VerticalGravity} is
+ * {@link android.widget.layout.table.VerticalGravity} is
* setup to exercise tables in which cells use vertical gravity.
*/
public class VerticalGravityTest extends ActivityInstrumentationTestCase<VerticalGravity> {
@@ -38,7 +38,7 @@
private View mBottom;
public VerticalGravityTest() {
- super("com.android.frameworktest", VerticalGravity.class);
+ super("com.android.frameworks.coretests", VerticalGravity.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/layout/table/Weight.java b/core/tests/coretests/src/android/widget/layout/table/Weight.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/layout/table/Weight.java
rename to core/tests/coretests/src/android/widget/layout/table/Weight.java
index 4c3835f..6d4d51d 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/layout/table/Weight.java
+++ b/core/tests/coretests/src/android/widget/layout/table/Weight.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.table;
+package android.widget.layout.table;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/WeightTest.java b/core/tests/coretests/src/android/widget/layout/table/WeightTest.java
similarity index 86%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/WeightTest.java
rename to core/tests/coretests/src/android/widget/layout/table/WeightTest.java
index 9e20686..b665573 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/WeightTest.java
+++ b/core/tests/coretests/src/android/widget/layout/table/WeightTest.java
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-package com.android.frameworktest.layout.table;
+package android.widget.layout.table;
-import com.android.frameworktest.layout.table.Weight;
-import com.android.frameworktest.R;
+import android.widget.layout.table.Weight;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.View;
/**
- * {@link com.android.frameworktest.layout.table.Weight} is
+ * {@link android.widget.layout.table.Weight} is
* setup to exercise tables in which cells use a weight.
*/
public class WeightTest extends ActivityInstrumentationTestCase<Weight> {
@@ -34,7 +34,7 @@
private View mRow;
public WeightTest() {
- super("com.android.frameworktest", Weight.class);
+ super("com.android.frameworks.coretests", Weight.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/AdjacentListsWithAdjacentISVsInside.java b/core/tests/coretests/src/android/widget/listview/AdjacentListsWithAdjacentISVsInside.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/AdjacentListsWithAdjacentISVsInside.java
rename to core/tests/coretests/src/android/widget/listview/AdjacentListsWithAdjacentISVsInside.java
index 5c38ef0..98fbed3 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/AdjacentListsWithAdjacentISVsInside.java
+++ b/core/tests/coretests/src/android/widget/listview/AdjacentListsWithAdjacentISVsInside.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.InternalSelectionView;
+import android.util.InternalSelectionView;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListBottomGravity.java b/core/tests/coretests/src/android/widget/listview/ListBottomGravity.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListBottomGravity.java
rename to core/tests/coretests/src/android/widget/listview/ListBottomGravity.java
index e729d52..a386ebd 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListBottomGravity.java
+++ b/core/tests/coretests/src/android/widget/listview/ListBottomGravity.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.view.Gravity;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* Basic bottom gravity scenario, nothing fancy. Items do not
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListBottomGravityMany.java b/core/tests/coretests/src/android/widget/listview/ListBottomGravityMany.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListBottomGravityMany.java
rename to core/tests/coretests/src/android/widget/listview/ListBottomGravityMany.java
index 1225b9a..519816c 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListBottomGravityMany.java
+++ b/core/tests/coretests/src/android/widget/listview/ListBottomGravityMany.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.view.Gravity;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* Basic bottom gravity scenario, nothing fancy. There are
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListBottomGravityManyTest.java b/core/tests/coretests/src/android/widget/listview/ListBottomGravityManyTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListBottomGravityManyTest.java
rename to core/tests/coretests/src/android/widget/listview/ListBottomGravityManyTest.java
index d36e343..e1171eb 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListBottomGravityManyTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListBottomGravityManyTest.java
@@ -14,20 +14,20 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListBottomGravityMany;
+import android.widget.listview.ListBottomGravityMany;
public class ListBottomGravityManyTest extends ActivityInstrumentationTestCase<ListBottomGravityMany> {
private ListBottomGravityMany mActivity;
private ListView mListView;
public ListBottomGravityManyTest() {
- super("com.android.frameworktest", ListBottomGravityMany.class);
+ super("com.android.frameworks.coretests", ListBottomGravityMany.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListBottomGravityTest.java b/core/tests/coretests/src/android/widget/listview/ListBottomGravityTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListBottomGravityTest.java
rename to core/tests/coretests/src/android/widget/listview/ListBottomGravityTest.java
index 79556cf..c595f62 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListBottomGravityTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListBottomGravityTest.java
@@ -14,20 +14,20 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListBottomGravity;
+import android.widget.listview.ListBottomGravity;
public class ListBottomGravityTest extends ActivityInstrumentationTestCase<ListBottomGravity> {
private ListBottomGravity mActivity;
private ListView mListView;
public ListBottomGravityTest() {
- super("com.android.frameworktest", ListBottomGravity.class);
+ super("com.android.frameworks.coretests", ListBottomGravity.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListButtonsDiagonalAcrossItems.java b/core/tests/coretests/src/android/widget/listview/ListButtonsDiagonalAcrossItems.java
similarity index 88%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListButtonsDiagonalAcrossItems.java
rename to core/tests/coretests/src/android/widget/listview/ListButtonsDiagonalAcrossItems.java
index bda2cd1..bbed73c 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListButtonsDiagonalAcrossItems.java
+++ b/core/tests/coretests/src/android/widget/listview/ListButtonsDiagonalAcrossItems.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListItemFactory;
-import static com.android.frameworktest.util.ListItemFactory.Slot;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListItemFactory;
+import static android.util.ListItemFactory.Slot;
+import android.util.ListScenario;
import android.view.View;
import android.view.ViewGroup;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListDividers.java b/core/tests/coretests/src/android/widget/listview/ListDividers.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListDividers.java
rename to core/tests/coretests/src/android/widget/listview/ListDividers.java
index 62045d8..3928c03 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListDividers.java
+++ b/core/tests/coretests/src/android/widget/listview/ListDividers.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Exercises a list width dividers and padding.
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListEmptyViewTest.java b/core/tests/coretests/src/android/widget/listview/ListEmptyViewTest.java
similarity index 97%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListEmptyViewTest.java
rename to core/tests/coretests/src/android/widget/listview/ListEmptyViewTest.java
index ca12154..258d3ef 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListEmptyViewTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListEmptyViewTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.Instrumentation;
import android.content.Intent;
@@ -31,7 +31,7 @@
public ListEmptyViewTest() {
- super("com.android.frameworktest", ListWithEmptyView.class);
+ super("com.android.frameworks.coretests", ListWithEmptyView.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListEndingWithMultipleSeparators.java b/core/tests/coretests/src/android/widget/listview/ListEndingWithMultipleSeparators.java
similarity index 90%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListEndingWithMultipleSeparators.java
rename to core/tests/coretests/src/android/widget/listview/ListEndingWithMultipleSeparators.java
index 4ab1eef6..85f9924 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListEndingWithMultipleSeparators.java
+++ b/core/tests/coretests/src/android/widget/listview/ListEndingWithMultipleSeparators.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
public class ListEndingWithMultipleSeparators extends ListScenario {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListFilter.java b/core/tests/coretests/src/android/widget/listview/ListFilter.java
similarity index 98%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListFilter.java
rename to core/tests/coretests/src/android/widget/listview/ListFilter.java
index b164d86..9e9d1b0 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListFilter.java
+++ b/core/tests/coretests/src/android/widget/listview/ListFilter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.ListActivity;
import android.os.Bundle;
@@ -23,7 +23,7 @@
import android.widget.ArrayAdapter;
import android.widget.Button;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListFocusableTest.java b/core/tests/coretests/src/android/widget/listview/ListFocusableTest.java
similarity index 97%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListFocusableTest.java
rename to core/tests/coretests/src/android/widget/listview/ListFocusableTest.java
index 1bb1f1c..bf18a13 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListFocusableTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListFocusableTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -27,7 +27,7 @@
private ListView mListView;
public ListFocusableTest() {
- super("com.android.frameworktest", ListTopGravity.class);
+ super("com.android.frameworks.coretests", ListTopGravity.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListGetSelectedView.java b/core/tests/coretests/src/android/widget/listview/ListGetSelectedView.java
similarity index 90%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListGetSelectedView.java
rename to core/tests/coretests/src/android/widget/listview/ListGetSelectedView.java
index 28fa21a..5639195 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListGetSelectedView.java
+++ b/core/tests/coretests/src/android/widget/listview/ListGetSelectedView.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* Basic top gravity scenario. This test is made to check that getSelectedView() will return
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListHeterogeneous.java b/core/tests/coretests/src/android/widget/listview/ListHeterogeneous.java
similarity index 93%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListHeterogeneous.java
rename to core/tests/coretests/src/android/widget/listview/ListHeterogeneous.java
index 93abd78..1f59c30 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListHeterogeneous.java
+++ b/core/tests/coretests/src/android/widget/listview/ListHeterogeneous.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.view.View;
import android.view.ViewGroup;
-import com.android.frameworktest.util.ListItemFactory;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListItemFactory;
+import android.util.ListScenario;
/**
* List that has different view types
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListHeterogeneousTest.java b/core/tests/coretests/src/android/widget/listview/ListHeterogeneousTest.java
similarity index 92%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListHeterogeneousTest.java
rename to core/tests/coretests/src/android/widget/listview/ListHeterogeneousTest.java
index 0e48993..01b39db 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListHeterogeneousTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListHeterogeneousTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase;
@@ -23,7 +23,7 @@
import android.view.KeyEvent;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListHeterogeneous;
+import android.widget.listview.ListHeterogeneous;
public class ListHeterogeneousTest extends ActivityInstrumentationTestCase<ListHeterogeneous> {
private ListHeterogeneous mActivity;
@@ -31,7 +31,7 @@
public ListHeterogeneousTest() {
- super("com.android.frameworktest", ListHeterogeneous.class);
+ super("com.android.frameworks.coretests", ListHeterogeneous.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListHorizontalFocusWithinItemWins.java b/core/tests/coretests/src/android/widget/listview/ListHorizontalFocusWithinItemWins.java
similarity index 89%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListHorizontalFocusWithinItemWins.java
rename to core/tests/coretests/src/android/widget/listview/ListHorizontalFocusWithinItemWins.java
index c5e1e97..2ff65de 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListHorizontalFocusWithinItemWins.java
+++ b/core/tests/coretests/src/android/widget/listview/ListHorizontalFocusWithinItemWins.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListItemFactory;
-import static com.android.frameworktest.util.ListItemFactory.Slot;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListItemFactory;
+import static android.util.ListItemFactory.Slot;
+import android.util.ListScenario;
import android.content.Context;
import android.view.View;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListInHorizontal.java b/core/tests/coretests/src/android/widget/listview/ListInHorizontal.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListInHorizontal.java
rename to core/tests/coretests/src/android/widget/listview/ListInHorizontal.java
index 2128746..5f09ff6 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListInHorizontal.java
+++ b/core/tests/coretests/src/android/widget/listview/ListInHorizontal.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.Activity;
import android.os.Bundle;
@@ -24,7 +24,7 @@
import android.widget.TextView;
import android.widget.ListView;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Exercises a list in a horizontal linear layout
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListInHorizontalTest.java b/core/tests/coretests/src/android/widget/listview/ListInHorizontalTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListInHorizontalTest.java
rename to core/tests/coretests/src/android/widget/listview/ListInHorizontalTest.java
index 1432576..3643f79 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListInHorizontalTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListInHorizontalTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.listview.ListInHorizontal;
+import android.widget.listview.ListInHorizontal;
public class ListInHorizontalTest extends ListUnspecifiedMeasure<ListInHorizontal> {
public ListInHorizontalTest() {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListInVertical.java b/core/tests/coretests/src/android/widget/listview/ListInVertical.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListInVertical.java
rename to core/tests/coretests/src/android/widget/listview/ListInVertical.java
index f4c93c8..3b4885a 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListInVertical.java
+++ b/core/tests/coretests/src/android/widget/listview/ListInVertical.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.Activity;
import android.os.Bundle;
@@ -24,7 +24,7 @@
import android.widget.TextView;
import android.widget.ListView;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Exercises a list in a vertical linear layout
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListInVerticalTest.java b/core/tests/coretests/src/android/widget/listview/ListInVerticalTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListInVerticalTest.java
rename to core/tests/coretests/src/android/widget/listview/ListInVerticalTest.java
index 73078b9..8586429 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListInVerticalTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListInVerticalTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.listview.ListInVertical;
+import android.widget.listview.ListInVertical;
public class ListInVerticalTest extends ListUnspecifiedMeasure<ListInVertical> {
public ListInVerticalTest() {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListInterleaveFocusables.java b/core/tests/coretests/src/android/widget/listview/ListInterleaveFocusables.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListInterleaveFocusables.java
rename to core/tests/coretests/src/android/widget/listview/ListInterleaveFocusables.java
index e45297e..d5da28e 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListInterleaveFocusables.java
+++ b/core/tests/coretests/src/android/widget/listview/ListInterleaveFocusables.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.collect.Sets;
- import com.android.frameworktest.util.ListScenario;
- import com.android.frameworktest.util.ListItemFactory;
+ import android.util.ListScenario;
+ import android.util.ListItemFactory;
import java.util.Set;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemFocusableAboveUnfocusable.java b/core/tests/coretests/src/android/widget/listview/ListItemFocusableAboveUnfocusable.java
similarity index 90%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemFocusableAboveUnfocusable.java
rename to core/tests/coretests/src/android/widget/listview/ListItemFocusableAboveUnfocusable.java
index e14da5b..f7c01b1 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemFocusableAboveUnfocusable.java
+++ b/core/tests/coretests/src/android/widget/listview/ListItemFocusableAboveUnfocusable.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
-import com.android.frameworktest.util.ListItemFactory;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListItemFactory;
+import android.util.ListScenario;
/**
* A list where the items may befocusable, but the second item isn't actually focusabe.
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemFocusablesClose.java b/core/tests/coretests/src/android/widget/listview/ListItemFocusablesClose.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemFocusablesClose.java
rename to core/tests/coretests/src/android/widget/listview/ListItemFocusablesClose.java
index e20f633..b529b2e 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemFocusablesClose.java
+++ b/core/tests/coretests/src/android/widget/listview/ListItemFocusablesClose.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
-import com.android.frameworktest.util.ListItemFactory;
+import android.util.ListScenario;
+import android.util.ListItemFactory;
import android.view.View;
import android.view.ViewGroup;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemFocusablesFarApart.java b/core/tests/coretests/src/android/widget/listview/ListItemFocusablesFarApart.java
similarity index 89%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemFocusablesFarApart.java
rename to core/tests/coretests/src/android/widget/listview/ListItemFocusablesFarApart.java
index e974478..59987ec 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemFocusablesFarApart.java
+++ b/core/tests/coretests/src/android/widget/listview/ListItemFocusablesFarApart.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.view.View;
import android.view.ViewGroup;
-import com.android.frameworktest.util.ListItemFactory;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListItemFactory;
+import android.util.ListScenario;
/**
* A list where each item is tall with buttons that are farther apart than the screen
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemISVAndButton.java b/core/tests/coretests/src/android/widget/listview/ListItemISVAndButton.java
similarity index 93%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemISVAndButton.java
rename to core/tests/coretests/src/android/widget/listview/ListItemISVAndButton.java
index ceb94b7..ea2c5f2 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemISVAndButton.java
+++ b/core/tests/coretests/src/android/widget/listview/ListItemISVAndButton.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.content.Context;
import android.view.View;
@@ -22,8 +22,8 @@
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
-import com.android.frameworktest.util.InternalSelectionView;
-import com.android.frameworktest.util.ListScenario;
+import android.util.InternalSelectionView;
+import android.util.ListScenario;
/**
* Each item is an internal selection view, a button, and some filler
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListItemRequestRectAboveThinFirstItemTest.java b/core/tests/coretests/src/android/widget/listview/ListItemRequestRectAboveThinFirstItemTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListItemRequestRectAboveThinFirstItemTest.java
rename to core/tests/coretests/src/android/widget/listview/ListItemRequestRectAboveThinFirstItemTest.java
index 16c4d39..072ac6c 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListItemRequestRectAboveThinFirstItemTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListItemRequestRectAboveThinFirstItemTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.graphics.Rect;
import android.test.ActivityInstrumentationTestCase;
@@ -23,14 +23,14 @@
import android.view.View;
import android.view.KeyEvent;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListOfThinItems;
+import android.widget.listview.ListOfThinItems;
public class ListItemRequestRectAboveThinFirstItemTest
extends ActivityInstrumentationTestCase<ListOfThinItems> {
private ListView mListView;
public ListItemRequestRectAboveThinFirstItemTest() {
- super("com.android.frameworktest", ListOfThinItems.class);
+ super("com.android.frameworks.coretests", ListOfThinItems.class);
}
protected void setUp() throws Exception {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemsExpandOnSelection.java b/core/tests/coretests/src/android/widget/listview/ListItemsExpandOnSelection.java
similarity index 95%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemsExpandOnSelection.java
rename to core/tests/coretests/src/android/widget/listview/ListItemsExpandOnSelection.java
index b0ad5e9..a5fe17a 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemsExpandOnSelection.java
+++ b/core/tests/coretests/src/android/widget/listview/ListItemsExpandOnSelection.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.content.Context;
import android.view.View;
@@ -22,7 +22,7 @@
import android.widget.AbsListView;
import android.widget.TextView;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* A list where each item expands by 1.5 when selected.
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListLastItemPartiallyVisible.java b/core/tests/coretests/src/android/widget/listview/ListLastItemPartiallyVisible.java
similarity index 90%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListLastItemPartiallyVisible.java
rename to core/tests/coretests/src/android/widget/listview/ListLastItemPartiallyVisible.java
index 23b76a9..d733749 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListLastItemPartiallyVisible.java
+++ b/core/tests/coretests/src/android/widget/listview/ListLastItemPartiallyVisible.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* A list where the very last item is partially visible, but still requires scrolling
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListManagedCursor.java b/core/tests/coretests/src/android/widget/listview/ListManagedCursor.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListManagedCursor.java
rename to core/tests/coretests/src/android/widget/listview/ListManagedCursor.java
index 0cc242f..12b5ef4 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListManagedCursor.java
+++ b/core/tests/coretests/src/android/widget/listview/ListManagedCursor.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.ListActivity;
import android.content.Intent;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListManagedCursorTest.java b/core/tests/coretests/src/android/widget/listview/ListManagedCursorTest.java
similarity index 97%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListManagedCursorTest.java
rename to core/tests/coretests/src/android/widget/listview/ListManagedCursorTest.java
index 0251dfb..7938cba 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListManagedCursorTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListManagedCursorTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase;
@@ -33,7 +33,7 @@
private ListView mListView;
public ListManagedCursorTest() {
- super("com.android.frameworktest", ListManagedCursor.class);
+ super("com.android.frameworks.coretests", ListManagedCursor.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfItemsShorterThanScreen.java b/core/tests/coretests/src/android/widget/listview/ListOfItemsShorterThanScreen.java
similarity index 89%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfItemsShorterThanScreen.java
rename to core/tests/coretests/src/android/widget/listview/ListOfItemsShorterThanScreen.java
index 475ab31..46decfa 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfItemsShorterThanScreen.java
+++ b/core/tests/coretests/src/android/widget/listview/ListOfItemsShorterThanScreen.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
public class ListOfItemsShorterThanScreen extends ListScenario {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfItemsTallerThanScreen.java b/core/tests/coretests/src/android/widget/listview/ListOfItemsTallerThanScreen.java
similarity index 89%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfItemsTallerThanScreen.java
rename to core/tests/coretests/src/android/widget/listview/ListOfItemsTallerThanScreen.java
index 0d70abf..0d88993 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfItemsTallerThanScreen.java
+++ b/core/tests/coretests/src/android/widget/listview/ListOfItemsTallerThanScreen.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
public class ListOfItemsTallerThanScreen extends ListScenario {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfShortShortTallShortShort.java b/core/tests/coretests/src/android/widget/listview/ListOfShortShortTallShortShort.java
similarity index 90%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfShortShortTallShortShort.java
rename to core/tests/coretests/src/android/widget/listview/ListOfShortShortTallShortShort.java
index 62c5aa7..1639aa4 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfShortShortTallShortShort.java
+++ b/core/tests/coretests/src/android/widget/listview/ListOfShortShortTallShortShort.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* Exposes fading in and out multiple items.
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfShortTallShort.java b/core/tests/coretests/src/android/widget/listview/ListOfShortTallShort.java
similarity index 90%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfShortTallShort.java
rename to core/tests/coretests/src/android/widget/listview/ListOfShortTallShort.java
index e60dee7..960e129 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfShortTallShort.java
+++ b/core/tests/coretests/src/android/widget/listview/ListOfShortTallShort.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* Two short items separated by one that is taller than the screen.
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfThinItems.java b/core/tests/coretests/src/android/widget/listview/ListOfThinItems.java
similarity index 90%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfThinItems.java
rename to core/tests/coretests/src/android/widget/listview/ListOfThinItems.java
index d613c9b..007479f 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfThinItems.java
+++ b/core/tests/coretests/src/android/widget/listview/ListOfThinItems.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
public class ListOfThinItems extends ListScenario {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfTouchables.java b/core/tests/coretests/src/android/widget/listview/ListOfTouchables.java
similarity index 92%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfTouchables.java
rename to core/tests/coretests/src/android/widget/listview/ListOfTouchables.java
index 0e09190..919ef69 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfTouchables.java
+++ b/core/tests/coretests/src/android/widget/listview/ListOfTouchables.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* Each list item has two focusables that are close enough together that
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListRecyclerProfiling.java b/core/tests/coretests/src/android/widget/listview/ListRecyclerProfiling.java
similarity index 95%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListRecyclerProfiling.java
rename to core/tests/coretests/src/android/widget/listview/ListRecyclerProfiling.java
index 3df3b9a..d5d7261 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListRecyclerProfiling.java
+++ b/core/tests/coretests/src/android/widget/listview/ListRecyclerProfiling.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.Activity;
import android.os.Bundle;
@@ -24,7 +24,7 @@
import android.view.ViewDebug;
import android.view.View;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
public class ListRecyclerProfiling extends Activity {
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListRetainsFocusAcrossLayoutsTest.java b/core/tests/coretests/src/android/widget/listview/ListRetainsFocusAcrossLayoutsTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListRetainsFocusAcrossLayoutsTest.java
rename to core/tests/coretests/src/android/widget/listview/ListRetainsFocusAcrossLayoutsTest.java
index 02a8beb..896bd19 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListRetainsFocusAcrossLayoutsTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListRetainsFocusAcrossLayoutsTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.listview.ListItemFocusablesClose;
+import android.widget.listview.ListItemFocusablesClose;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -25,7 +25,7 @@
public class ListRetainsFocusAcrossLayoutsTest extends ActivityInstrumentationTestCase<ListItemFocusablesClose> {
public ListRetainsFocusAcrossLayoutsTest() {
- super("com.android.frameworktest", ListItemFocusablesClose.class);
+ super("com.android.frameworks.coretests", ListItemFocusablesClose.class);
}
private void requestLayoutOnList() {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListScrollListener.java b/core/tests/coretests/src/android/widget/listview/ListScrollListener.java
similarity index 95%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListScrollListener.java
rename to core/tests/coretests/src/android/widget/listview/ListScrollListener.java
index f5e4faf..58a31dc 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListScrollListener.java
+++ b/core/tests/coretests/src/android/widget/listview/ListScrollListener.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.ListActivity;
import android.os.Bundle;
@@ -25,7 +25,7 @@
import android.widget.ArrayAdapter;
import android.widget.TextView;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
/**
* Exercises change notification in a list
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListScrollListenerTest.java b/core/tests/coretests/src/android/widget/listview/ListScrollListenerTest.java
similarity index 96%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListScrollListenerTest.java
rename to core/tests/coretests/src/android/widget/listview/ListScrollListenerTest.java
index 44958d9..2d6e75e 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListScrollListenerTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListScrollListenerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase;
@@ -35,7 +35,7 @@
private int mTotalItemCount = -1;
public ListScrollListenerTest() {
- super("com.android.frameworktest", ListScrollListener.class);
+ super("com.android.frameworks.coretests", ListScrollListener.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListSetSelection.java b/core/tests/coretests/src/android/widget/listview/ListSetSelection.java
similarity index 95%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListSetSelection.java
rename to core/tests/coretests/src/android/widget/listview/ListSetSelection.java
index 45d5892..6c2e264 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListSetSelection.java
+++ b/core/tests/coretests/src/android/widget/listview/ListSetSelection.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
import android.view.KeyEvent;
import android.view.View;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListSetSelectionTest.java b/core/tests/coretests/src/android/widget/listview/ListSetSelectionTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListSetSelectionTest.java
rename to core/tests/coretests/src/android/widget/listview/ListSetSelectionTest.java
index e35d894..4cef164 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListSetSelectionTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListSetSelectionTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.test.ActivityInstrumentationTestCase2;
import android.test.UiThreadTest;
@@ -29,7 +29,7 @@
private ListView mListView;
public ListSetSelectionTest() {
- super("com.android.frameworktest", ListSimple.class);
+ super("com.android.frameworks.coretests", ListSimple.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListSimple.java b/core/tests/coretests/src/android/widget/listview/ListSimple.java
similarity index 93%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListSimple.java
rename to core/tests/coretests/src/android/widget/listview/ListSimple.java
index e7517d6..6accae1 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListSimple.java
+++ b/core/tests/coretests/src/android/widget/listview/ListSimple.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
import android.view.View;
import android.view.ViewGroup;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListTakeFocusFromSide.java b/core/tests/coretests/src/android/widget/listview/ListTakeFocusFromSide.java
similarity index 96%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListTakeFocusFromSide.java
rename to core/tests/coretests/src/android/widget/listview/ListTakeFocusFromSide.java
index e576ea2..95f09f6 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListTakeFocusFromSide.java
+++ b/core/tests/coretests/src/android/widget/listview/ListTakeFocusFromSide.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.ListActivity;
import android.content.Context;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListThrasher.java b/core/tests/coretests/src/android/widget/listview/ListThrasher.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListThrasher.java
rename to core/tests/coretests/src/android/widget/listview/ListThrasher.java
index e0b18a2..ba3d590 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListThrasher.java
+++ b/core/tests/coretests/src/android/widget/listview/ListThrasher.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.ListActivity;
import android.content.Context;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListTopGravity.java b/core/tests/coretests/src/android/widget/listview/ListTopGravity.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListTopGravity.java
rename to core/tests/coretests/src/android/widget/listview/ListTopGravity.java
index 6eb65a9..986cc57 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListTopGravity.java
+++ b/core/tests/coretests/src/android/widget/listview/ListTopGravity.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.view.Gravity;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* Basic top gravity scenario, nothing fancy. Items do not
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListTopGravityMany.java b/core/tests/coretests/src/android/widget/listview/ListTopGravityMany.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListTopGravityMany.java
rename to core/tests/coretests/src/android/widget/listview/ListTopGravityMany.java
index 8cff8ca..5592ad9 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListTopGravityMany.java
+++ b/core/tests/coretests/src/android/widget/listview/ListTopGravityMany.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* Basic top gravity scenario, nothing fancy. There are
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListUnspecifiedMeasure.java b/core/tests/coretests/src/android/widget/listview/ListUnspecifiedMeasure.java
similarity index 91%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListUnspecifiedMeasure.java
rename to core/tests/coretests/src/android/widget/listview/ListUnspecifiedMeasure.java
index 55a57ef..199d069 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListUnspecifiedMeasure.java
+++ b/core/tests/coretests/src/android/widget/listview/ListUnspecifiedMeasure.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.app.Activity;
@@ -28,7 +28,7 @@
private ListView mListView;
protected ListUnspecifiedMeasure(Class<T> klass) {
- super("com.android.frameworktest", klass);
+ super("com.android.frameworks.coretests", klass);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListViewHeight.java b/core/tests/coretests/src/android/widget/listview/ListViewHeight.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListViewHeight.java
rename to core/tests/coretests/src/android/widget/listview/ListViewHeight.java
index 1d6d598..64f280a 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListViewHeight.java
+++ b/core/tests/coretests/src/android/widget/listview/ListViewHeight.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.Activity;
import android.os.Bundle;
@@ -23,7 +23,7 @@
import android.widget.ArrayAdapter;
import android.widget.ListView;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
public class ListViewHeight extends Activity {
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListViewHeightTest.java b/core/tests/coretests/src/android/widget/listview/ListViewHeightTest.java
similarity index 92%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListViewHeightTest.java
rename to core/tests/coretests/src/android/widget/listview/ListViewHeightTest.java
index d5bdf8b..5ab2757 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListViewHeightTest.java
+++ b/core/tests/coretests/src/android/widget/listview/ListViewHeightTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase;
@@ -22,15 +22,15 @@
import android.widget.Button;
import android.widget.ListView;
-import com.android.frameworktest.R;
-import com.android.frameworktest.listview.ListViewHeight;
+import com.android.frameworks.coretests.R;
+import android.widget.listview.ListViewHeight;
public class ListViewHeightTest extends ActivityInstrumentationTestCase<ListViewHeight> {
private ListViewHeight mActivity;
public ListViewHeightTest() {
- super("com.android.frameworktest", ListViewHeight.class);
+ super("com.android.frameworks.coretests", ListViewHeight.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithDisappearingItemBug.java b/core/tests/coretests/src/android/widget/listview/ListWithDisappearingItemBug.java
similarity index 96%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithDisappearingItemBug.java
rename to core/tests/coretests/src/android/widget/listview/ListWithDisappearingItemBug.java
index 3a968af..348ea1b 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithDisappearingItemBug.java
+++ b/core/tests/coretests/src/android/widget/listview/ListWithDisappearingItemBug.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.ListActivity;
import android.database.Cursor;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithEditTextHeader.java b/core/tests/coretests/src/android/widget/listview/ListWithEditTextHeader.java
similarity index 90%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithEditTextHeader.java
rename to core/tests/coretests/src/android/widget/listview/ListWithEditTextHeader.java
index b5cac2a..5303faf 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithEditTextHeader.java
+++ b/core/tests/coretests/src/android/widget/listview/ListWithEditTextHeader.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* A list view with a single edit text in a header.
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithEmptyView.java b/core/tests/coretests/src/android/widget/listview/ListWithEmptyView.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithEmptyView.java
rename to core/tests/coretests/src/android/widget/listview/ListWithEmptyView.java
index 6f43551..74dd06c 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithEmptyView.java
+++ b/core/tests/coretests/src/android/widget/listview/ListWithEmptyView.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.ListActivity;
import android.content.Context;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithFirstScreenUnSelectable.java b/core/tests/coretests/src/android/widget/listview/ListWithFirstScreenUnSelectable.java
similarity index 90%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithFirstScreenUnSelectable.java
rename to core/tests/coretests/src/android/widget/listview/ListWithFirstScreenUnSelectable.java
index 4ad72fd..5261283 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithFirstScreenUnSelectable.java
+++ b/core/tests/coretests/src/android/widget/listview/ListWithFirstScreenUnSelectable.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* The first item is unselectable, and takes up the whole screen.
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithHeaders.java b/core/tests/coretests/src/android/widget/listview/ListWithHeaders.java
similarity index 94%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithHeaders.java
rename to core/tests/coretests/src/android/widget/listview/ListWithHeaders.java
index d523094..aea091a 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithHeaders.java
+++ b/core/tests/coretests/src/android/widget/listview/ListWithHeaders.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
import android.os.Bundle;
import android.widget.Button;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithNoFadingEdge.java b/core/tests/coretests/src/android/widget/listview/ListWithNoFadingEdge.java
similarity index 89%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithNoFadingEdge.java
rename to core/tests/coretests/src/android/widget/listview/ListWithNoFadingEdge.java
index ecfc793..b870fc8 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithNoFadingEdge.java
+++ b/core/tests/coretests/src/android/widget/listview/ListWithNoFadingEdge.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
public class ListWithNoFadingEdge extends ListScenario {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithOffScreenNextSelectable.java b/core/tests/coretests/src/android/widget/listview/ListWithOffScreenNextSelectable.java
similarity index 91%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithOffScreenNextSelectable.java
rename to core/tests/coretests/src/android/widget/listview/ListWithOffScreenNextSelectable.java
index 71525c0..2e65bd0 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithOffScreenNextSelectable.java
+++ b/core/tests/coretests/src/android/widget/listview/ListWithOffScreenNextSelectable.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* Pressing down from position 0 requires looking past positions 1, 2 and 3 to
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithOnItemSelectedAction.java b/core/tests/coretests/src/android/widget/listview/ListWithOnItemSelectedAction.java
similarity index 93%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithOnItemSelectedAction.java
rename to core/tests/coretests/src/android/widget/listview/ListWithOnItemSelectedAction.java
index 2683040..26e1d5d 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithOnItemSelectedAction.java
+++ b/core/tests/coretests/src/android/widget/listview/ListWithOnItemSelectedAction.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
import android.widget.TextView;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* The header text view echos the value of the selected item by using (indirectly)
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithScreenOfNoSelectables.java b/core/tests/coretests/src/android/widget/listview/ListWithScreenOfNoSelectables.java
similarity index 89%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithScreenOfNoSelectables.java
rename to core/tests/coretests/src/android/widget/listview/ListWithScreenOfNoSelectables.java
index a2f3dc2..108ac4d 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithScreenOfNoSelectables.java
+++ b/core/tests/coretests/src/android/widget/listview/ListWithScreenOfNoSelectables.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
public class ListWithScreenOfNoSelectables extends ListScenario {
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithSeparators.java b/core/tests/coretests/src/android/widget/listview/ListWithSeparators.java
similarity index 90%
rename from tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithSeparators.java
rename to core/tests/coretests/src/android/widget/listview/ListWithSeparators.java
index 71ce4e7..0f4f2d8 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithSeparators.java
+++ b/core/tests/coretests/src/android/widget/listview/ListWithSeparators.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview;
+package android.widget.listview;
-import com.android.frameworktest.util.ListScenario;
+import android.util.ListScenario;
/**
* Basic separator scenario, nothing fancy.
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListInterleaveFocusablesTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListInterleaveFocusablesTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListInterleaveFocusablesTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListInterleaveFocusablesTest.java
index 1fe75c4..6238dab 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListInterleaveFocusablesTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListInterleaveFocusablesTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -23,15 +23,15 @@
import android.view.KeyEvent;
import android.view.View;
-import com.android.frameworktest.listview.ListInterleaveFocusables;
-import com.android.frameworktest.util.ListUtil;
+import android.widget.listview.ListInterleaveFocusables;
+import android.util.ListUtil;
public class ListInterleaveFocusablesTest extends ActivityInstrumentationTestCase<ListInterleaveFocusables> {
private ListView mListView;
private ListUtil mListUtil;
public ListInterleaveFocusablesTest() {
- super("com.android.frameworktest", ListInterleaveFocusables.class);
+ super("com.android.frameworks.coretests", ListInterleaveFocusables.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemFocusableAboveUnfocusableTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListItemFocusableAboveUnfocusableTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemFocusableAboveUnfocusableTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListItemFocusableAboveUnfocusableTest.java
index 6ff9181..82f48801 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemFocusableAboveUnfocusableTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListItemFocusableAboveUnfocusableTest.java
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.ListView;
import android.view.KeyEvent;
-import com.android.frameworktest.listview.ListItemFocusableAboveUnfocusable;
+import android.widget.listview.ListItemFocusableAboveUnfocusable;
public class ListItemFocusableAboveUnfocusableTest extends ActivityInstrumentationTestCase<ListItemFocusableAboveUnfocusable> {
private ListView mListView;
public ListItemFocusableAboveUnfocusableTest() {
- super("com.android.frameworktest", ListItemFocusableAboveUnfocusable.class);
+ super("com.android.frameworks.coretests", ListItemFocusableAboveUnfocusable.class);
}
protected void setUp() throws Exception {
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemFocusablesCloseTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListItemFocusablesCloseTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemFocusablesCloseTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListItemFocusablesCloseTest.java
index 07356ba..3b30ebe 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemFocusablesCloseTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListItemFocusablesCloseTest.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.KeyEvent;
import android.widget.LinearLayout;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListItemFocusablesClose;
+import android.widget.listview.ListItemFocusablesClose;
public class ListItemFocusablesCloseTest extends ActivityInstrumentationTestCase<ListItemFocusablesClose> {
private ListView mListView;
@@ -29,7 +29,7 @@
private int mListBottom;
public ListItemFocusablesCloseTest() {
- super("com.android.frameworktest", ListItemFocusablesClose.class);
+ super("com.android.frameworks.coretests", ListItemFocusablesClose.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemFocusablesFarApartTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListItemFocusablesFarApartTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemFocusablesFarApartTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListItemFocusablesFarApartTest.java
index 951e021..475930d 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemFocusablesFarApartTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListItemFocusablesFarApartTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -23,7 +23,7 @@
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListItemFocusablesFarApart;
+import android.widget.listview.ListItemFocusablesFarApart;
public class ListItemFocusablesFarApartTest extends ActivityInstrumentationTestCase<ListItemFocusablesFarApart> {
private ListView mListView;
@@ -31,7 +31,7 @@
private int mListBottom;
public ListItemFocusablesFarApartTest() {
- super("com.android.frameworktest", ListItemFocusablesFarApart.class);
+ super("com.android.frameworks.coretests", ListItemFocusablesFarApart.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemsExpandOnSelectionTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListItemsExpandOnSelectionTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemsExpandOnSelectionTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListItemsExpandOnSelectionTest.java
index f61ce7b..e4b5c18 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemsExpandOnSelectionTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListItemsExpandOnSelectionTest.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.ListView;
import android.view.KeyEvent;
-import com.android.frameworktest.listview.ListItemsExpandOnSelection;
+import android.widget.listview.ListItemsExpandOnSelection;
public class ListItemsExpandOnSelectionTest extends ActivityInstrumentationTestCase<ListItemsExpandOnSelection> {
private ListView mListView;
@@ -31,7 +31,7 @@
private int mNormalHeight;
public ListItemsExpandOnSelectionTest() {
- super("com.android.frameworktest",
+ super("com.android.frameworks.coretests",
ListItemsExpandOnSelection.class);
}
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListLastItemPartiallyVisibleTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListLastItemPartiallyVisibleTest.java
similarity index 92%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListLastItemPartiallyVisibleTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListLastItemPartiallyVisibleTest.java
index 38f4b0e..5bc121a 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListLastItemPartiallyVisibleTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListLastItemPartiallyVisibleTest.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.ListView;
import android.view.View;
import android.view.KeyEvent;
-import com.android.frameworktest.listview.ListLastItemPartiallyVisible;
+import android.widget.listview.ListLastItemPartiallyVisible;
public class ListLastItemPartiallyVisibleTest extends ActivityInstrumentationTestCase<ListLastItemPartiallyVisible> {
private ListView mListView;
@@ -29,7 +29,7 @@
public ListLastItemPartiallyVisibleTest() {
- super("com.android.frameworktest", ListLastItemPartiallyVisible.class);
+ super("com.android.frameworks.coretests", ListLastItemPartiallyVisible.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfItemsShorterThanScreenTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfItemsShorterThanScreenTest.java
similarity index 96%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfItemsShorterThanScreenTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfItemsShorterThanScreenTest.java
index 126eea2..eacde5b 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfItemsShorterThanScreenTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfItemsShorterThanScreenTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -22,7 +22,7 @@
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
-import com.android.frameworktest.listview.ListOfItemsShorterThanScreen;
+import android.widget.listview.ListOfItemsShorterThanScreen;
public class ListOfItemsShorterThanScreenTest
extends ActivityInstrumentationTestCase<ListOfItemsShorterThanScreen> {
@@ -31,7 +31,7 @@
public ListOfItemsShorterThanScreenTest() {
- super("com.android.frameworktest", ListOfItemsShorterThanScreen.class);
+ super("com.android.frameworks.coretests", ListOfItemsShorterThanScreen.class);
}
protected void setUp() throws Exception {
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfItemsTallerThanScreenTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfItemsTallerThanScreenTest.java
similarity index 96%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfItemsTallerThanScreenTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfItemsTallerThanScreenTest.java
index ec3a15c..59609422 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfItemsTallerThanScreenTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfItemsTallerThanScreenTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -22,7 +22,7 @@
import android.widget.ListView;
import android.view.View;
import android.view.KeyEvent;
-import com.android.frameworktest.listview.ListOfItemsTallerThanScreen;
+import android.widget.listview.ListOfItemsTallerThanScreen;
public class ListOfItemsTallerThanScreenTest
extends ActivityInstrumentationTestCase<ListOfItemsTallerThanScreen> {
@@ -38,7 +38,7 @@
}
public ListOfItemsTallerThanScreenTest() {
- super("com.android.frameworktest", ListOfItemsTallerThanScreen.class);
+ super("com.android.frameworks.coretests", ListOfItemsTallerThanScreen.class);
}
@MediumTest
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfShortShortTallShortShortTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfShortShortTallShortShortTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfShortShortTallShortShortTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfShortShortTallShortShortTest.java
index e218099..a5d4906 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfShortShortTallShortShortTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfShortShortTallShortShortTest.java
@@ -14,22 +14,22 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.KeyEvent;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListOfShortShortTallShortShort;
-import com.android.frameworktest.util.ListUtil;
+import android.widget.listview.ListOfShortShortTallShortShort;
+import android.util.ListUtil;
public class ListOfShortShortTallShortShortTest extends ActivityInstrumentationTestCase<ListOfShortShortTallShortShort> {
private ListView mListView;
private ListUtil mListUtil;
public ListOfShortShortTallShortShortTest() {
- super("com.android.frameworktest", ListOfShortShortTallShortShort.class);
+ super("com.android.frameworks.coretests", ListOfShortShortTallShortShort.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfShortTallShortTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfShortTallShortTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfShortTallShortTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfShortTallShortTest.java
index 6a83ada..c958591 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfShortTallShortTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfShortTallShortTest.java
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.ListView;
import android.view.KeyEvent;
-import com.android.frameworktest.listview.ListOfShortTallShort;
+import android.widget.listview.ListOfShortTallShort;
public class ListOfShortTallShortTest extends ActivityInstrumentationTestCase<ListOfShortTallShort> {
private ListView mListView;
public ListOfShortTallShortTest() {
- super("com.android.frameworktest", ListOfShortTallShort.class);
+ super("com.android.frameworks.coretests", ListOfShortTallShort.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfThinItemsTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfThinItemsTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfThinItemsTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfThinItemsTest.java
index e8dbbec..17c1e03 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfThinItemsTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListOfThinItemsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -22,13 +22,13 @@
import android.view.KeyEvent;
import android.view.View;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListOfThinItems;
+import android.widget.listview.ListOfThinItems;
public class ListOfThinItemsTest extends ActivityInstrumentationTestCase<ListOfThinItems> {
private ListView mListView;
public ListOfThinItemsTest() {
- super("com.android.frameworktest", ListOfThinItems.class);
+ super("com.android.frameworks.coretests", ListOfThinItems.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithFirstScreenUnSelectableTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithFirstScreenUnSelectableTest.java
similarity index 90%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithFirstScreenUnSelectableTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithFirstScreenUnSelectableTest.java
index 307c39d..400fd7d 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithFirstScreenUnSelectableTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithFirstScreenUnSelectableTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
-import com.android.frameworktest.listview.ListWithFirstScreenUnSelectable;
+import android.widget.listview.ListWithFirstScreenUnSelectable;
import android.test.ActivityInstrumentationTestCase2;
import android.view.KeyEvent;
import android.widget.ListView;
@@ -27,7 +27,7 @@
private ListView mListView;
public ListWithFirstScreenUnSelectableTest() {
- super("com.android.frameworktest", ListWithFirstScreenUnSelectable.class);
+ super("com.android.frameworks.coretests", ListWithFirstScreenUnSelectable.class);
}
protected void setUp() throws Exception {
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithNoFadingEdgeTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithNoFadingEdgeTest.java
similarity index 92%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithNoFadingEdgeTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithNoFadingEdgeTest.java
index 449e048..957be01 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithNoFadingEdgeTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithNoFadingEdgeTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
-import com.android.frameworktest.listview.ListWithNoFadingEdge;
+import android.widget.listview.ListWithNoFadingEdge;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -29,7 +29,7 @@
private ListView mListView;
public ListWithNoFadingEdgeTest() {
- super("com.android.frameworktest", ListWithNoFadingEdge.class);
+ super("com.android.frameworks.coretests", ListWithNoFadingEdge.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithOffScreenNextSelectableTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithOffScreenNextSelectableTest.java
similarity index 94%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithOffScreenNextSelectableTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithOffScreenNextSelectableTest.java
index 6e62ccb..610b890 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithOffScreenNextSelectableTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithOffScreenNextSelectableTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -22,14 +22,14 @@
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
-import com.android.frameworktest.listview.ListWithOffScreenNextSelectable;
+import android.widget.listview.ListWithOffScreenNextSelectable;
public class ListWithOffScreenNextSelectableTest
extends ActivityInstrumentationTestCase<ListWithOffScreenNextSelectable> {
private ListView mListView;
public ListWithOffScreenNextSelectableTest() {
- super("com.android.frameworktest", ListWithOffScreenNextSelectable.class);
+ super("com.android.frameworks.coretests", ListWithOffScreenNextSelectable.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithOnItemSelectedActionTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithOnItemSelectedActionTest.java
similarity index 90%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithOnItemSelectedActionTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithOnItemSelectedActionTest.java
index 0a8af45..feea9b2 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithOnItemSelectedActionTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithOnItemSelectedActionTest.java
@@ -14,20 +14,20 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.ListView;
import android.widget.TextView;
import android.view.KeyEvent;
-import com.android.frameworktest.listview.ListWithOnItemSelectedAction;
+import android.widget.listview.ListWithOnItemSelectedAction;
public class ListWithOnItemSelectedActionTest extends ActivityInstrumentationTestCase<ListWithOnItemSelectedAction> {
private ListView mListView;
public ListWithOnItemSelectedActionTest() {
- super("com.android.frameworktest", ListWithOnItemSelectedAction.class);
+ super("com.android.frameworks.coretests", ListWithOnItemSelectedAction.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithScreenOfNoSelectablesTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithScreenOfNoSelectablesTest.java
similarity index 94%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithScreenOfNoSelectablesTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithScreenOfNoSelectablesTest.java
index 0c0084e..8071650 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithScreenOfNoSelectablesTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithScreenOfNoSelectablesTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
-import com.android.frameworktest.listview.ListWithScreenOfNoSelectables;
+import android.widget.listview.ListWithScreenOfNoSelectables;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -30,7 +30,7 @@
private ListView mListView;
public ListWithScreenOfNoSelectablesTest() {
- super("com.android.frameworktest", ListWithScreenOfNoSelectables.class);
+ super("com.android.frameworks.coretests", ListWithScreenOfNoSelectables.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithSeparatorsTest.java b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithSeparatorsTest.java
similarity index 92%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithSeparatorsTest.java
rename to core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithSeparatorsTest.java
index fdeaa4a..42058f0 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithSeparatorsTest.java
+++ b/core/tests/coretests/src/android/widget/listview/arrowscroll/ListWithSeparatorsTest.java
@@ -14,20 +14,20 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.arrowscroll;
+package android.widget.listview.arrowscroll;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.ListView;
import android.view.KeyEvent;
-import com.android.frameworktest.listview.ListWithSeparators;
+import android.widget.listview.ListWithSeparators;
public class ListWithSeparatorsTest extends ActivityInstrumentationTestCase<ListWithSeparators> {
private ListWithSeparators mActivity;
private ListView mListView;
public ListWithSeparatorsTest() {
- super("com.android.frameworktest", ListWithSeparators.class);
+ super("com.android.frameworks.coretests", ListWithSeparators.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/AdjacentListsWithAdjacentISVsInsideTest.java b/core/tests/coretests/src/android/widget/listview/focus/AdjacentListsWithAdjacentISVsInsideTest.java
similarity index 91%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/AdjacentListsWithAdjacentISVsInsideTest.java
rename to core/tests/coretests/src/android/widget/listview/focus/AdjacentListsWithAdjacentISVsInsideTest.java
index 2c0c2d8..461f83d 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/AdjacentListsWithAdjacentISVsInsideTest.java
+++ b/core/tests/coretests/src/android/widget/listview/focus/AdjacentListsWithAdjacentISVsInsideTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.focus;
+package android.widget.listview.focus;
-import com.android.frameworktest.listview.AdjacentListsWithAdjacentISVsInside;
-import com.android.frameworktest.util.InternalSelectionView;
+import android.widget.listview.AdjacentListsWithAdjacentISVsInside;
+import android.util.InternalSelectionView;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -34,7 +34,7 @@
private InternalSelectionView mRightIsv;
public AdjacentListsWithAdjacentISVsInsideTest() {
- super("com.android.frameworktest", AdjacentListsWithAdjacentISVsInside.class);
+ super("com.android.frameworks.coretests", AdjacentListsWithAdjacentISVsInside.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/ListButtonsDiagonalAcrossItemsTest.java b/core/tests/coretests/src/android/widget/listview/focus/ListButtonsDiagonalAcrossItemsTest.java
similarity index 94%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/ListButtonsDiagonalAcrossItemsTest.java
rename to core/tests/coretests/src/android/widget/listview/focus/ListButtonsDiagonalAcrossItemsTest.java
index c54add3..5540d65 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/ListButtonsDiagonalAcrossItemsTest.java
+++ b/core/tests/coretests/src/android/widget/listview/focus/ListButtonsDiagonalAcrossItemsTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.focus;
+package android.widget.listview.focus;
-import com.android.frameworktest.listview.ListButtonsDiagonalAcrossItems;
+import android.widget.listview.ListButtonsDiagonalAcrossItems;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -38,7 +38,7 @@
private ListView mListView;
public ListButtonsDiagonalAcrossItemsTest() {
- super("com.android.frameworktest", ListButtonsDiagonalAcrossItems.class);
+ super("com.android.frameworks.coretests", ListButtonsDiagonalAcrossItems.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/ListHorizontalFocusWithinItemWinsTest.java b/core/tests/coretests/src/android/widget/listview/focus/ListHorizontalFocusWithinItemWinsTest.java
similarity index 92%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/ListHorizontalFocusWithinItemWinsTest.java
rename to core/tests/coretests/src/android/widget/listview/focus/ListHorizontalFocusWithinItemWinsTest.java
index 35f9b06..8f971bb 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/ListHorizontalFocusWithinItemWinsTest.java
+++ b/core/tests/coretests/src/android/widget/listview/focus/ListHorizontalFocusWithinItemWinsTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.focus;
+package android.widget.listview.focus;
-import com.android.frameworktest.listview.ListHorizontalFocusWithinItemWins;
+import android.widget.listview.ListHorizontalFocusWithinItemWins;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -34,7 +34,7 @@
private Button mBottomMiddleButton;
public ListHorizontalFocusWithinItemWinsTest() {
- super("com.android.frameworktest", ListHorizontalFocusWithinItemWins.class);
+ super("com.android.frameworks.coretests", ListHorizontalFocusWithinItemWins.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/ListWithEditTextHeaderTest.java b/core/tests/coretests/src/android/widget/listview/focus/ListWithEditTextHeaderTest.java
similarity index 92%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/ListWithEditTextHeaderTest.java
rename to core/tests/coretests/src/android/widget/listview/focus/ListWithEditTextHeaderTest.java
index dea689f..93bddb0 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/ListWithEditTextHeaderTest.java
+++ b/core/tests/coretests/src/android/widget/listview/focus/ListWithEditTextHeaderTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.focus;
+package android.widget.listview.focus;
import android.test.ActivityInstrumentationTestCase;
import android.test.FlakyTest;
@@ -24,13 +24,13 @@
import android.view.KeyEvent;
import android.widget.AbsListView;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListWithEditTextHeader;
+import android.widget.listview.ListWithEditTextHeader;
public class ListWithEditTextHeaderTest extends ActivityInstrumentationTestCase<ListWithEditTextHeader> {
private ListView mListView;
public ListWithEditTextHeaderTest() {
- super("com.android.frameworktest", ListWithEditTextHeader.class);
+ super("com.android.frameworks.coretests", ListWithEditTextHeader.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListGetSelectedViewTest.java b/core/tests/coretests/src/android/widget/listview/touch/ListGetSelectedViewTest.java
similarity index 90%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListGetSelectedViewTest.java
rename to core/tests/coretests/src/android/widget/listview/touch/ListGetSelectedViewTest.java
index 3a75f93..28f899e 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListGetSelectedViewTest.java
+++ b/core/tests/coretests/src/android/widget/listview/touch/ListGetSelectedViewTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.touch;
+package android.widget.listview.touch;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -23,7 +23,7 @@
import android.widget.ListView;
import android.view.View;
-import com.android.frameworktest.listview.ListGetSelectedView;
+import android.widget.listview.ListGetSelectedView;
/**
* This test is made to check that getSelectedView() will return
@@ -34,7 +34,7 @@
private ListView mListView;
public ListGetSelectedViewTest() {
- super("com.android.frameworktest", ListGetSelectedView.class);
+ super("com.android.frameworks.coretests", ListGetSelectedView.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListOfTouchablesTest.java b/core/tests/coretests/src/android/widget/listview/touch/ListOfTouchablesTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListOfTouchablesTest.java
rename to core/tests/coretests/src/android/widget/listview/touch/ListOfTouchablesTest.java
index 39c0e45..ffa9a5e 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListOfTouchablesTest.java
+++ b/core/tests/coretests/src/android/widget/listview/touch/ListOfTouchablesTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.touch;
+package android.widget.listview.touch;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -24,7 +24,7 @@
import android.view.ViewConfiguration;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListOfTouchables;
+import android.widget.listview.ListOfTouchables;
import android.test.TouchUtils;
/**
@@ -35,7 +35,7 @@
private ListView mListView;
public ListOfTouchablesTest() {
- super("com.android.frameworktest", ListOfTouchables.class);
+ super("com.android.frameworks.coretests", ListOfTouchables.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListSetSelectionTest.java b/core/tests/coretests/src/android/widget/listview/touch/ListSetSelectionTest.java
similarity index 96%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListSetSelectionTest.java
rename to core/tests/coretests/src/android/widget/listview/touch/ListSetSelectionTest.java
index c3d7264..b7733d1 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListSetSelectionTest.java
+++ b/core/tests/coretests/src/android/widget/listview/touch/ListSetSelectionTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.touch;
+package android.widget.listview.touch;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -23,7 +23,7 @@
import android.view.View;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListSimple;
+import android.widget.listview.ListSimple;
/**
* Tests setting the selection in touch mode
@@ -33,7 +33,7 @@
private ListView mListView;
public ListSetSelectionTest() {
- super("com.android.frameworktest", ListSimple.class);
+ super("com.android.frameworks.coretests", ListSimple.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchBottomGravityManyTest.java b/core/tests/coretests/src/android/widget/listview/touch/ListTouchBottomGravityManyTest.java
similarity index 96%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchBottomGravityManyTest.java
rename to core/tests/coretests/src/android/widget/listview/touch/ListTouchBottomGravityManyTest.java
index 4e62a4d..7daf64e 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchBottomGravityManyTest.java
+++ b/core/tests/coretests/src/android/widget/listview/touch/ListTouchBottomGravityManyTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.touch;
+package android.widget.listview.touch;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -25,7 +25,7 @@
import android.view.ViewConfiguration;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListBottomGravityMany;
+import android.widget.listview.ListBottomGravityMany;
/**
* Touch tests for a list where all of the items do not fit on the screen, and the list
@@ -36,7 +36,7 @@
private ListView mListView;
public ListTouchBottomGravityManyTest() {
- super("com.android.frameworktest", ListBottomGravityMany.class);
+ super("com.android.frameworks.coretests", ListBottomGravityMany.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchBottomGravityTest.java b/core/tests/coretests/src/android/widget/listview/touch/ListTouchBottomGravityTest.java
similarity index 94%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchBottomGravityTest.java
rename to core/tests/coretests/src/android/widget/listview/touch/ListTouchBottomGravityTest.java
index 78d39fb..4086cf0 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchBottomGravityTest.java
+++ b/core/tests/coretests/src/android/widget/listview/touch/ListTouchBottomGravityTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.touch;
+package android.widget.listview.touch;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -22,7 +22,7 @@
import android.view.View;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListBottomGravity;
+import android.widget.listview.ListBottomGravity;
/**
* Touch tests for a list where all of the items fit on the screen, and the list
@@ -33,7 +33,7 @@
private ListView mListView;
public ListTouchBottomGravityTest() {
- super("com.android.frameworktest", ListBottomGravity.class);
+ super("com.android.frameworks.coretests", ListBottomGravity.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchManyTest.java b/core/tests/coretests/src/android/widget/listview/touch/ListTouchManyTest.java
similarity index 97%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchManyTest.java
rename to core/tests/coretests/src/android/widget/listview/touch/ListTouchManyTest.java
index 3066d8d..30d56ca 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchManyTest.java
+++ b/core/tests/coretests/src/android/widget/listview/touch/ListTouchManyTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.touch;
+package android.widget.listview.touch;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -25,7 +25,7 @@
import android.view.ViewConfiguration;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListTopGravityMany;
+import android.widget.listview.ListTopGravityMany;
/**
* Touch tests for a list where all of the items do not fit on the screen.
@@ -35,7 +35,7 @@
private ListView mListView;
public ListTouchManyTest() {
- super("com.android.frameworktest", ListTopGravityMany.class);
+ super("com.android.frameworks.coretests", ListTopGravityMany.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchTest.java b/core/tests/coretests/src/android/widget/listview/touch/ListTouchTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchTest.java
rename to core/tests/coretests/src/android/widget/listview/touch/ListTouchTest.java
index 4e5c423..5b064b3 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchTest.java
+++ b/core/tests/coretests/src/android/widget/listview/touch/ListTouchTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.frameworktest.listview.touch;
+package android.widget.listview.touch;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -22,7 +22,7 @@
import android.view.View;
import android.widget.ListView;
-import com.android.frameworktest.listview.ListTopGravity;
+import android.widget.listview.ListTopGravity;
/**
* Touch tests for a list where all of the items fit on the screen.
@@ -32,7 +32,7 @@
private ListView mListView;
public ListTouchTest() {
- super("com.android.frameworktest", ListTopGravity.class);
+ super("com.android.frameworks.coretests", ListTopGravity.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/scroll/ButtonAboveTallInternalSelectionView.java b/core/tests/coretests/src/android/widget/scroll/ButtonAboveTallInternalSelectionView.java
similarity index 88%
rename from tests/FrameworkTest/src/com/android/frameworktest/scroll/ButtonAboveTallInternalSelectionView.java
rename to core/tests/coretests/src/android/widget/scroll/ButtonAboveTallInternalSelectionView.java
index 986b800..a7f5c05 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/scroll/ButtonAboveTallInternalSelectionView.java
+++ b/core/tests/coretests/src/android/widget/scroll/ButtonAboveTallInternalSelectionView.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll;
+package android.widget.scroll;
-import com.android.frameworktest.util.InternalSelectionView;
-import com.android.frameworktest.util.ScrollViewScenario;
+import android.util.InternalSelectionView;
+import android.util.ScrollViewScenario;
import android.widget.Button;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/ButtonAboveTallInternalSelectionViewTest.java b/core/tests/coretests/src/android/widget/scroll/ButtonAboveTallInternalSelectionViewTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/ButtonAboveTallInternalSelectionViewTest.java
rename to core/tests/coretests/src/android/widget/scroll/ButtonAboveTallInternalSelectionViewTest.java
index e4dd2b8..41123280 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/ButtonAboveTallInternalSelectionViewTest.java
+++ b/core/tests/coretests/src/android/widget/scroll/ButtonAboveTallInternalSelectionViewTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll;
+package android.widget.scroll;
-import com.android.frameworktest.scroll.ButtonAboveTallInternalSelectionView;
-import com.android.frameworktest.util.InternalSelectionView;
+import android.widget.scroll.ButtonAboveTallInternalSelectionView;
+import android.util.InternalSelectionView;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -27,7 +27,7 @@
ActivityInstrumentationTestCase<ButtonAboveTallInternalSelectionView> {
public ButtonAboveTallInternalSelectionViewTest() {
- super("com.android.frameworktest", ButtonAboveTallInternalSelectionView.class);
+ super("com.android.frameworks.coretests", ButtonAboveTallInternalSelectionView.class);
}
@MediumTest
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/scroll/ButtonsWithTallTextViewInBetween.java b/core/tests/coretests/src/android/widget/scroll/ButtonsWithTallTextViewInBetween.java
similarity index 93%
rename from tests/FrameworkTest/src/com/android/frameworktest/scroll/ButtonsWithTallTextViewInBetween.java
rename to core/tests/coretests/src/android/widget/scroll/ButtonsWithTallTextViewInBetween.java
index ed098aa..3d5f86d 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/scroll/ButtonsWithTallTextViewInBetween.java
+++ b/core/tests/coretests/src/android/widget/scroll/ButtonsWithTallTextViewInBetween.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll;
+package android.widget.scroll;
-import com.android.frameworktest.util.ScrollViewScenario;
+import android.util.ScrollViewScenario;
import android.widget.Button;
import android.widget.LinearLayout;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/scroll/RequestRectangleVisible.java b/core/tests/coretests/src/android/widget/scroll/RequestRectangleVisible.java
similarity index 97%
rename from tests/FrameworkTest/src/com/android/frameworktest/scroll/RequestRectangleVisible.java
rename to core/tests/coretests/src/android/widget/scroll/RequestRectangleVisible.java
index affd3c7..9cc8544 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/scroll/RequestRectangleVisible.java
+++ b/core/tests/coretests/src/android/widget/scroll/RequestRectangleVisible.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll;
+package android.widget.scroll;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/RequestRectangleVisibleTest.java b/core/tests/coretests/src/android/widget/scroll/RequestRectangleVisibleTest.java
similarity index 96%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/RequestRectangleVisibleTest.java
rename to core/tests/coretests/src/android/widget/scroll/RequestRectangleVisibleTest.java
index 3eec37b..95fb00b 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/RequestRectangleVisibleTest.java
+++ b/core/tests/coretests/src/android/widget/scroll/RequestRectangleVisibleTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll;
+package android.widget.scroll;
-import com.android.frameworktest.scroll.RequestRectangleVisible;
-import com.android.frameworktest.R;
+import android.widget.scroll.RequestRectangleVisible;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -48,7 +48,7 @@
private Button mClickToScrollFromBelow;
public RequestRectangleVisibleTest() {
- super("com.android.frameworktest", RequestRectangleVisible.class);
+ super("com.android.frameworks.coretests", RequestRectangleVisible.class);
}
@Override
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/scroll/RequestRectangleVisibleWithInternalScroll.java b/core/tests/coretests/src/android/widget/scroll/RequestRectangleVisibleWithInternalScroll.java
similarity index 95%
rename from tests/FrameworkTest/src/com/android/frameworktest/scroll/RequestRectangleVisibleWithInternalScroll.java
rename to core/tests/coretests/src/android/widget/scroll/RequestRectangleVisibleWithInternalScroll.java
index 0a8dc30..0e2586d 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/scroll/RequestRectangleVisibleWithInternalScroll.java
+++ b/core/tests/coretests/src/android/widget/scroll/RequestRectangleVisibleWithInternalScroll.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll;
+package android.widget.scroll;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/RequestRectangleVisibleWithInternalScrollTest.java b/core/tests/coretests/src/android/widget/scroll/RequestRectangleVisibleWithInternalScrollTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/RequestRectangleVisibleWithInternalScrollTest.java
rename to core/tests/coretests/src/android/widget/scroll/RequestRectangleVisibleWithInternalScrollTest.java
index 5d71466..5e9b520 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/RequestRectangleVisibleWithInternalScrollTest.java
+++ b/core/tests/coretests/src/android/widget/scroll/RequestRectangleVisibleWithInternalScrollTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll;
+package android.widget.scroll;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.ViewAsserts;
@@ -40,7 +40,7 @@
public RequestRectangleVisibleWithInternalScrollTest() {
- super("com.android.frameworktest",
+ super("com.android.frameworks.coretests",
RequestRectangleVisibleWithInternalScroll.class);
}
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/scroll/ScrollViewButtonsAndLabels.java b/core/tests/coretests/src/android/widget/scroll/ScrollViewButtonsAndLabels.java
similarity index 96%
rename from tests/FrameworkTest/src/com/android/frameworktest/scroll/ScrollViewButtonsAndLabels.java
rename to core/tests/coretests/src/android/widget/scroll/ScrollViewButtonsAndLabels.java
index 2d3be2e..4d0892c 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/scroll/ScrollViewButtonsAndLabels.java
+++ b/core/tests/coretests/src/android/widget/scroll/ScrollViewButtonsAndLabels.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll;
+package android.widget.scroll;
-import com.android.frameworktest.R;
+import com.android.frameworks.coretests.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/ScrollViewButtonsAndLabelsTest.java b/core/tests/coretests/src/android/widget/scroll/ScrollViewButtonsAndLabelsTest.java
similarity index 97%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/ScrollViewButtonsAndLabelsTest.java
rename to core/tests/coretests/src/android/widget/scroll/ScrollViewButtonsAndLabelsTest.java
index b23b567..7efb9aa 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/ScrollViewButtonsAndLabelsTest.java
+++ b/core/tests/coretests/src/android/widget/scroll/ScrollViewButtonsAndLabelsTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll;
+package android.widget.scroll;
-import com.android.frameworktest.scroll.ScrollViewButtonsAndLabels;
+import android.widget.scroll.ScrollViewButtonsAndLabels;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -36,7 +36,7 @@
private int mScreenTop;
public ScrollViewButtonsAndLabelsTest() {
- super("com.android.frameworktest",
+ super("com.android.frameworks.coretests",
ScrollViewButtonsAndLabels.class);
}
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/scroll/ShortButtons.java b/core/tests/coretests/src/android/widget/scroll/ShortButtons.java
similarity index 93%
rename from tests/FrameworkTest/src/com/android/frameworktest/scroll/ShortButtons.java
rename to core/tests/coretests/src/android/widget/scroll/ShortButtons.java
index b903382..3a0f29a 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/scroll/ShortButtons.java
+++ b/core/tests/coretests/src/android/widget/scroll/ShortButtons.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll;
+package android.widget.scroll;
-import com.android.frameworktest.util.ScrollViewScenario;
+import android.util.ScrollViewScenario;
import android.widget.Button;
import android.widget.LinearLayout;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/scroll/TallTextAboveButton.java b/core/tests/coretests/src/android/widget/scroll/TallTextAboveButton.java
similarity index 89%
rename from tests/FrameworkTest/src/com/android/frameworktest/scroll/TallTextAboveButton.java
rename to core/tests/coretests/src/android/widget/scroll/TallTextAboveButton.java
index 8b2e4f9..4096fe9 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/scroll/TallTextAboveButton.java
+++ b/core/tests/coretests/src/android/widget/scroll/TallTextAboveButton.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll;
+package android.widget.scroll;
-import com.android.frameworktest.util.ScrollViewScenario;
+import android.util.ScrollViewScenario;
/**
* An (unfocusable) text view that takes up more than the height
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/arrowscroll/ButtonsWithTallTextViewInBetweenTest.java b/core/tests/coretests/src/android/widget/scroll/arrowscroll/ButtonsWithTallTextViewInBetweenTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/arrowscroll/ButtonsWithTallTextViewInBetweenTest.java
rename to core/tests/coretests/src/android/widget/scroll/arrowscroll/ButtonsWithTallTextViewInBetweenTest.java
index 6b78560..56d7ed2 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/arrowscroll/ButtonsWithTallTextViewInBetweenTest.java
+++ b/core/tests/coretests/src/android/widget/scroll/arrowscroll/ButtonsWithTallTextViewInBetweenTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll.arrowscroll;
+package android.widget.scroll.arrowscroll;
-import com.android.frameworktest.scroll.ButtonsWithTallTextViewInBetween;
+import android.widget.scroll.ButtonsWithTallTextViewInBetween;
import android.graphics.Rect;
import android.test.ActivityInstrumentationTestCase;
@@ -36,7 +36,7 @@
private TextView mBottomButton;
public ButtonsWithTallTextViewInBetweenTest() {
- super("com.android.frameworktest", ButtonsWithTallTextViewInBetween.class);
+ super("com.android.frameworks.coretests", ButtonsWithTallTextViewInBetween.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/arrowscroll/ShortButtonsTest.java b/core/tests/coretests/src/android/widget/scroll/arrowscroll/ShortButtonsTest.java
similarity index 95%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/arrowscroll/ShortButtonsTest.java
rename to core/tests/coretests/src/android/widget/scroll/arrowscroll/ShortButtonsTest.java
index 689eb19..267d8ee 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/arrowscroll/ShortButtonsTest.java
+++ b/core/tests/coretests/src/android/widget/scroll/arrowscroll/ShortButtonsTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll.arrowscroll;
+package android.widget.scroll.arrowscroll;
-import com.android.frameworktest.scroll.ShortButtons;
+import android.widget.scroll.ShortButtons;
import android.graphics.Rect;
import android.test.ActivityInstrumentationTestCase;
@@ -31,7 +31,7 @@
private ScrollView mScrollView;
public ShortButtonsTest() {
- super("com.android.frameworktest", ShortButtons.class);
+ super("com.android.frameworks.coretests", ShortButtons.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/arrowscroll/TallTextAboveButtonTest.java b/core/tests/coretests/src/android/widget/scroll/arrowscroll/TallTextAboveButtonTest.java
similarity index 93%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/arrowscroll/TallTextAboveButtonTest.java
rename to core/tests/coretests/src/android/widget/scroll/arrowscroll/TallTextAboveButtonTest.java
index 573045d..5351839 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/arrowscroll/TallTextAboveButtonTest.java
+++ b/core/tests/coretests/src/android/widget/scroll/arrowscroll/TallTextAboveButtonTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.scroll.arrowscroll;
+package android.widget.scroll.arrowscroll;
-import com.android.frameworktest.scroll.TallTextAboveButton;
+import android.widget.scroll.TallTextAboveButton;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -39,7 +39,7 @@
}
public TallTextAboveButtonTest() {
- super("com.android.frameworktest", TallTextAboveButton.class);
+ super("com.android.frameworks.coretests", TallTextAboveButton.class);
}
@MediumTest
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/ChangeTouchModeTest.java b/core/tests/coretests/src/android/widget/touchmode/ChangeTouchModeTest.java
similarity index 82%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/ChangeTouchModeTest.java
rename to core/tests/coretests/src/android/widget/touchmode/ChangeTouchModeTest.java
index d274d0d..449c95c 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/ChangeTouchModeTest.java
+++ b/core/tests/coretests/src/android/widget/touchmode/ChangeTouchModeTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.android.frameworktest.touchmode;
+package android.widget.touchmode;
-import com.android.frameworktest.layout.linear.LLOfButtons1;
-import com.android.frameworktest.layout.linear.LLOfButtons2;
-import static com.android.frameworktest.util.TouchModeFlexibleAsserts.assertInTouchModeAfterClick;
-import static com.android.frameworktest.util.TouchModeFlexibleAsserts.assertNotInTouchModeAfterKey;
-import static com.android.frameworktest.util.TouchModeFlexibleAsserts.assertInTouchModeAfterTap;
+import android.widget.layout.linear.LLOfButtons1;
+import android.widget.layout.linear.LLOfButtons2;
+import static android.util.TouchModeFlexibleAsserts.assertInTouchModeAfterClick;
+import static android.util.TouchModeFlexibleAsserts.assertNotInTouchModeAfterKey;
+import static android.util.TouchModeFlexibleAsserts.assertInTouchModeAfterTap;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -34,7 +34,7 @@
public class ChangeTouchModeTest extends ActivityInstrumentationTestCase<LLOfButtons1> {
public ChangeTouchModeTest() {
- super("com.android.frameworktest", LLOfButtons1.class);
+ super("com.android.frameworks.coretests", LLOfButtons1.class);
}
@Override
@@ -73,7 +73,7 @@
LLOfButtons2 otherActivity = null;
try {
otherActivity =
- launchActivity("com.android.frameworktest", LLOfButtons2.class, null);
+ launchActivity("com.android.frameworks.coretests", LLOfButtons2.class, null);
assertNotNull(otherActivity);
assertFalse(otherActivity.isInTouchMode());
} finally {
@@ -89,7 +89,7 @@
LLOfButtons2 otherActivity = null;
try {
otherActivity =
- launchActivity("com.android.frameworktest", LLOfButtons2.class, null);
+ launchActivity("com.android.frameworks.coretests", LLOfButtons2.class, null);
assertNotNull(otherActivity);
assertTrue(otherActivity.isInTouchMode());
} finally {
@@ -107,7 +107,7 @@
LLOfButtons2 otherActivity = null;
try {
otherActivity =
- launchActivity("com.android.frameworktest", LLOfButtons2.class, null);
+ launchActivity("com.android.frameworks.coretests", LLOfButtons2.class, null);
assertNotNull(otherActivity);
assertFalse(otherActivity.isInTouchMode());
assertInTouchModeAfterClick(this, otherActivity.getFirstButton());
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/FocusableInTouchModeClickTest.java b/core/tests/coretests/src/android/widget/touchmode/FocusableInTouchModeClickTest.java
similarity index 91%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/FocusableInTouchModeClickTest.java
rename to core/tests/coretests/src/android/widget/touchmode/FocusableInTouchModeClickTest.java
index 7cd6444..691b25a 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/FocusableInTouchModeClickTest.java
+++ b/core/tests/coretests/src/android/widget/touchmode/FocusableInTouchModeClickTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.android.frameworktest.touchmode;
+package android.widget.touchmode;
-import com.android.frameworktest.layout.linear.LLOfTwoFocusableInTouchMode;
+import android.widget.layout.linear.LLOfTwoFocusableInTouchMode;
import android.test.ActivityInstrumentationTestCase2;
import android.test.TouchUtils;
@@ -26,7 +26,7 @@
public class FocusableInTouchModeClickTest extends ActivityInstrumentationTestCase2<LLOfTwoFocusableInTouchMode> {
public FocusableInTouchModeClickTest() {
- super("com.android.frameworktest", LLOfTwoFocusableInTouchMode.class);
+ super("com.android.frameworks.coretests", LLOfTwoFocusableInTouchMode.class);
}
protected void setUp() throws Exception {
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/StartInTouchWithViewInFocusTest.java b/core/tests/coretests/src/android/widget/touchmode/StartInTouchWithViewInFocusTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/StartInTouchWithViewInFocusTest.java
rename to core/tests/coretests/src/android/widget/touchmode/StartInTouchWithViewInFocusTest.java
index 6403435..5339188 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/StartInTouchWithViewInFocusTest.java
+++ b/core/tests/coretests/src/android/widget/touchmode/StartInTouchWithViewInFocusTest.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.frameworktest.touchmode;
+package android.widget.touchmode;
-import com.android.frameworktest.layout.linear.LLEditTextThenButton;
-import static com.android.frameworktest.util.TouchModeFlexibleAsserts.assertNotInTouchModeAfterKey;
+import android.widget.layout.linear.LLEditTextThenButton;
+import static android.util.TouchModeFlexibleAsserts.assertNotInTouchModeAfterKey;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.MediumTest;
@@ -33,7 +33,7 @@
private Button mButton;
public StartInTouchWithViewInFocusTest() {
- super("com.android.frameworktest", LLEditTextThenButton.class);
+ super("com.android.frameworks.coretests", LLEditTextThenButton.class);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/TouchModeFocusChangeTest.java b/core/tests/coretests/src/android/widget/touchmode/TouchModeFocusChangeTest.java
similarity index 85%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/TouchModeFocusChangeTest.java
rename to core/tests/coretests/src/android/widget/touchmode/TouchModeFocusChangeTest.java
index 1a0c833..bd6977e 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/TouchModeFocusChangeTest.java
+++ b/core/tests/coretests/src/android/widget/touchmode/TouchModeFocusChangeTest.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.android.frameworktest.touchmode;
+package android.widget.touchmode;
-import com.android.frameworktest.layout.linear.LLOfButtons1;
-import static com.android.frameworktest.util.TouchModeFlexibleAsserts.assertInTouchModeAfterClick;
-import static com.android.frameworktest.util.TouchModeFlexibleAsserts.assertInTouchModeAfterTap;
-import static com.android.frameworktest.util.TouchModeFlexibleAsserts.assertNotInTouchModeAfterKey;
+import android.widget.layout.linear.LLOfButtons1;
+import static android.util.TouchModeFlexibleAsserts.assertInTouchModeAfterClick;
+import static android.util.TouchModeFlexibleAsserts.assertInTouchModeAfterTap;
+import static android.util.TouchModeFlexibleAsserts.assertNotInTouchModeAfterKey;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -37,7 +37,7 @@
private Button mFirstButton;
public TouchModeFocusChangeTest() {
- super("com.android.frameworktest", LLOfButtons1.class);
+ super("com.android.frameworks.coretests", LLOfButtons1.class);
}
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/TouchModeFocusableTest.java b/core/tests/coretests/src/android/widget/touchmode/TouchModeFocusableTest.java
similarity index 88%
rename from tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/TouchModeFocusableTest.java
rename to core/tests/coretests/src/android/widget/touchmode/TouchModeFocusableTest.java
index 86925b5..dd07a08 100644
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/TouchModeFocusableTest.java
+++ b/core/tests/coretests/src/android/widget/touchmode/TouchModeFocusableTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.frameworktest.touchmode;
+package android.widget.touchmode;
-import com.android.frameworktest.layout.linear.LLEditTextThenButton;
-import static com.android.frameworktest.util.TouchModeFlexibleAsserts.assertInTouchModeAfterTap;
-import static com.android.frameworktest.util.TouchModeFlexibleAsserts.assertInTouchModeAfterClick;
+import android.widget.layout.linear.LLEditTextThenButton;
+import static android.util.TouchModeFlexibleAsserts.assertInTouchModeAfterTap;
+import static android.util.TouchModeFlexibleAsserts.assertInTouchModeAfterClick;
import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -36,7 +36,7 @@
public TouchModeFocusableTest() {
- super("com.android.frameworktest", LLEditTextThenButton.class);
+ super("com.android.frameworks.coretests", LLEditTextThenButton.class);
}
@Override
diff --git a/tests/CoreTests/com/android/internal/util/PredicatesTest.java b/core/tests/coretests/src/com/android/internal/util/PredicatesTest.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/util/PredicatesTest.java
rename to core/tests/coretests/src/com/android/internal/util/PredicatesTest.java
diff --git a/docs/html/guide/developing/debug-tasks.jd b/docs/html/guide/developing/debug-tasks.jd
index 975f6998..a980efc 100644
--- a/docs/html/guide/developing/debug-tasks.jd
+++ b/docs/html/guide/developing/debug-tasks.jd
@@ -80,13 +80,25 @@
<h2 id="additionaldebugging">Debugging and Testing with Dev Tools</h2>
-<p>With the Dev Tools application, you can turn on a number of settings that will
-make it easier to test and debug your applications. The Dev Tools application is automatically
-installed on all system images included with the SDK. The source code for the Dev Tools application
-is also provided in the SDK samples so that you may build it and then install the application on any
-development device.</p>
+<p>With the Dev Tools application, you can enable a number of settings on your device that will
+make it easier to test and debug your applications.</p>
-<p>To get to the development settings page on the emulator, launch the Dev Tools application and
+<p>The Dev Tools application is installed by default
+on all system images included with the SDK, so you can use it with the Android Emulator. If you'd
+like to install the Dev Tools application on a real development device, you can copy the
+application from your emulator and then install it on your device using ADB. To copy the
+application from a running emulator, execute:
+</p>
+<pre>
+adb -e pull /system/app/Development.apk ./Development.apk
+</pre>
+<p>This copies the .apk file into the current directory. Then install it on your connected device
+with:</p>
+<pre>
+adb -d install Development.apk
+</pre>
+
+<p>To get started, launch the Dev Tools application and
select Development Settings. This will open the Development Settings page with the
following options (among others):</p>
@@ -132,7 +144,7 @@
can happen during debugging.</dd>
</dl>
-<p>These settings will be remembered across emulator restarts. </p>
+<p>These settings will be remembered across emulator restarts.</p>
<h2 id="DebuggingWebPages">Debugging Web Pages</h2>
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 3c03eed..2313f4c 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -558,6 +558,30 @@
return decodeFileDescriptor(fd, null, null);
}
+ /**
+ * Set the default config used for decoding bitmaps. This config is
+ * presented to the codec if the caller did not specify a preferred config
+ * in their call to decode...
+ *
+ * The default value is chosen by the system to best match the device's
+ * screen and memory constraints.
+ *
+ * @param config The preferred config for decoding bitmaps. If null, then
+ * a suitable default is chosen by the system.
+ *
+ * @hide - only called by the browser at the moment, but should be stable
+ * enough to expose if needed
+ */
+ public static void setDefaultConfig(Bitmap.Config config) {
+ if (config == null) {
+ // pick this for now, as historically it was our default.
+ // However, if we have a smarter algorithm, we can change this.
+ config = Bitmap.Config.RGB_565;
+ }
+ nativeSetDefaultConfig(config.nativeInt);
+ }
+
+ private static native void nativeSetDefaultConfig(int nativeConfig);
private static native Bitmap nativeDecodeStream(InputStream is, byte[] storage,
Rect padding, Options opts);
private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd,
diff --git a/graphics/java/android/graphics/YuvImage.java b/graphics/java/android/graphics/YuvImage.java
new file mode 100644
index 0000000..4a3bd47
--- /dev/null
+++ b/graphics/java/android/graphics/YuvImage.java
@@ -0,0 +1,171 @@
+/*
+ * 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.graphics;
+
+import java.io.OutputStream;
+
+/**
+ * @hide pending API council approval
+ *
+ * YuvImage contains YUV data and provides a method that compresses a region of
+ * the YUV data to a Jpeg. The YUV data should be provided as a single byte
+ * array irrespective of the number of image planes in it. The stride of each
+ * image plane should be provided as well.
+ *
+ * To compress a rectangle region in the YUV data, users have to specify a
+ * region by width, height and offsets, where each image plane has a
+ * corresponding offset. All offsets are measured as a displacement in bytes
+ * from yuv[0], where yuv[0] is the beginning of the yuv data.
+ */
+public class YuvImage {
+
+ /**
+ * Number of bytes of temp storage we use for communicating between the
+ * native compressor and the java OutputStream.
+ */
+ private final static int WORKING_COMPRESS_STORAGE = 4096;
+
+ /**
+ * The YUV format as defined in {@link PixelFormat}.
+ */
+ private int mFormat;
+
+ /**
+ * The raw YUV data.
+ * In the case of more than one image plane, the image planes must be
+ * concatenated into a single byte array.
+ */
+ private byte[] mData;
+
+ /**
+ * The number of row bytes in each image plane.
+ */
+ private int[] mStrides;
+
+ /**
+ * Construct an YuvImage.
+ *
+ * @param yuv The YUV data. In the case of more than one image plane, all the planes must be
+ * concatenated into a single byte array.
+ * @param format The YUV data format as defined in {@link PixelFormat}.
+ * @param strides Row bytes of each image plane.
+ */
+ public YuvImage(byte[] yuv, int format, int[] strides) {
+ if ((yuv == null) || (strides == null)) {
+ throw new IllegalArgumentException(
+ "yuv or strides cannot be null");
+ }
+ mData = yuv;
+ mFormat = format;
+ mStrides = strides;
+ }
+
+ /**
+ * Compress a rectangle region in the YuvImage to a jpeg.
+ * Only PixelFormat.YCbCr_420_SP and PixelFormat.YCbCr_422_I
+ * are supported for now.
+ *
+ * @param width The width of the rectangle region.
+ * @param height The height of the rectangle region.
+ * @param offsets The offsets of the rectangle region in each image plane.
+ * The offsets are measured as a displacement in bytes from
+ * yuv[0], where yuv[0] is the beginning of the yuv data.
+ * @param quality Hint to the compressor, 0-100. 0 meaning compress for
+ * small size, 100 meaning compress for max quality.
+ * @param stream The outputstream to write the compressed data.
+ *
+ * @return true if successfully compressed to the specified stream.
+ *
+ */
+ public boolean compressToJpeg(int width, int height, int[] offsets, int quality,
+ OutputStream stream) {
+ if (!validate(mFormat, width, height, offsets)) {
+ return false;
+ }
+
+ if (quality < 0 || quality > 100) {
+ throw new IllegalArgumentException("quality must be 0..100");
+ }
+
+ if (stream == null) {
+ throw new NullPointerException();
+ }
+
+ return nativeCompressToJpeg(mData, mFormat, width, height, offsets,
+ mStrides, quality, stream, new byte[WORKING_COMPRESS_STORAGE]);
+ }
+
+ /**
+ * @return the YUV data.
+ */
+ public byte[] getYuvData() {
+ return mData;
+ }
+
+ /**
+ * @return the YUV format as defined in {@link PixelFormat}.
+ */
+ public int getYuvFormat() {
+ return mFormat;
+ }
+
+ /**
+ * @return the number of row bytes in each image plane.
+ */
+ public int[] getStrides() {
+ return mStrides;
+ }
+
+ protected boolean validate(int format, int width, int height, int[] offsets) {
+ if (format != PixelFormat.YCbCr_420_SP &&
+ format != PixelFormat.YCbCr_422_I) {
+ throw new IllegalArgumentException(
+ "only support PixelFormat.YCbCr_420_SP " +
+ "and PixelFormat.YCbCr_422_I for now");
+ }
+
+ if (offsets.length != mStrides.length) {
+ throw new IllegalArgumentException(
+ "the number of image planes are mismatched");
+ }
+
+ if (width <= 0 || height <= 0) {
+ throw new IllegalArgumentException(
+ "width and height must large than 0");
+ }
+
+ int requiredSize;
+ if (format == PixelFormat.YCbCr_420_SP) {
+ requiredSize = height * mStrides[0] +(height >> 1) * mStrides[1];
+ } else {
+ requiredSize = height * mStrides[0];
+ }
+
+ if (requiredSize > mData.length) {
+ throw new IllegalArgumentException(
+ "width or/and height is larger than the yuv data");
+ }
+
+ return true;
+ }
+
+ //////////// native methods
+
+ private static native boolean nativeCompressToJpeg(byte[] oriYuv,
+ int format, int width, int height, int[] offsets, int[] strides,
+ int quality, OutputStream stream, byte[] tempStorage);
+}
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index 7d100eb..e5cf38e 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -45,13 +45,11 @@
public void uploadToTexture(int baseMipLevel) {
mRS.validate();
- mRS.validateSurface();
mRS.nAllocationUploadToTexture(mID, baseMipLevel);
}
public void uploadToBufferObject() {
mRS.validate();
- mRS.validateSurface();
mRS.nAllocationUploadToBufferObject(mID);
}
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index b558de0..29361af 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -246,13 +246,8 @@
}
}
- void validateSurface() {
- //if (mSurface == null) {
- //throw new IllegalStateException("Uploading data to GL with no surface.");
- //}
- }
-
public void contextSetPriority(Priority p) {
+ validate();
nContextSetPriority(p.mID);
}
@@ -312,14 +307,17 @@
mSurface = sur;
mWidth = w;
mHeight = h;
+ validate();
nContextSetSurface(w, h, mSurface);
}
public void contextDump(int bits) {
+ validate();
nContextDump(bits);
}
public void destroy() {
+ validate();
nContextDeinitToClient();
mMessageThread.mRun = false;
@@ -335,10 +333,12 @@
}
void pause() {
+ validate();
nContextPause();
}
void resume() {
+ validate();
nContextResume();
}
@@ -379,22 +379,27 @@
}
public void contextBindRootScript(Script s) {
+ validate();
nContextBindRootScript(safeID(s));
}
public void contextBindProgramFragmentStore(ProgramStore p) {
+ validate();
nContextBindProgramFragmentStore(safeID(p));
}
public void contextBindProgramFragment(ProgramFragment p) {
+ validate();
nContextBindProgramFragment(safeID(p));
}
public void contextBindProgramRaster(ProgramRaster p) {
+ validate();
nContextBindProgramRaster(safeID(p));
}
public void contextBindProgramVertex(ProgramVertex p) {
+ validate();
nContextBindProgramVertex(safeID(p));
}
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h
index f935bb9..42bb4df 100644
--- a/include/media/AudioSystem.h
+++ b/include/media/AudioSystem.h
@@ -194,8 +194,8 @@
// set audio mode in audio hardware (see AudioSystem::audio_mode)
static status_t setMode(int mode);
- // returns true if tracks are active on AudioSystem::MUSIC stream
- static status_t isMusicActive(bool *state);
+ // returns true in *state if tracks are active on the specified stream
+ static status_t isStreamActive(int stream, bool *state);
// set/get audio hardware parameters. The function accepts a list of parameters
// key value pairs in the form: key1=value1;key2=value2;...
@@ -222,6 +222,17 @@
static status_t setVoiceVolume(float volume);
+ // return the number of audio frames written by AudioFlinger to audio HAL and
+ // audio dsp to DAC since the output on which the specificed stream is playing
+ // has exited standby.
+ // returned status (from utils/Errors.h) can be:
+ // - NO_ERROR: successful operation, halFrames and dspFrames point to valid data
+ // - INVALID_OPERATION: Not supported on current hardware platform
+ // - BAD_VALUE: invalid parameter
+ // NOTE: this feature is not supported on all hardware platforms and it is
+ // necessary to check returned status before using the returned values.
+ static status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int stream = DEFAULT);
+
//
// AudioPolicyService interface
//
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index a46c727..bddd23e 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -97,8 +97,8 @@
virtual status_t setMicMute(bool state) = 0;
virtual bool getMicMute() const = 0;
- // is a music stream active?
- virtual bool isMusicActive() const = 0;
+ // is any track active on this stream?
+ virtual bool isStreamActive(int stream) const = 0;
virtual status_t setParameters(int ioHandle, const String8& keyValuePairs) = 0;
virtual String8 getParameters(int ioHandle, const String8& keys) = 0;
@@ -130,6 +130,7 @@
virtual status_t setStreamOutput(uint32_t stream, int output) = 0;
virtual status_t setVoiceVolume(float volume) = 0;
+ virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output) = 0;
};
diff --git a/include/media/IOMX.h b/include/media/IOMX.h
index bb7677df..2f61cbe 100644
--- a/include/media/IOMX.h
+++ b/include/media/IOMX.h
@@ -166,6 +166,7 @@
OMX_U32 flags;
OMX_TICKS timestamp;
OMX_PTR platform_private;
+ OMX_PTR data_ptr;
} extended_buffer_data;
} u;
diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h
index 6575da6..588c51a 100644
--- a/include/media/MediaPlayerInterface.h
+++ b/include/media/MediaPlayerInterface.h
@@ -72,6 +72,7 @@
virtual ssize_t frameSize() const = 0;
virtual uint32_t latency() const = 0;
virtual float msecsPerFrame() const = 0;
+ virtual status_t getPosition(uint32_t *position) = 0;
// If no callback is specified, use the "write" API below to submit
// audio data. Otherwise return a full buffer of audio data on each
diff --git a/include/media/stagefright/AMRWriter.h b/include/media/stagefright/AMRWriter.h
new file mode 100644
index 0000000..372909a
--- /dev/null
+++ b/include/media/stagefright/AMRWriter.h
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+#ifndef AMR_WRITER_H_
+
+#define AMR_WRITER_H_
+
+#include <stdio.h>
+
+#include <media/stagefright/MediaWriter.h>
+#include <utils/threads.h>
+
+namespace android {
+
+struct MediaSource;
+
+struct AMRWriter : public MediaWriter {
+ AMRWriter(const char *filename);
+ AMRWriter(int fd);
+
+ status_t initCheck() const;
+
+ virtual status_t addSource(const sp<MediaSource> &source);
+ virtual bool reachedEOS();
+ virtual status_t start();
+ virtual void stop();
+
+protected:
+ virtual ~AMRWriter();
+
+private:
+ Mutex mLock;
+
+ FILE *mFile;
+ status_t mInitCheck;
+ sp<MediaSource> mSource;
+ bool mStarted;
+ volatile bool mDone;
+ bool mReachedEOS;
+ pthread_t mThread;
+
+ static void *ThreadWrapper(void *);
+ void threadFunc();
+
+ AMRWriter(const AMRWriter &);
+ AMRWriter &operator=(const AMRWriter &);
+};
+
+} // namespace android
+
+#endif // AMR_WRITER_H_
diff --git a/include/media/stagefright/AudioSource.h b/include/media/stagefright/AudioSource.h
index e129958..eb00140 100644
--- a/include/media/stagefright/AudioSource.h
+++ b/include/media/stagefright/AudioSource.h
@@ -18,16 +18,20 @@
#define AUDIO_SOURCE_H_
+#include <media/AudioSystem.h>
#include <media/stagefright/MediaSource.h>
namespace android {
class AudioRecord;
+struct MediaBufferGroup;
-class AudioSource {
-public:
- AudioSource(int inputSource);
- virtual ~AudioSource();
+struct AudioSource : public MediaSource {
+ // Note that the "channels" parameter is _not_ the number of channels,
+ // but a bitmask of AudioSystem::audio_channels constants.
+ AudioSource(
+ int inputSource, uint32_t sampleRate,
+ uint32_t channels = AudioSystem::CHANNEL_IN_MONO);
status_t initCheck() const;
@@ -38,9 +42,16 @@
virtual status_t read(
MediaBuffer **buffer, const ReadOptions *options = NULL);
+protected:
+ virtual ~AudioSource();
+
private:
+ enum { kMaxBufferSize = 8192 };
+
AudioRecord *mRecord;
status_t mInitCheck;
+ bool mStarted;
+ MediaBufferGroup *mGroup;
AudioSource(const AudioSource &);
AudioSource &operator=(const AudioSource &);
diff --git a/include/media/stagefright/CachingDataSource.h b/include/media/stagefright/CachingDataSource.h
index b0fc4b2..30b7ad9 100644
--- a/include/media/stagefright/CachingDataSource.h
+++ b/include/media/stagefright/CachingDataSource.h
@@ -33,6 +33,8 @@
virtual ssize_t readAt(off_t offset, void *data, size_t size);
+ virtual uint32_t flags();
+
protected:
virtual ~CachingDataSource();
diff --git a/include/media/stagefright/DataSource.h b/include/media/stagefright/DataSource.h
index f88666a..0c0ace0 100644
--- a/include/media/stagefright/DataSource.h
+++ b/include/media/stagefright/DataSource.h
@@ -31,6 +31,10 @@
class DataSource : public RefBase {
public:
+ enum Flags {
+ kWantsPrefetching = 1,
+ };
+
static sp<DataSource> CreateFromURI(const char *uri);
DataSource() {}
@@ -45,6 +49,10 @@
// May return ERROR_UNSUPPORTED.
virtual status_t getSize(off_t *size);
+ virtual uint32_t flags() {
+ return 0;
+ }
+
////////////////////////////////////////////////////////////////////////////
bool sniff(String8 *mimeType, float *confidence);
diff --git a/include/media/stagefright/HTTPDataSource.h b/include/media/stagefright/HTTPDataSource.h
index d5dc9e6..42444dc 100644
--- a/include/media/stagefright/HTTPDataSource.h
+++ b/include/media/stagefright/HTTPDataSource.h
@@ -33,6 +33,10 @@
virtual ssize_t readAt(off_t offset, void *data, size_t size);
+ virtual uint32_t flags() {
+ return kWantsPrefetching;
+ }
+
protected:
virtual ~HTTPDataSource();
@@ -49,9 +53,12 @@
void *mBuffer;
size_t mBufferLength;
off_t mBufferOffset;
+ bool mFirstRequest;
status_t mInitCheck;
+ ssize_t sendRangeRequest(size_t offset);
+
HTTPDataSource(const HTTPDataSource &);
HTTPDataSource &operator=(const HTTPDataSource &);
};
diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h
index 2ca04fa..6b93f19 100644
--- a/include/media/stagefright/MPEG4Writer.h
+++ b/include/media/stagefright/MPEG4Writer.h
@@ -20,8 +20,8 @@
#include <stdio.h>
+#include <media/stagefright/MediaWriter.h>
#include <utils/List.h>
-#include <utils/RefBase.h>
#include <utils/threads.h>
namespace android {
@@ -30,15 +30,15 @@
class MediaSource;
class MetaData;
-class MPEG4Writer : public RefBase {
+class MPEG4Writer : public MediaWriter {
public:
MPEG4Writer(const char *filename);
MPEG4Writer(int fd);
- void addSource(const sp<MediaSource> &source);
- status_t start();
- bool reachedEOS();
- void stop();
+ virtual status_t addSource(const sp<MediaSource> &source);
+ virtual status_t start();
+ virtual bool reachedEOS();
+ virtual void stop();
void beginBox(const char *fourcc);
void writeInt8(int8_t x);
diff --git a/include/media/stagefright/MediaWriter.h b/include/media/stagefright/MediaWriter.h
new file mode 100644
index 0000000..b8232c6
--- /dev/null
+++ b/include/media/stagefright/MediaWriter.h
@@ -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.
+ */
+
+#ifndef MEDIA_WRITER_H_
+
+#define MEDIA_WRITER_H_
+
+#include <utils/RefBase.h>
+
+namespace android {
+
+struct MediaSource;
+
+struct MediaWriter : public RefBase {
+ MediaWriter() {}
+
+ virtual status_t addSource(const sp<MediaSource> &source) = 0;
+ virtual bool reachedEOS() = 0;
+ virtual status_t start() = 0;
+ virtual void stop() = 0;
+
+protected:
+ virtual ~MediaWriter() {}
+
+private:
+ MediaWriter(const MediaWriter &);
+ MediaWriter &operator=(const MediaWriter &);
+};
+
+} // namespace android
+
+#endif // MEDIA_WRITER_H_
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h
index ac2f662..82dd2b5 100644
--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -94,6 +94,7 @@
kRequiresFlushCompleteEmulation = 16,
kRequiresAllocateBufferOnOutputPorts = 32,
kRequiresFlushBeforeShutdown = 64,
+ kDefersOutputBufferAllocation = 128,
};
struct BufferInfo {
diff --git a/include/ui/Camera.h b/include/ui/Camera.h
index 5219772..c506fb8 100644
--- a/include/ui/Camera.h
+++ b/include/ui/Camera.h
@@ -82,6 +82,7 @@
enum {
CAMERA_CMD_START_SMOOTH_ZOOM = 1,
CAMERA_CMD_STOP_SMOOTH_ZOOM = 2,
+ CAMERA_CMD_SET_DISPLAY_ORIENTATION = 3,
};
// camera fatal errors
@@ -209,4 +210,3 @@
}; // namespace android
#endif
-
diff --git a/include/ui/CameraParameters.h b/include/ui/CameraParameters.h
index a5ea133..cae0676 100644
--- a/include/ui/CameraParameters.h
+++ b/include/ui/CameraParameters.h
@@ -29,12 +29,6 @@
CameraParameters(const String8 ¶ms) { unflatten(params); }
~CameraParameters();
- enum {
- CAMERA_ORIENTATION_UNKNOWN = 0,
- CAMERA_ORIENTATION_PORTRAIT = 1,
- CAMERA_ORIENTATION_LANDSCAPE = 2,
- };
-
String8 flatten() const;
void unflatten(const String8 ¶ms);
@@ -63,9 +57,6 @@
void setPictureFormat(const char *format);
const char *getPictureFormat() const;
- int getOrientation() const;
- void setOrientation(int orientation);
-
void dump() const;
status_t dump(int fd, const Vector<String16>& args) const;
diff --git a/libs/audioflinger/A2dpAudioInterface.cpp b/libs/audioflinger/A2dpAudioInterface.cpp
index c07bbfe..747d0e4 100644
--- a/libs/audioflinger/A2dpAudioInterface.cpp
+++ b/libs/audioflinger/A2dpAudioInterface.cpp
@@ -457,4 +457,10 @@
return NO_ERROR;
}
+status_t A2dpAudioInterface::A2dpAudioStreamOut::getRenderPosition(uint32_t *driverFrames)
+{
+ //TODO: enable when supported by driver
+ return INVALID_OPERATION;
+}
+
}; // namespace android
diff --git a/libs/audioflinger/A2dpAudioInterface.h b/libs/audioflinger/A2dpAudioInterface.h
index 530e432..48154f9 100644
--- a/libs/audioflinger/A2dpAudioInterface.h
+++ b/libs/audioflinger/A2dpAudioInterface.h
@@ -93,6 +93,7 @@
virtual status_t dump(int fd, const Vector<String16>& args);
virtual status_t setParameters(const String8& keyValuePairs);
virtual String8 getParameters(const String8& keys);
+ virtual status_t getRenderPosition(uint32_t *dspFrames);
private:
friend class A2dpAudioInterface;
diff --git a/libs/audioflinger/AudioDumpInterface.cpp b/libs/audioflinger/AudioDumpInterface.cpp
index 858e5aa..30e2bc9 100644
--- a/libs/audioflinger/AudioDumpInterface.cpp
+++ b/libs/audioflinger/AudioDumpInterface.cpp
@@ -379,6 +379,12 @@
}
}
+status_t AudioStreamOutDump::getRenderPosition(uint32_t *dspFrames)
+{
+ if (mFinalStream != 0 ) return mFinalStream->getRenderPosition(dspFrames);
+ return INVALID_OPERATION;
+}
+
// ----------------------------------------------------------------------------
AudioStreamInDump::AudioStreamInDump(AudioDumpInterface *interface,
diff --git a/libs/audioflinger/AudioDumpInterface.h b/libs/audioflinger/AudioDumpInterface.h
index 1136ce1..5b9a6b1 100644
--- a/libs/audioflinger/AudioDumpInterface.h
+++ b/libs/audioflinger/AudioDumpInterface.h
@@ -56,8 +56,9 @@
void Close(void);
AudioStreamOut* finalStream() { return mFinalStream; }
uint32_t device() { return mDevice; }
-
int getId() { return mId; }
+ virtual status_t getRenderPosition(uint32_t *dspFrames);
+
private:
AudioDumpInterface *mInterface;
int mId;
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index ecfe1e0..cad420a 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -544,11 +544,11 @@
return mStreamTypes[stream].mute;
}
-bool AudioFlinger::isMusicActive() const
+bool AudioFlinger::isStreamActive(int stream) const
{
Mutex::Autolock _l(mLock);
for (uint32_t i = 0; i < mPlaybackThreads.size(); i++) {
- if (mPlaybackThreads.valueAt(i)->isMusicActive()) {
+ if (mPlaybackThreads.valueAt(i)->isStreamActive(stream)) {
return true;
}
}
@@ -633,6 +633,20 @@
return ret;
}
+status_t AudioFlinger::getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output)
+{
+ status_t status;
+
+ Mutex::Autolock _l(mLock);
+
+ PlaybackThread *playbackThread = checkPlaybackThread_l(output);
+ if (playbackThread != NULL) {
+ return playbackThread->getRenderPosition(halFrames, dspFrames);
+ }
+
+ return BAD_VALUE;
+}
+
void AudioFlinger::registerClient(const sp<IAudioFlingerClient>& client)
{
@@ -1071,7 +1085,7 @@
return mStreamTypes[stream].mute;
}
-bool AudioFlinger::PlaybackThread::isMusicActive() const
+bool AudioFlinger::PlaybackThread::isStreamActive(int stream) const
{
Mutex::Autolock _l(mLock);
size_t count = mActiveTracks.size();
@@ -1079,7 +1093,7 @@
sp<Track> t = mActiveTracks[i].promote();
if (t == 0) continue;
Track* const track = t.get();
- if (t->type() == AudioSystem::MUSIC)
+ if (t->type() == stream)
return true;
}
return false;
@@ -1166,6 +1180,19 @@
memset(mMixBuffer, 0, mFrameCount * 2 * sizeof(int16_t));
}
+status_t AudioFlinger::PlaybackThread::getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames)
+{
+ if (halFrames == 0 || dspFrames == 0) {
+ return BAD_VALUE;
+ }
+ if (mOutput == 0) {
+ return INVALID_OPERATION;
+ }
+ *halFrames = mBytesWritten/mOutput->frameSize();
+
+ return mOutput->getRenderPosition(dspFrames);
+}
+
// ----------------------------------------------------------------------------
AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, int id)
@@ -1290,8 +1317,9 @@
if (sleepTime == 0) {
mLastWriteTime = systemTime();
mInWrite = true;
+ mBytesWritten += mixBufferSize;
int bytesWritten = (int)mOutput->write(curBuf, mixBufferSize);
- if (bytesWritten > 0) mBytesWritten += bytesWritten;
+ if (bytesWritten < 0) mBytesWritten -= mixBufferSize;
mNumWrites++;
mInWrite = false;
nsecs_t now = systemTime();
@@ -1812,8 +1840,9 @@
if (sleepTime == 0) {
mLastWriteTime = systemTime();
mInWrite = true;
+ mBytesWritten += mixBufferSize;
int bytesWritten = (int)mOutput->write(mMixBuffer, mixBufferSize);
- if (bytesWritten) mBytesWritten += bytesWritten;
+ if (bytesWritten < 0) mBytesWritten -= mixBufferSize;
mNumWrites++;
mInWrite = false;
mStandby = false;
diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h
index 12c90eb..44da9ed 100644
--- a/libs/audioflinger/AudioFlinger.h
+++ b/libs/audioflinger/AudioFlinger.h
@@ -100,7 +100,7 @@
virtual status_t setMicMute(bool state);
virtual bool getMicMute() const;
- virtual bool isMusicActive() const;
+ virtual bool isStreamActive(int stream) const;
virtual status_t setParameters(int ioHandle, const String8& keyValuePairs);
virtual String8 getParameters(int ioHandle, const String8& keys);
@@ -136,6 +136,8 @@
virtual status_t setVoiceVolume(float volume);
+ virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output);
+
// IBinder::DeathRecipient
virtual void binderDied(const wp<IBinder>& who);
@@ -506,7 +508,7 @@
virtual float streamVolume(int stream) const;
virtual bool streamMute(int stream) const;
- bool isMusicActive() const;
+ bool isStreamActive(int stream) const;
sp<Track> createTrack_l(
const sp<AudioFlinger::Client>& client,
@@ -526,6 +528,7 @@
bool isSuspended() { return (mSuspended != 0); }
virtual String8 getParameters(const String8& keys);
virtual void audioConfigChanged(int event, int param = 0);
+ virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames);
struct stream_type_t {
stream_type_t()
diff --git a/libs/audioflinger/AudioHardwareGeneric.cpp b/libs/audioflinger/AudioHardwareGeneric.cpp
index 57874f3..d63c031 100644
--- a/libs/audioflinger/AudioHardwareGeneric.cpp
+++ b/libs/audioflinger/AudioHardwareGeneric.cpp
@@ -298,6 +298,11 @@
return param.toString();
}
+status_t AudioStreamOutGeneric::getRenderPosition(uint32_t *dspFrames)
+{
+ return INVALID_OPERATION;
+}
+
// ----------------------------------------------------------------------------
// record functions
@@ -310,9 +315,8 @@
uint32_t *pRate,
AudioSystem::audio_in_acoustics acoustics)
{
- // FIXME: remove logging
if (pFormat == 0 || pChannels == 0 || pRate == 0) return BAD_VALUE;
- LOGD("AudioStreamInGeneric::set(%p, %d, %d, %d, %u)", hw, fd, *pFormat, *pChannels, *pRate);
+ LOGV("AudioStreamInGeneric::set(%p, %d, %d, %d, %u)", hw, fd, *pFormat, *pChannels, *pRate);
// check values
if ((*pFormat != format()) ||
(*pChannels != channels()) ||
@@ -332,14 +336,10 @@
AudioStreamInGeneric::~AudioStreamInGeneric()
{
- // FIXME: remove logging
- LOGD("AudioStreamInGeneric destructor");
}
ssize_t AudioStreamInGeneric::read(void* buffer, ssize_t bytes)
{
- // FIXME: remove logging
- LOGD("AudioStreamInGeneric::read(%p, %d) from fd %d", buffer, (int)bytes, mFd);
AutoMutex lock(mLock);
if (mFd < 0) {
LOGE("Attempt to read from unopened device");
diff --git a/libs/audioflinger/AudioHardwareGeneric.h b/libs/audioflinger/AudioHardwareGeneric.h
index 42da413..95c7ea3 100644
--- a/libs/audioflinger/AudioHardwareGeneric.h
+++ b/libs/audioflinger/AudioHardwareGeneric.h
@@ -55,6 +55,7 @@
virtual status_t dump(int fd, const Vector<String16>& args);
virtual status_t setParameters(const String8& keyValuePairs);
virtual String8 getParameters(const String8& keys);
+ virtual status_t getRenderPosition(uint32_t *dspFrames);
private:
AudioHardwareGeneric *mAudioHardware;
diff --git a/libs/audioflinger/AudioHardwareStub.cpp b/libs/audioflinger/AudioHardwareStub.cpp
index ae391ee..ae215d1 100644
--- a/libs/audioflinger/AudioHardwareStub.cpp
+++ b/libs/audioflinger/AudioHardwareStub.cpp
@@ -158,6 +158,11 @@
return param.toString();
}
+status_t AudioStreamOutStub::getRenderPosition(uint32_t *dspFrames)
+{
+ return INVALID_OPERATION;
+}
+
// ----------------------------------------------------------------------------
status_t AudioStreamInStub::set(int *pFormat, uint32_t *pChannels, uint32_t *pRate,
diff --git a/libs/audioflinger/AudioHardwareStub.h b/libs/audioflinger/AudioHardwareStub.h
index 583f852..769ae3f 100644
--- a/libs/audioflinger/AudioHardwareStub.h
+++ b/libs/audioflinger/AudioHardwareStub.h
@@ -41,6 +41,7 @@
virtual status_t dump(int fd, const Vector<String16>& args);
virtual status_t setParameters(const String8& keyValuePairs) { return NO_ERROR;}
virtual String8 getParameters(const String8& keys);
+ virtual status_t getRenderPosition(uint32_t *dspFrames);
};
class AudioStreamInStub : public AudioStreamIn {
diff --git a/libs/rs/rsProgramFragment.cpp b/libs/rs/rsProgramFragment.cpp
index 00f19ae..15f3269 100644
--- a/libs/rs/rsProgramFragment.cpp
+++ b/libs/rs/rsProgramFragment.cpp
@@ -109,7 +109,7 @@
}
if (mSamplers[ct].get()) {
- mSamplers[ct]->setupGL();
+ mSamplers[ct]->setupGL(rsc);
} else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -141,32 +141,35 @@
void ProgramFragment::setupGL2(const Context *rsc, ProgramFragmentState *state, ShaderCache *sc)
{
+
//LOGE("sgl2 frag1 %x", glGetError());
if ((state->mLast.get() == this) && !mDirty) {
//return;
}
state->mLast.set(this);
+ rsc->checkError("ProgramFragment::setupGL2 start");
for (uint32_t ct=0; ct < MAX_TEXTURE; ct++) {
glActiveTexture(GL_TEXTURE0 + ct);
if (!(mTextureEnableMask & (1 << ct)) || !mTextures[ct].get()) {
- glDisable(GL_TEXTURE_2D);
continue;
}
mTextures[ct]->uploadCheck(rsc);
glBindTexture(GL_TEXTURE_2D, mTextures[ct]->getTextureID());
+ rsc->checkError("ProgramFragment::setupGL2 tex bind");
if (mSamplers[ct].get()) {
- mSamplers[ct]->setupGL();
+ mSamplers[ct]->setupGL(rsc);
} else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ rsc->checkError("ProgramFragment::setupGL2 tex env");
}
- glEnable(GL_TEXTURE_2D);
glUniform1i(sc->fragUniformSlot(ct), ct);
+ rsc->checkError("ProgramFragment::setupGL2 uniforms");
}
glActiveTexture(GL_TEXTURE0);
diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp
index cf6d7fc..28f13d4 100644
--- a/libs/rs/rsProgramVertex.cpp
+++ b/libs/rs/rsProgramVertex.cpp
@@ -168,27 +168,27 @@
}
mShader.append(mUserShader);
} else {
+ mShader.append("attribute vec4 ATTRIB_LegacyPosition;\n");
+ mShader.append("attribute vec4 ATTRIB_LegacyColor;\n");
+ mShader.append("attribute vec3 ATTRIB_LegacyNormal;\n");
+ mShader.append("attribute float ATTRIB_LegacyPointSize;\n");
+ mShader.append("attribute vec4 ATTRIB_LegacyTexture;\n");
+
for (uint32_t ct=0; ct < mUniformCount; ct++) {
mShader.append("uniform mat4 ");
mShader.append(mUniformNames[ct]);
mShader.append(";\n");
}
- for (uint32_t ct=VertexArray::POSITION; ct < mAttribCount; ct++) {
- mShader.append("attribute vec4 ");
- mShader.append(mAttribNames[ct]);
- mShader.append(";\n");
- }
-
mShader.append("void main() {\n");
- mShader.append(" gl_Position = UNI_MVP * ATTRIB_Position;\n");
- mShader.append(" gl_PointSize = ATTRIB_PointSize.x;\n");
+ mShader.append(" gl_Position = UNI_MVP * ATTRIB_LegacyPosition;\n");
+ mShader.append(" gl_PointSize = ATTRIB_LegacyPointSize;\n");
- mShader.append(" varColor = ATTRIB_Color;\n");
+ mShader.append(" varColor = ATTRIB_LegacyColor;\n");
if (mTextureMatrixEnable) {
- mShader.append(" varTex0 = UNI_TexMatrix * ATTRIB_Texture;\n");
+ mShader.append(" varTex0 = UNI_TexMatrix * ATTRIB_LegacyTexture;\n");
} else {
- mShader.append(" varTex0 = ATTRIB_Texture;\n");
+ mShader.append(" varTex0 = ATTRIB_LegacyTexture;\n");
}
//mShader.append(" pos.x = pos.x / 480.0;\n");
//mShader.append(" pos.y = pos.y / 800.0;\n");
@@ -204,6 +204,7 @@
//return;
}
+ rsc->checkError("ProgramVertex::setupGL2 start");
glVertexAttrib4f(1, state->color[0], state->color[1], state->color[2], state->color[3]);
const float *f = static_cast<const float *>(mConstants[0]->getPtr());
@@ -220,6 +221,7 @@
&f[RS_PROGRAM_VERTEX_TEXTURE_OFFSET]);
}
+ rsc->checkError("ProgramVertex::setupGL2 begin uniforms");
uint32_t uidx = 1;
for (uint32_t ct=0; ct < mConstantCount; ct++) {
Allocation *alloc = mConstants[ct+1].get();
@@ -326,10 +328,11 @@
}
}
+
void ProgramVertex::init(Context *rsc)
{
+ mAttribCount = 0;
if (mUserShader.size() > 0) {
- mAttribCount = 0;
for (uint32_t ct=0; ct < mInputCount; ct++) {
initAddUserElement(mInputElements[ct].get(), mAttribNames, &mAttribCount, "ATTRIB_");
}
@@ -340,13 +343,6 @@
initAddUserElement(mConstantTypes[ct]->getElement(), mUniformNames, &mUniformCount, "UNI_");
}
} else {
- mAttribCount = 5;
- mAttribNames[0].setTo("ATTRIB_Position");
- mAttribNames[1].setTo("ATTRIB_Color");
- mAttribNames[2].setTo("ATTRIB_Normal");
- mAttribNames[3].setTo("ATTRIB_PointSize");
- mAttribNames[4].setTo("ATTRIB_Texture");
-
mUniformCount = 2;
mUniformNames[0].setTo("UNI_MVP");
mUniformNames[1].setTo("UNI_TexMatrix");
diff --git a/libs/rs/rsSampler.cpp b/libs/rs/rsSampler.cpp
index f9bdb2e..7552d54 100644
--- a/libs/rs/rsSampler.cpp
+++ b/libs/rs/rsSampler.cpp
@@ -53,7 +53,7 @@
{
}
-void Sampler::setupGL()
+void Sampler::setupGL(const Context *rsc)
{
GLenum trans[] = {
GL_NEAREST, //RS_SAMPLER_NEAREST,
@@ -69,6 +69,7 @@
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, trans[mWrapS]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, trans[mWrapT]);
+ rsc->checkError("ProgramFragment::setupGL2 tex env");
}
void Sampler::bindToContext(SamplerState *ss, uint32_t slot)
@@ -83,18 +84,18 @@
mBoundSlot = -1;
ss->mSamplers[slot].clear();
}
-
+/*
void SamplerState::setupGL()
{
for (uint32_t ct=0; ct < RS_MAX_SAMPLER_SLOT; ct++) {
Sampler *s = mSamplers[ct].get();
if (s) {
- s->setupGL();
+ s->setupGL(rsc);
} else {
glBindTexture(GL_TEXTURE_2D, 0);
}
}
-}
+}*/
////////////////////////////////
diff --git a/libs/rs/rsSampler.h b/libs/rs/rsSampler.h
index ccf9b4d..9e20a2f 100644
--- a/libs/rs/rsSampler.h
+++ b/libs/rs/rsSampler.h
@@ -41,7 +41,7 @@
virtual ~Sampler();
void bind(Allocation *);
- void setupGL();
+ void setupGL(const Context *);
void bindToContext(SamplerState *, uint32_t slot);
void unbindFromContext(SamplerState *);
@@ -74,7 +74,7 @@
ObjectBaseRef<Sampler> mSamplers[RS_MAX_SAMPLER_SLOT];
- void setupGL();
+ //void setupGL();
};
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index eeb9468..6b8ed0d 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -687,7 +687,7 @@
float vtx[] = { x1, y1, z1, x2, y2, z2 };
VertexArray va;
- va.setPosition(2, GL_FLOAT, 12, (uint32_t)&vtx);
+ va.addLegacy(GL_FLOAT, 3, 12, RS_KIND_POSITION, false, (uint32_t)vtx);
if (rsc->checkVersion2_0()) {
va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache);
} else {
@@ -705,7 +705,7 @@
float vtx[] = { x, y, z };
VertexArray va;
- va.setPosition(1, GL_FLOAT, 12, (uint32_t)&vtx);
+ va.addLegacy(GL_FLOAT, 3, 12, RS_KIND_POSITION, false, (uint32_t)vtx);
if (rsc->checkVersion2_0()) {
va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache);
} else {
@@ -737,8 +737,8 @@
const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4};
VertexArray va;
- va.setPosition(3, GL_FLOAT, 12, (uint32_t)&vtx);
- va.setTexture(2, GL_FLOAT, 8, (uint32_t)&tex);
+ va.addLegacy(GL_FLOAT, 3, 12, RS_KIND_POSITION, false, (uint32_t)vtx);
+ va.addLegacy(GL_FLOAT, 2, 8, RS_KIND_TEXTURE, false, (uint32_t)tex);
if (rsc->checkVersion2_0()) {
va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache);
} else {
diff --git a/libs/rs/rsShaderCache.cpp b/libs/rs/rsShaderCache.cpp
index 8ac2487..3a1f370 100644
--- a/libs/rs/rsShaderCache.cpp
+++ b/libs/rs/rsShaderCache.cpp
@@ -86,6 +86,7 @@
e->vtx = vtx->getShaderID();
e->frag = frag->getShaderID();
e->program = glCreateProgram();
+ e->mUserVertexProgram = vtx->isUserProgram();
if (mEntries[mEntryCount].program) {
GLuint pgm = e->program;
glAttachShader(pgm, vtx->getShaderID());
@@ -93,13 +94,16 @@
glAttachShader(pgm, frag->getShaderID());
if (!vtx->isUserProgram()) {
- glBindAttribLocation(pgm, VertexArray::POSITION, "ATTRIB_Position");
- glBindAttribLocation(pgm, VertexArray::COLOR, "ATTRIB_Color");
- glBindAttribLocation(pgm, VertexArray::NORMAL, "ATTRIB_Normal");
- glBindAttribLocation(pgm, VertexArray::POINT_SIZE, "ATTRIB_PointSize");
- glBindAttribLocation(pgm, VertexArray::TEXTURE, "ATTRIB_T0");
- } else {
-
+ glBindAttribLocation(pgm, 0, "ATTRIB_LegacyPosition");
+ glBindAttribLocation(pgm, 1, "ATTRIB_LegacyColor");
+ glBindAttribLocation(pgm, 2, "ATTRIB_LegacyNormal");
+ glBindAttribLocation(pgm, 3, "ATTRIB_LegacyPointSize");
+ glBindAttribLocation(pgm, 4, "ATTRIB_LegacyTexture");
+ e->mVtxAttribSlots[RS_KIND_POSITION] = 0;
+ e->mVtxAttribSlots[RS_KIND_COLOR] = 1;
+ e->mVtxAttribSlots[RS_KIND_NORMAL] = 2;
+ e->mVtxAttribSlots[RS_KIND_POINT_SIZE] = 3;
+ e->mVtxAttribSlots[RS_KIND_TEXTURE] = 4;
}
//LOGE("e2 %x", glGetError());
@@ -120,10 +124,12 @@
}
glDeleteProgram(pgm);
}
- for (uint32_t ct=0; ct < vtx->getAttribCount(); ct++) {
- e->mVtxAttribSlots[ct] = glGetAttribLocation(pgm, vtx->getAttribName(ct));
- if (rsc->props.mLogShaders) {
- LOGV("vtx A %i, %s = %d\n", ct, vtx->getAttribName(ct).string(), e->mVtxAttribSlots[ct]);
+ if (vtx->isUserProgram()) {
+ for (uint32_t ct=0; ct < vtx->getAttribCount(); ct++) {
+ e->mVtxAttribSlots[ct] = glGetAttribLocation(pgm, vtx->getAttribName(ct));
+ if (rsc->props.mLogShaders) {
+ LOGV("vtx A %i, %s = %d\n", ct, vtx->getAttribName(ct).string(), e->mVtxAttribSlots[ct]);
+ }
}
}
for (uint32_t ct=0; ct < vtx->getUniformCount(); ct++) {
diff --git a/libs/rs/rsShaderCache.h b/libs/rs/rsShaderCache.h
index ede3734..7aa8183 100644
--- a/libs/rs/rsShaderCache.h
+++ b/libs/rs/rsShaderCache.h
@@ -44,6 +44,7 @@
int32_t vtxUniformSlot(uint32_t a) const {return mCurrent->mVtxUniformSlots[a];}
int32_t fragAttribSlot(uint32_t a) const {return mCurrent->mFragAttribSlots[a];}
int32_t fragUniformSlot(uint32_t a) const {return mCurrent->mFragUniformSlots[a];}
+ bool isUserVertexProgram() const {return mCurrent->mUserVertexProgram;}
protected:
typedef struct {
@@ -54,6 +55,7 @@
int32_t mVtxUniformSlots[Program::MAX_UNIFORMS];
int32_t mFragAttribSlots[Program::MAX_ATTRIBS];
int32_t mFragUniformSlots[Program::MAX_UNIFORMS];
+ bool mUserVertexProgram;
} entry_t;
entry_t *mEntries;
entry_t *mCurrent;
diff --git a/libs/rs/rsSimpleMesh.cpp b/libs/rs/rsSimpleMesh.cpp
index a819c07..53ce5cd 100644
--- a/libs/rs/rsSimpleMesh.cpp
+++ b/libs/rs/rsSimpleMesh.cpp
@@ -63,7 +63,7 @@
va.setActiveBuffer(mVertexBuffers[ct]->getBufferObjectID());
mVertexTypes[ct]->enableGLVertexBuffer2(&va);
}
- va.setupGL2(rsc, 0, &rsc->mShaderCache);
+ va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache);
} else {
for (uint32_t ct=0; ct < mVertexTypeCount; ct++) {
mVertexBuffers[ct]->uploadCheck(rsc);
diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp
index ddadd9f..22a267a 100644
--- a/libs/rs/rsType.cpp
+++ b/libs/rs/rsType.cpp
@@ -207,36 +207,48 @@
uint32_t stride = mElement->getSizeBytes();
if (mGL.mVtx.size) {
- va->setPosition(mGL.mVtx.size,
- mGL.mVtx.type,
- stride,
- mGL.mVtx.offset);
+ va->addLegacy(mGL.mVtx.type,
+ mGL.mVtx.size,
+ stride,
+ RS_KIND_POSITION,
+ false,
+ mGL.mVtx.offset);
}
if (mGL.mNorm.size) {
- va->setNormal(mGL.mNorm.type,
- stride,
- mGL.mNorm.offset);
+ va->addLegacy(mGL.mNorm.type,
+ 3,
+ stride,
+ RS_KIND_NORMAL,
+ false,
+ mGL.mNorm.offset);
}
if (mGL.mColor.size) {
- va->setColor(mGL.mColor.size,
- mGL.mColor.type,
+ va->addLegacy(mGL.mColor.type,
+ mGL.mColor.size,
stride,
+ RS_KIND_COLOR,
+ true,
mGL.mColor.offset);
}
if (mGL.mTex.size) {
- va->setTexture(mGL.mTex.size,
- mGL.mTex.type,
- stride,
- mGL.mTex.offset);
+ va->addLegacy(mGL.mTex.type,
+ mGL.mTex.size,
+ stride,
+ RS_KIND_TEXTURE,
+ false,
+ mGL.mTex.offset);
}
if (mGL.mPointSize.size) {
- va->setPointSize(mGL.mPointSize.type,
- stride,
- mGL.mPointSize.offset);
+ va->addLegacy(mGL.mPointSize.type,
+ 1,
+ stride,
+ RS_KIND_POINT_SIZE,
+ false,
+ mGL.mPointSize.offset);
}
}
@@ -249,7 +261,7 @@
uint32_t stride = mElement->getSizeBytes();
for (uint32_t ct=0; ct < RS_MAX_ATTRIBS; ct++) {
if (mGL.mUser[ct].size) {
- va->setUser(mGL.mUser[ct], stride);
+ va->addUser(mGL.mUser[ct], stride);
}
}
}
diff --git a/libs/rs/rsUtils.h b/libs/rs/rsUtils.h
index 3c6da68..07f8933 100644
--- a/libs/rs/rsUtils.h
+++ b/libs/rs/rsUtils.h
@@ -17,6 +17,7 @@
#ifndef ANDROID_RS_UTILS_H
#define ANDROID_RS_UTILS_H
+#define LOG_NDEBUG 0
#define LOG_TAG "RenderScript"
#include <utils/Log.h>
#include <utils/Vector.h>
diff --git a/libs/rs/rsVertexArray.cpp b/libs/rs/rsVertexArray.cpp
index 7124eb5..d0c0414 100644
--- a/libs/rs/rsVertexArray.cpp
+++ b/libs/rs/rsVertexArray.cpp
@@ -25,7 +25,7 @@
VertexArray::VertexArray()
{
- mActiveBuffer = 0;
+ clearAll();
}
VertexArray::~VertexArray()
@@ -39,6 +39,7 @@
mAttribs[ct].clear();
}
mActiveBuffer = 0;
+ mCount = 0;
}
VertexArray::Attrib::Attrib()
@@ -54,6 +55,7 @@
size = a.size;
stride = a.stride;
normalized = a.normalized;
+ kind = RS_KIND_USER;
name.setTo(a.name);
}
@@ -68,78 +70,42 @@
name.setTo("");
}
-void VertexArray::clear(AttribName n)
+void VertexArray::clear(uint32_t n)
{
mAttribs[n].clear();
}
-void VertexArray::setPosition(uint32_t size, uint32_t type, uint32_t stride, uint32_t offset)
+void VertexArray::addUser(const Attrib &a, uint32_t stride)
{
- mAttribs[POSITION].buffer = mActiveBuffer;
- mAttribs[POSITION].type = type;
- mAttribs[POSITION].size = size;
- mAttribs[POSITION].offset = offset;
- mAttribs[POSITION].stride = stride;
- mAttribs[POSITION].normalized = false;
+ assert(mCount < RS_MAX_ATTRIBS);
+ mAttribs[mCount].set(a);
+ mAttribs[mCount].buffer = mActiveBuffer;
+ mAttribs[mCount].stride = stride;
+ mAttribs[mCount].kind = RS_KIND_USER;
+ mCount ++;
}
-void VertexArray::setColor(uint32_t size, uint32_t type, uint32_t stride, uint32_t offset)
+void VertexArray::addLegacy(uint32_t type, uint32_t size, uint32_t stride, RsDataKind kind, bool normalized, uint32_t offset)
{
- mAttribs[COLOR].buffer = mActiveBuffer;
- mAttribs[COLOR].type = type;
- mAttribs[COLOR].size = size;
- mAttribs[COLOR].offset = offset;
- mAttribs[COLOR].stride = stride;
- mAttribs[COLOR].normalized = type != GL_FLOAT;
-}
-
-void VertexArray::setNormal(uint32_t type, uint32_t stride, uint32_t offset)
-{
- mAttribs[NORMAL].buffer = mActiveBuffer;
- mAttribs[NORMAL].type = type;
- mAttribs[NORMAL].size = 3;
- mAttribs[NORMAL].offset = offset;
- mAttribs[NORMAL].stride = stride;
- mAttribs[NORMAL].normalized = type != GL_FLOAT;
-}
-
-void VertexArray::setPointSize(uint32_t type, uint32_t stride, uint32_t offset)
-{
- mAttribs[POINT_SIZE].buffer = mActiveBuffer;
- mAttribs[POINT_SIZE].type = type;
- mAttribs[POINT_SIZE].size = 1;
- mAttribs[POINT_SIZE].offset = offset;
- mAttribs[POINT_SIZE].stride = stride;
- mAttribs[POINT_SIZE].normalized = false;
-}
-
-void VertexArray::setTexture(uint32_t size, uint32_t type, uint32_t stride, uint32_t offset)
-{
- mAttribs[TEXTURE].buffer = mActiveBuffer;
- mAttribs[TEXTURE].type = type;
- mAttribs[TEXTURE].size = size;
- mAttribs[TEXTURE].offset = offset;
- mAttribs[TEXTURE].stride = stride;
- mAttribs[TEXTURE].normalized = false;
-}
-
-void VertexArray::setUser(const Attrib &a, uint32_t stride)
-{
- // Find empty slot, some may be taken by legacy 1.1 slots.
- uint32_t slot = 0;
- while (mAttribs[slot].size) slot++;
- rsAssert(slot < RS_MAX_ATTRIBS);
- mAttribs[slot].set(a);
- mAttribs[slot].buffer = mActiveBuffer;
- mAttribs[slot].stride = stride;
+ assert(mCount < RS_MAX_ATTRIBS);
+ mAttribs[mCount].clear();
+ mAttribs[mCount].type = type;
+ mAttribs[mCount].size = size;
+ mAttribs[mCount].offset = offset;
+ mAttribs[mCount].normalized = normalized;
+ mAttribs[mCount].buffer = mActiveBuffer;
+ mAttribs[mCount].stride = stride;
+ mAttribs[mCount].kind = kind;
+ mCount ++;
}
void VertexArray::logAttrib(uint32_t idx, uint32_t slot) const {
- LOGE("va %i: slot=%i name=%s buf=%i size=%i type=0x%x stride=0x%x norm=%i offset=0x%x", idx, slot,
+ LOGE("va %i: slot=%i name=%s buf=%i size=%i type=0x%x kind=%i stride=0x%x norm=%i offset=0x%x", idx, slot,
mAttribs[idx].name.string(),
mAttribs[idx].buffer,
mAttribs[idx].size,
mAttribs[idx].type,
+ mAttribs[idx].kind,
mAttribs[idx].stride,
mAttribs[idx].normalized,
mAttribs[idx].offset);
@@ -147,92 +113,104 @@
void VertexArray::setupGL(const Context *rsc, class VertexArrayState *state) const
{
- if (mAttribs[POSITION].size) {
- //logAttrib(POSITION);
- glEnableClientState(GL_VERTEX_ARRAY);
- glBindBuffer(GL_ARRAY_BUFFER, mAttribs[POSITION].buffer);
- glVertexPointer(mAttribs[POSITION].size,
- mAttribs[POSITION].type,
- mAttribs[POSITION].stride,
- (void *)mAttribs[POSITION].offset);
- } else {
- rsAssert(0);
- }
-
- if (mAttribs[NORMAL].size) {
- //logAttrib(NORMAL);
- glEnableClientState(GL_NORMAL_ARRAY);
- rsAssert(mAttribs[NORMAL].size == 3);
- glBindBuffer(GL_ARRAY_BUFFER, mAttribs[NORMAL].buffer);
- glNormalPointer(mAttribs[NORMAL].type,
- mAttribs[NORMAL].stride,
- (void *)mAttribs[NORMAL].offset);
- } else {
- glDisableClientState(GL_NORMAL_ARRAY);
- }
-
- if (mAttribs[COLOR].size) {
- //logAttrib(COLOR);
- glEnableClientState(GL_COLOR_ARRAY);
- glBindBuffer(GL_ARRAY_BUFFER, mAttribs[COLOR].buffer);
- glColorPointer(mAttribs[COLOR].size,
- mAttribs[COLOR].type,
- mAttribs[COLOR].stride,
- (void *)mAttribs[COLOR].offset);
- } else {
- glDisableClientState(GL_COLOR_ARRAY);
- }
-
glClientActiveTexture(GL_TEXTURE0);
- if (mAttribs[TEXTURE].size) {
- //logAttrib(TEXTURE);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glBindBuffer(GL_ARRAY_BUFFER, mAttribs[TEXTURE].buffer);
- glTexCoordPointer(mAttribs[TEXTURE].size,
- mAttribs[TEXTURE].type,
- mAttribs[TEXTURE].stride,
- (void *)mAttribs[TEXTURE].offset);
- } else {
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glDisableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glDisableClientState(GL_POINT_SIZE_ARRAY_OES);
+
+ for (uint32_t ct=0; ct < mCount; ct++) {
+ switch(mAttribs[ct].kind) {
+ case RS_KIND_POSITION:
+ //logAttrib(POSITION);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer);
+ glVertexPointer(mAttribs[ct].size,
+ mAttribs[ct].type,
+ mAttribs[ct].stride,
+ (void *)mAttribs[ct].offset);
+ break;
+
+ case RS_KIND_NORMAL:
+ //logAttrib(NORMAL);
+ glEnableClientState(GL_NORMAL_ARRAY);
+ rsAssert(mAttribs[ct].size == 3);
+ glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer);
+ glNormalPointer(mAttribs[ct].type,
+ mAttribs[ct].stride,
+ (void *)mAttribs[ct].offset);
+ break;
+
+ case RS_KIND_COLOR:
+ //logAttrib(COLOR);
+ glEnableClientState(GL_COLOR_ARRAY);
+ glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer);
+ glColorPointer(mAttribs[ct].size,
+ mAttribs[ct].type,
+ mAttribs[ct].stride,
+ (void *)mAttribs[ct].offset);
+ break;
+
+ case RS_KIND_TEXTURE:
+ //logAttrib(TEXTURE);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer);
+ glTexCoordPointer(mAttribs[ct].size,
+ mAttribs[ct].type,
+ mAttribs[ct].stride,
+ (void *)mAttribs[ct].offset);
+ break;
+
+ case RS_KIND_POINT_SIZE:
+ //logAttrib(POINT_SIZE);
+ glEnableClientState(GL_POINT_SIZE_ARRAY_OES);
+ glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer);
+ glPointSizePointerOES(mAttribs[ct].type,
+ mAttribs[ct].stride,
+ (void *)mAttribs[ct].offset);
+ break;
+
+ default:
+ rsAssert(0);
+ }
}
- if (mAttribs[POINT_SIZE].size) {
- //logAttrib(POINT_SIZE);
- glEnableClientState(GL_POINT_SIZE_ARRAY_OES);
- glBindBuffer(GL_ARRAY_BUFFER, mAttribs[POINT_SIZE].buffer);
- glPointSizePointerOES(mAttribs[POINT_SIZE].type,
- mAttribs[POINT_SIZE].stride,
- (void *)mAttribs[POINT_SIZE].offset);
- } else {
- glDisableClientState(GL_POINT_SIZE_ARRAY_OES);
- }
rsc->checkError("VertexArray::setupGL");
}
void VertexArray::setupGL2(const Context *rsc, class VertexArrayState *state, ShaderCache *sc) const
{
- for (int ct=1; ct < _LAST; ct++) {
+ rsc->checkError("VertexArray::setupGL2 start");
+ for (uint32_t ct=1; ct <= state->mLastEnableCount; ct++) {
glDisableVertexAttribArray(ct);
}
- for (uint32_t ct=0; ct < RS_MAX_ATTRIBS; ct++) {
- if (mAttribs[ct].size && (sc->vtxAttribSlot(ct) >= 0)) {
- //logAttrib(ct, sc->vtxAttribSlot(ct));
- glEnableVertexAttribArray(sc->vtxAttribSlot(ct));
- glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer);
-
- glVertexAttribPointer(sc->vtxAttribSlot(ct),
- mAttribs[ct].size,
- mAttribs[ct].type,
- mAttribs[ct].normalized,
- mAttribs[ct].stride,
- (void *)mAttribs[ct].offset);
+ rsc->checkError("VertexArray::setupGL2 disabled");
+ for (uint32_t ct=0; ct < mCount; ct++) {
+ uint32_t slot = 0;
+ if (sc->isUserVertexProgram()) {
+ slot = sc->vtxAttribSlot(ct);
+ } else {
+ slot = sc->vtxAttribSlot(mAttribs[ct].kind);
}
+
+ //logAttrib(ct, slot);
+ glEnableVertexAttribArray(slot);
+ glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer);
+
+ glVertexAttribPointer(slot,
+ mAttribs[ct].size,
+ mAttribs[ct].type,
+ mAttribs[ct].normalized,
+ mAttribs[ct].stride,
+ (void *)mAttribs[ct].offset);
}
- rsc->checkError("VertexArray::setupGL2");
+ state->mLastEnableCount = mCount;
+ rsc->checkError("VertexArray::setupGL2 done");
}
////////////////////////////////////////////
void VertexArrayState::init(Context *) {
+ mLastEnableCount = 0;
}
diff --git a/libs/rs/rsVertexArray.h b/libs/rs/rsVertexArray.h
index 26e6f84..3904cb6 100644
--- a/libs/rs/rsVertexArray.h
+++ b/libs/rs/rsVertexArray.h
@@ -33,14 +33,6 @@
VertexArray();
virtual ~VertexArray();
- enum AttribName {
- POSITION,
- COLOR,
- NORMAL,
- POINT_SIZE,
- TEXTURE,
- _LAST
- };
class Attrib {
public:
@@ -51,6 +43,7 @@
uint32_t stride;
bool normalized;
String8 name;
+ RsDataKind kind;
Attrib();
void set(const Attrib &);
@@ -59,23 +52,19 @@
void clearAll();
- void clear(AttribName);
-
void setActiveBuffer(uint32_t id) {mActiveBuffer = id;}
-
- void setUser(const Attrib &, uint32_t stride);
- void setPosition(uint32_t size, uint32_t type, uint32_t stride, uint32_t offset);
- void setColor(uint32_t size, uint32_t type, uint32_t stride, uint32_t offset);
- void setNormal(uint32_t type, uint32_t stride, uint32_t offset);
- void setPointSize(uint32_t type, uint32_t stride, uint32_t offset);
- void setTexture(uint32_t size, uint32_t type, uint32_t stride, uint32_t offset);
+ void addUser(const Attrib &, uint32_t stride);
+ void addLegacy(uint32_t type, uint32_t size, uint32_t stride, RsDataKind kind, bool normalized, uint32_t offset);
void setupGL(const Context *rsc, class VertexArrayState *) const;
void setupGL2(const Context *rsc, class VertexArrayState *, ShaderCache *) const;
void logAttrib(uint32_t idx, uint32_t slot) const;
protected:
+ void clear(uint32_t index);
uint32_t mActiveBuffer;
+ uint32_t mCount;
+
Attrib mAttribs[RS_MAX_ATTRIBS];
};
@@ -84,6 +73,7 @@
public:
void init(Context *);
+ uint32_t mLastEnableCount;
//VertexArray::Attrib mAttribs[VertexArray::_LAST];
};
diff --git a/libs/ui/CameraParameters.cpp b/libs/ui/CameraParameters.cpp
index 2e0409b..a94f6b9 100644
--- a/libs/ui/CameraParameters.cpp
+++ b/libs/ui/CameraParameters.cpp
@@ -121,9 +121,6 @@
const char CameraParameters::FOCUS_MODE_MACRO[] = "macro";
const char CameraParameters::FOCUS_MODE_FIXED[] = "fixed";
-static const char* portrait = "portrait";
-static const char* landscape = "landscape";
-
CameraParameters::CameraParameters()
: mMap()
{
@@ -282,23 +279,6 @@
set(KEY_PREVIEW_FORMAT, format);
}
-int CameraParameters::getOrientation() const
-{
- const char* orientation = get("orientation");
- if (orientation && !strcmp(orientation, portrait))
- return CAMERA_ORIENTATION_PORTRAIT;
- return CAMERA_ORIENTATION_LANDSCAPE;
-}
-
-void CameraParameters::setOrientation(int orientation)
-{
- if (orientation == CAMERA_ORIENTATION_PORTRAIT) {
- set("orientation", portrait);
- } else {
- set("orientation", landscape);
- }
-}
-
const char *CameraParameters::getPreviewFormat() const
{
return get(KEY_PREVIEW_FORMAT);
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index e39a357..c4d4f99 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -500,7 +500,7 @@
LOGV("Opening device: %s", deviceName);
AutoMutex _l(mLock);
-
+
fd = open(deviceName, O_RDWR);
if(fd < 0) {
LOGE("could not open %s, %s\n", deviceName, strerror(errno));
diff --git a/location/tests/locationtests/Android.mk b/location/tests/locationtests/Android.mk
new file mode 100644
index 0000000..902cd96
--- /dev/null
+++ b/location/tests/locationtests/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 := FrameworksLocationTests
+
+include $(BUILD_PACKAGE)
+
diff --git a/location/tests/locationtests/AndroidManifest.xml b/location/tests/locationtests/AndroidManifest.xml
new file mode 100644
index 0000000..1d9df0f
--- /dev/null
+++ b/location/tests/locationtests/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.locationtests">
+
+ <!-- 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"/>
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.android.frameworks.locationtests"
+ android:label="Frameworks Location Tests" />
+</manifest>
diff --git a/tests/CoreTests/android/location/LocationTest.java b/location/tests/locationtests/src/android/location/LocationTest.java
similarity index 100%
rename from tests/CoreTests/android/location/LocationTest.java
rename to location/tests/locationtests/src/android/location/LocationTest.java
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index bb16215a..171881f 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -797,7 +797,7 @@
public void setMode(int mode) {
IAudioService service = getService();
try {
- service.setMode(mode);
+ service.setMode(mode, mICallBack);
} catch (RemoteException e) {
Log.e(TAG, "Dead object in setMode", e);
}
@@ -924,7 +924,7 @@
* @return true if any music tracks are active.
*/
public boolean isMusicActive() {
- return AudioSystem.isMusicActive();
+ return AudioSystem.isStreamActive(STREAM_MUSIC);
}
/*
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 482fc4f..bde8a47 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -54,7 +54,6 @@
import java.util.Map;
import java.util.Set;
-
/**
* The implementation of the volume manager service.
* <p>
@@ -231,6 +230,9 @@
// Forced device usage for communications
private int mForcedUseForComm;
+ // List of binder death handlers for setMode() client processes.
+ // The last process to have called setMode() is at the top of the list.
+ private ArrayList <SetModeDeathHandler> mSetModeDeathHandlers = new ArrayList <SetModeDeathHandler>();
///////////////////////////////////////////////////////////////////////////
// Construction
@@ -248,11 +250,13 @@
mVolumePanel = new VolumePanel(context, this);
mSettingsObserver = new SettingsObserver();
- mMode = AudioSystem.MODE_NORMAL;
mForcedUseForComm = AudioSystem.FORCE_NONE;
createAudioSystemThread();
readPersistedSettings();
createStreamStates();
+ // Call setMode() to initialize mSetModeDeathHandlers
+ mMode = AudioSystem.MODE_INVALID;
+ setMode(AudioSystem.MODE_NORMAL, null);
mMediaServerOk = true;
AudioSystem.setErrorCallback(mAudioSystemCallback);
loadSoundEffects();
@@ -582,8 +586,54 @@
return existingValue;
}
+ private class SetModeDeathHandler implements IBinder.DeathRecipient {
+ private IBinder mCb; // To be notified of client's death
+ private int mMode = AudioSystem.MODE_NORMAL; // Current mode set by this client
+
+ SetModeDeathHandler(IBinder cb) {
+ mCb = cb;
+ }
+
+ public void binderDied() {
+ synchronized(mSetModeDeathHandlers) {
+ Log.w(TAG, "setMode() client died");
+ int index = mSetModeDeathHandlers.indexOf(this);
+ if (index < 0) {
+ Log.w(TAG, "unregistered setMode() client died");
+ } else {
+ mSetModeDeathHandlers.remove(this);
+ // If dead client was a the top of client list,
+ // apply next mode in the stack
+ if (index == 0) {
+ // mSetModeDeathHandlers is never empty as the initial entry
+ // created when AudioService starts is never removed
+ SetModeDeathHandler hdlr = mSetModeDeathHandlers.get(0);
+ int mode = hdlr.getMode();
+ if (AudioService.this.mMode != mode) {
+ if (AudioSystem.setPhoneState(mode) == AudioSystem.AUDIO_STATUS_OK) {
+ AudioService.this.mMode = mode;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void setMode(int mode) {
+ mMode = mode;
+ }
+
+ public int getMode() {
+ return mMode;
+ }
+
+ public IBinder getBinder() {
+ return mCb;
+ }
+ }
+
/** @see AudioManager#setMode(int) */
- public void setMode(int mode) {
+ public void setMode(int mode, IBinder cb) {
if (!checkAudioSettingsPermission("setMode()")) {
return;
}
@@ -599,6 +649,37 @@
if (mode != mMode) {
if (AudioSystem.setPhoneState(mode) == AudioSystem.AUDIO_STATUS_OK) {
mMode = mode;
+
+ synchronized(mSetModeDeathHandlers) {
+ SetModeDeathHandler hdlr = null;
+ Iterator iter = mSetModeDeathHandlers.iterator();
+ while (iter.hasNext()) {
+ SetModeDeathHandler h = (SetModeDeathHandler)iter.next();
+ if (h.getBinder() == cb) {
+ hdlr = h;
+ // Remove from client list so that it is re-inserted at top of list
+ iter.remove();
+ break;
+ }
+ }
+ if (hdlr == null) {
+ hdlr = new SetModeDeathHandler(cb);
+ // cb is null when setMode() is called by AudioService constructor
+ if (cb != null) {
+ // Register for client death notification
+ try {
+ cb.linkToDeath(hdlr, 0);
+ } catch (RemoteException e) {
+ // Client has died!
+ Log.w(TAG, "setMode() could not link to "+cb+" binder death");
+ }
+ }
+ }
+ // Last client to call setMode() is always at top of client list
+ // as required by SetModeDeathHandler.binderDied()
+ mSetModeDeathHandlers.add(0, hdlr);
+ hdlr.setMode(mode);
+ }
}
}
int streamType = getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
@@ -876,10 +957,10 @@
if (AudioSystem.getForceUse(AudioSystem.FOR_COMMUNICATION) == AudioSystem.FORCE_BT_SCO) {
// Log.v(TAG, "getActiveStreamType: Forcing STREAM_BLUETOOTH_SCO...");
return AudioSystem.STREAM_BLUETOOTH_SCO;
- } else if (isOffhook) {
+ } else if (isOffhook || AudioSystem.isStreamActive(AudioSystem.STREAM_VOICE_CALL)) {
// Log.v(TAG, "getActiveStreamType: Forcing STREAM_VOICE_CALL...");
return AudioSystem.STREAM_VOICE_CALL;
- } else if (AudioSystem.isMusicActive()) {
+ } else if (AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC)) {
// Log.v(TAG, "getActiveStreamType: Forcing STREAM_MUSIC...");
return AudioSystem.STREAM_MUSIC;
} else if (suggestedStreamType == AudioManager.USE_DEFAULT_STREAM_TYPE) {
@@ -1285,7 +1366,7 @@
// Force creation of new IAudioflinger interface
if (!mMediaServerOk) {
Log.e(TAG, "Media server died.");
- AudioSystem.isMusicActive();
+ AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC);
sendMsg(mAudioHandler, MSG_MEDIA_SERVER_DIED, SHARED_MSG, SENDMSG_NOOP, 0, 0,
null, 500);
}
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 137b919..a4818ff 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -153,11 +153,11 @@
}
/*
- * Checks whether any music is active.
+ * Checks whether the specified stream type is active.
*
- * return true if any music tracks are active.
+ * return true if any track playing on this stream is active.
*/
- public static native boolean isMusicActive();
+ public static native boolean isStreamActive(int stream);
/*
* Sets a group generic audio configuration parameters. The use of these parameters
diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl
index d3d2d29..83581d2 100644
--- a/media/java/android/media/IAudioService.aidl
+++ b/media/java/android/media/IAudioService.aidl
@@ -47,7 +47,7 @@
boolean shouldVibrate(int vibrateType);
- void setMode(int mode);
+ void setMode(int mode, IBinder cb);
int getMode();
diff --git a/media/jni/Android.mk b/media/jni/Android.mk
index ca6230f..1d82e32 100644
--- a/media/jni/Android.mk
+++ b/media/jni/Android.mk
@@ -1,6 +1,10 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
+ifneq ($(BUILD_WITHOUT_PV),true)
+include external/opencore/Config.mk
+endif
+
LOCAL_SRC_FILES:= \
android_media_MediaPlayer.cpp \
android_media_MediaRecorder.cpp \
@@ -19,6 +23,7 @@
libcutils
ifneq ($(BUILD_WITHOUT_PV),true)
+
LOCAL_SRC_FILES += \
android_media_AmrInputStream.cpp
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index 5352234..c5dfbb5 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -170,10 +170,10 @@
}
-status_t AudioSystem::isMusicActive(bool* state) {
+status_t AudioSystem::isStreamActive(int stream, bool* state) {
const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
if (af == 0) return PERMISSION_DENIED;
- *state = af->isMusicActive();
+ *state = af->isStreamActive(stream);
return NO_ERROR;
}
@@ -342,12 +342,27 @@
return af->setVoiceVolume(value);
}
+status_t AudioSystem::getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int stream)
+{
+ const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
+ if (af == 0) return PERMISSION_DENIED;
+
+ if (stream == DEFAULT) {
+ stream = MUSIC;
+ }
+
+ return af->getRenderPosition(halFrames, dspFrames, getOutput((stream_type)stream));
+}
+
// ---------------------------------------------------------------------------
void AudioSystem::AudioFlingerClient::binderDied(const wp<IBinder>& who) {
Mutex::Autolock _l(AudioSystem::gLock);
AudioSystem::gAudioFlinger.clear();
+ // clear output handles and stream to output map caches
+ AudioSystem::gStreamOutputMap.clear();
+ AudioSystem::gOutputs.clear();
if (gAudioErrorCallback) {
gAudioErrorCallback(DEAD_OBJECT);
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index 0eff205..ca3a2a6 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -47,7 +47,7 @@
SET_MODE,
SET_MIC_MUTE,
GET_MIC_MUTE,
- IS_MUSIC_ACTIVE,
+ IS_STREAM_ACTIVE,
SET_PARAMETERS,
GET_PARAMETERS,
REGISTER_CLIENT,
@@ -60,7 +60,8 @@
OPEN_INPUT,
CLOSE_INPUT,
SET_STREAM_OUTPUT,
- SET_VOICE_VOLUME
+ SET_VOICE_VOLUME,
+ GET_RENDER_POSITION
};
class BpAudioFlinger : public BpInterface<IAudioFlinger>
@@ -286,11 +287,12 @@
return reply.readInt32();
}
- virtual bool isMusicActive() const
+ virtual bool isStreamActive(int stream) const
{
Parcel data, reply;
data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
- remote()->transact(IS_MUSIC_ACTIVE, data, &reply);
+ data.writeInt32(stream);
+ remote()->transact(IS_STREAM_ACTIVE, data, &reply);
return reply.readInt32();
}
@@ -465,6 +467,26 @@
remote()->transact(SET_VOICE_VOLUME, data, &reply);
return reply.readInt32();
}
+
+ virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
+ data.writeInt32(output);
+ remote()->transact(GET_RENDER_POSITION, data, &reply);
+ status_t status = reply.readInt32();
+ if (status == NO_ERROR) {
+ uint32_t tmp = reply.readInt32();
+ if (halFrames) {
+ *halFrames = tmp;
+ }
+ tmp = reply.readInt32();
+ if (dspFrames) {
+ *dspFrames = tmp;
+ }
+ }
+ return status;
+ }
};
IMPLEMENT_META_INTERFACE(AudioFlinger, "android.media.IAudioFlinger");
@@ -599,9 +621,10 @@
reply->writeInt32( getMicMute() );
return NO_ERROR;
} break;
- case IS_MUSIC_ACTIVE: {
+ case IS_STREAM_ACTIVE: {
CHECK_INTERFACE(IAudioFlinger, data, reply);
- reply->writeInt32( isMusicActive() );
+ int stream = data.readInt32();
+ reply->writeInt32( isStreamActive(stream) );
return NO_ERROR;
} break;
case SET_PARAMETERS: {
@@ -716,6 +739,19 @@
reply->writeInt32( setVoiceVolume(volume) );
return NO_ERROR;
} break;
+ case GET_RENDER_POSITION: {
+ CHECK_INTERFACE(IAudioFlinger, data, reply);
+ int output = data.readInt32();
+ uint32_t halFrames;
+ uint32_t dspFrames;
+ status_t status = getRenderPosition(&halFrames, &dspFrames, output);
+ reply->writeInt32(status);
+ if (status == NO_ERROR) {
+ reply->writeInt32(halFrames);
+ reply->writeInt32(dspFrames);
+ }
+ return NO_ERROR;
+ }
default:
return BBinder::onTransact(code, data, reply, flags);
}
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index af8d1b5..5b061b1 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -1432,6 +1432,12 @@
return mMsecsPerFrame;
}
+status_t MediaPlayerService::AudioOutput::getPosition(uint32_t *position)
+{
+ if (mTrack == 0) return NO_INIT;
+ return mTrack->getPosition(position);
+}
+
status_t MediaPlayerService::AudioOutput::open(
uint32_t sampleRate, int channelCount, int format, int bufferCount,
AudioCallback cb, void *cookie)
@@ -1613,6 +1619,13 @@
return mMsecsPerFrame;
}
+status_t MediaPlayerService::AudioCache::getPosition(uint32_t *position)
+{
+ if (position == 0) return BAD_VALUE;
+ *position = mSize;
+ return NO_ERROR;
+}
+
status_t MediaPlayerService::AudioCache::open(
uint32_t sampleRate, int channelCount, int format, int bufferCount,
AudioCallback cb, void *cookie)
diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h
index d1206b4..d243b96 100644
--- a/media/libmediaplayerservice/MediaPlayerService.h
+++ b/media/libmediaplayerservice/MediaPlayerService.h
@@ -76,6 +76,7 @@
virtual ssize_t frameSize() const;
virtual uint32_t latency() const;
virtual float msecsPerFrame() const;
+ virtual status_t getPosition(uint32_t *position);
virtual status_t open(
uint32_t sampleRate, int channelCount,
@@ -130,6 +131,7 @@
virtual ssize_t frameSize() const { return ssize_t(mChannelCount * ((mFormat == AudioSystem::PCM_16_BIT)?sizeof(int16_t):sizeof(u_int8_t))); }
virtual uint32_t latency() const;
virtual float msecsPerFrame() const;
+ virtual status_t getPosition(uint32_t *position);
virtual status_t open(
uint32_t sampleRate, int channelCount, int format,
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index a55273d..6383f0c 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -20,6 +20,8 @@
#include "StagefrightRecorder.h"
+#include <media/stagefright/AudioSource.h>
+#include <media/stagefright/AMRWriter.h>
#include <media/stagefright/CameraSource.h>
#include <media/stagefright/MPEG4Writer.h>
#include <media/stagefright/MediaDebug.h>
@@ -146,7 +148,90 @@
return UNKNOWN_ERROR;
}
- if (mVideoSource == VIDEO_SOURCE_CAMERA) {
+ switch (mOutputFormat) {
+ case OUTPUT_FORMAT_DEFAULT:
+ case OUTPUT_FORMAT_THREE_GPP:
+ case OUTPUT_FORMAT_MPEG_4:
+ return startMPEG4Recording();
+
+ case OUTPUT_FORMAT_AMR_NB:
+ case OUTPUT_FORMAT_AMR_WB:
+ return startAMRRecording();
+
+ default:
+ return UNKNOWN_ERROR;
+ }
+}
+
+sp<MediaSource> StagefrightRecorder::createAMRAudioSource() {
+ uint32_t sampleRate =
+ mAudioEncoder == AUDIO_ENCODER_AMR_NB ? 8000 : 16000;
+
+ sp<AudioSource> audioSource =
+ new AudioSource(
+ mAudioSource,
+ sampleRate,
+ AudioSystem::CHANNEL_IN_MONO);
+
+ status_t err = audioSource->initCheck();
+
+ if (err != OK) {
+ return NULL;
+ }
+
+ sp<MetaData> encMeta = new MetaData;
+ encMeta->setCString(
+ kKeyMIMEType,
+ mAudioEncoder == AUDIO_ENCODER_AMR_NB
+ ? MEDIA_MIMETYPE_AUDIO_AMR_NB : MEDIA_MIMETYPE_AUDIO_AMR_WB);
+
+ encMeta->setInt32(kKeyChannelCount, 1);
+ encMeta->setInt32(kKeySampleRate, sampleRate);
+
+ OMXClient client;
+ CHECK_EQ(client.connect(), OK);
+
+ sp<MediaSource> audioEncoder =
+ OMXCodec::Create(client.interface(), encMeta,
+ true /* createEncoder */, audioSource);
+
+ return audioEncoder;
+}
+
+status_t StagefrightRecorder::startAMRRecording() {
+ if (mAudioSource == AUDIO_SOURCE_LIST_END
+ || mVideoSource != VIDEO_SOURCE_LIST_END) {
+ return UNKNOWN_ERROR;
+ }
+
+ if (mOutputFormat == OUTPUT_FORMAT_AMR_NB
+ && mAudioEncoder != AUDIO_ENCODER_DEFAULT
+ && mAudioEncoder != AUDIO_ENCODER_AMR_NB) {
+ return UNKNOWN_ERROR;
+ } else if (mOutputFormat == OUTPUT_FORMAT_AMR_WB
+ && mAudioEncoder != AUDIO_ENCODER_AMR_WB) {
+ return UNKNOWN_ERROR;
+ }
+
+ sp<MediaSource> audioEncoder = createAMRAudioSource();
+
+ if (audioEncoder == NULL) {
+ return UNKNOWN_ERROR;
+ }
+
+ CHECK(mOutputFd >= 0);
+ mWriter = new AMRWriter(dup(mOutputFd));
+ mWriter->addSource(audioEncoder);
+ mWriter->start();
+
+ return OK;
+}
+
+status_t StagefrightRecorder::startMPEG4Recording() {
+ mWriter = new MPEG4Writer(dup(mOutputFd));
+
+ if (mVideoSource == VIDEO_SOURCE_DEFAULT
+ || mVideoSource == VIDEO_SOURCE_CAMERA) {
CHECK(mCamera != NULL);
sp<CameraSource> cameraSource =
@@ -193,11 +278,20 @@
true /* createEncoder */, cameraSource);
CHECK(mOutputFd >= 0);
- mWriter = new MPEG4Writer(dup(mOutputFd));
mWriter->addSource(encoder);
- mWriter->start();
}
+ if (mAudioSource != AUDIO_SOURCE_LIST_END) {
+ sp<MediaSource> audioEncoder = createAMRAudioSource();
+
+ if (audioEncoder == NULL) {
+ return UNKNOWN_ERROR;
+ }
+
+ mWriter->addSource(audioEncoder);
+ }
+
+ mWriter->start();
return OK;
}
@@ -235,7 +329,9 @@
}
status_t StagefrightRecorder::getMaxAmplitude(int *max) {
- return UNKNOWN_ERROR;
+ *max = 0;
+
+ return OK;
}
} // namespace android
diff --git a/media/libmediaplayerservice/StagefrightRecorder.h b/media/libmediaplayerservice/StagefrightRecorder.h
index 56c4e0e..7ec412d 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.h
+++ b/media/libmediaplayerservice/StagefrightRecorder.h
@@ -23,7 +23,8 @@
namespace android {
-class MPEG4Writer;
+struct MediaSource;
+struct MediaWriter;
struct StagefrightRecorder : public MediaRecorderBase {
StagefrightRecorder();
@@ -54,7 +55,7 @@
sp<ICamera> mCamera;
sp<ISurface> mPreviewSurface;
sp<IMediaPlayerClient> mListener;
- sp<MPEG4Writer> mWriter;
+ sp<MediaWriter> mWriter;
audio_source mAudioSource;
video_source mVideoSource;
@@ -66,6 +67,10 @@
String8 mParams;
int mOutputFd;
+ status_t startMPEG4Recording();
+ status_t startAMRRecording();
+ sp<MediaSource> createAMRAudioSource();
+
StagefrightRecorder(const StagefrightRecorder &);
StagefrightRecorder &operator=(const StagefrightRecorder &);
};
diff --git a/media/libstagefright/AMRWriter.cpp b/media/libstagefright/AMRWriter.cpp
new file mode 100644
index 0000000..caff452
--- /dev/null
+++ b/media/libstagefright/AMRWriter.cpp
@@ -0,0 +1,193 @@
+/*
+ * 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.
+ */
+
+#include <media/stagefright/AMRWriter.h>
+
+#include <media/stagefright/MediaBuffer.h>
+#include <media/stagefright/MediaDebug.h>
+#include <media/stagefright/MediaDefs.h>
+#include <media/stagefright/MediaErrors.h>
+#include <media/stagefright/MediaSource.h>
+#include <media/stagefright/MetaData.h>
+
+namespace android {
+
+AMRWriter::AMRWriter(const char *filename)
+ : mFile(fopen(filename, "wb")),
+ mInitCheck(mFile != NULL ? OK : NO_INIT),
+ mStarted(false) {
+}
+
+AMRWriter::AMRWriter(int fd)
+ : mFile(fdopen(fd, "wb")),
+ mInitCheck(mFile != NULL ? OK : NO_INIT),
+ mStarted(false) {
+}
+
+AMRWriter::~AMRWriter() {
+ if (mStarted) {
+ stop();
+ }
+
+ if (mFile != NULL) {
+ fclose(mFile);
+ mFile = NULL;
+ }
+}
+
+status_t AMRWriter::initCheck() const {
+ return mInitCheck;
+}
+
+status_t AMRWriter::addSource(const sp<MediaSource> &source) {
+ Mutex::Autolock autoLock(mLock);
+
+ if (mInitCheck != OK) {
+ return mInitCheck;
+ }
+
+ if (mSource != NULL) {
+ // AMR files only support a single track of audio.
+ return UNKNOWN_ERROR;
+ }
+
+ sp<MetaData> meta = source->getFormat();
+
+ const char *mime;
+ CHECK(meta->findCString(kKeyMIMEType, &mime));
+
+ bool isWide = false;
+ if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_WB)) {
+ isWide = true;
+ } else if (strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_NB)) {
+ return ERROR_UNSUPPORTED;
+ }
+
+ int32_t channelCount;
+ int32_t sampleRate;
+ CHECK(meta->findInt32(kKeyChannelCount, &channelCount));
+ CHECK_EQ(channelCount, 1);
+ CHECK(meta->findInt32(kKeySampleRate, &sampleRate));
+ CHECK_EQ(sampleRate, (isWide ? 16000 : 8000));
+
+ mSource = source;
+
+ const char *kHeader = isWide ? "#!AMR-WB\n" : "#!AMR\n";
+ size_t n = strlen(kHeader);
+ if (fwrite(kHeader, 1, n, mFile) != n) {
+ return ERROR_IO;
+ }
+
+ return OK;
+}
+
+status_t AMRWriter::start() {
+ Mutex::Autolock autoLock(mLock);
+
+ if (mInitCheck != OK) {
+ return mInitCheck;
+ }
+
+ if (mStarted || mSource == NULL) {
+ return UNKNOWN_ERROR;
+ }
+
+ status_t err = mSource->start();
+
+ if (err != OK) {
+ return err;
+ }
+
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
+
+ mReachedEOS = false;
+ mDone = false;
+
+ pthread_create(&mThread, &attr, ThreadWrapper, this);
+ pthread_attr_destroy(&attr);
+
+ mStarted = true;
+
+ return OK;
+}
+
+void AMRWriter::stop() {
+ {
+ Mutex::Autolock autoLock(mLock);
+
+ if (!mStarted) {
+ return;
+ }
+
+ mDone = true;
+ }
+
+ void *dummy;
+ pthread_join(mThread, &dummy);
+
+ mSource->stop();
+
+ mStarted = false;
+}
+
+// static
+void *AMRWriter::ThreadWrapper(void *me) {
+ static_cast<AMRWriter *>(me)->threadFunc();
+
+ return NULL;
+}
+
+void AMRWriter::threadFunc() {
+ for (;;) {
+ Mutex::Autolock autoLock(mLock);
+
+ if (mDone) {
+ break;
+ }
+
+ MediaBuffer *buffer;
+ status_t err = mSource->read(&buffer);
+
+ if (err != OK) {
+ break;
+ }
+
+ ssize_t n = fwrite(
+ (const uint8_t *)buffer->data() + buffer->range_offset(),
+ 1,
+ buffer->range_length(),
+ mFile);
+
+ buffer->release();
+ buffer = NULL;
+
+ if (n < (ssize_t)buffer->range_length()) {
+ break;
+ }
+ }
+
+ Mutex::Autolock autoLock(mLock);
+ mReachedEOS = true;
+}
+
+bool AMRWriter::reachedEOS() {
+ Mutex::Autolock autoLock(mLock);
+ return mReachedEOS;
+}
+
+} // namespace android
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 26b9357..dbb52c6 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -16,7 +16,9 @@
LOCAL_SRC_FILES += \
AMRExtractor.cpp \
+ AMRWriter.cpp \
AudioPlayer.cpp \
+ AudioSource.cpp \
AwesomePlayer.cpp \
CachingDataSource.cpp \
CameraSource.cpp \
@@ -29,6 +31,7 @@
MPEG4Extractor.cpp \
MPEG4Writer.cpp \
MediaExtractor.cpp \
+ Prefetcher.cpp \
SampleIterator.cpp \
SampleTable.cpp \
ShoutcastSource.cpp \
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
new file mode 100644
index 0000000..edabaf9
--- /dev/null
+++ b/media/libstagefright/AudioSource.cpp
@@ -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.
+ */
+
+#include <media/stagefright/AudioSource.h>
+
+#include <media/AudioRecord.h>
+#include <media/stagefright/MediaBufferGroup.h>
+#include <media/stagefright/MediaDebug.h>
+#include <media/stagefright/MediaDefs.h>
+#include <media/stagefright/MetaData.h>
+
+namespace android {
+
+AudioSource::AudioSource(
+ int inputSource, uint32_t sampleRate, uint32_t channels)
+ : mRecord(new AudioRecord(
+ inputSource, sampleRate, AudioSystem::PCM_16_BIT, channels)),
+ mInitCheck(mRecord->initCheck()),
+ mStarted(false),
+ mGroup(NULL) {
+}
+
+AudioSource::~AudioSource() {
+ if (mStarted) {
+ stop();
+ }
+
+ delete mRecord;
+ mRecord = NULL;
+}
+
+status_t AudioSource::initCheck() const {
+ return mInitCheck;
+}
+
+status_t AudioSource::start(MetaData *params) {
+ if (mStarted) {
+ return UNKNOWN_ERROR;
+ }
+
+ status_t err = mRecord->start();
+
+ if (err == OK) {
+ mGroup = new MediaBufferGroup;
+ mGroup->add_buffer(new MediaBuffer(kMaxBufferSize));
+
+ mStarted = true;
+ }
+
+ return err;
+}
+
+status_t AudioSource::stop() {
+ if (!mStarted) {
+ return UNKNOWN_ERROR;
+ }
+
+ mRecord->stop();
+
+ delete mGroup;
+ mGroup = NULL;
+
+ mStarted = false;
+
+ return OK;
+}
+
+sp<MetaData> AudioSource::getFormat() {
+ sp<MetaData> meta = new MetaData;
+ meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW);
+ meta->setInt32(kKeySampleRate, mRecord->getSampleRate());
+ meta->setInt32(kKeyChannelCount, mRecord->channelCount());
+ meta->setInt32(kKeyMaxInputSize, kMaxBufferSize);
+
+ return meta;
+}
+
+status_t AudioSource::read(
+ MediaBuffer **out, const ReadOptions *options) {
+ *out = NULL;
+
+ MediaBuffer *buffer;
+ CHECK_EQ(mGroup->acquire_buffer(&buffer), OK);
+
+ uint32_t numFramesRecorded;
+ mRecord->getPosition(&numFramesRecorded);
+
+ buffer->meta_data()->setInt64(
+ kKeyTime,
+ (1000000ll * numFramesRecorded) / mRecord->getSampleRate()
+ - mRecord->latency() * 1000);
+
+ ssize_t n = mRecord->read(buffer->data(), buffer->size());
+
+ if (n < 0) {
+ buffer->release();
+ buffer = NULL;
+
+ return (status_t)n;
+ }
+
+ buffer->set_range(0, n);
+
+ *out = buffer;
+
+ return OK;
+}
+
+} // namespace android
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index f6cd46a..42b9acc 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -19,6 +19,7 @@
#include <utils/Log.h>
#include "include/AwesomePlayer.h"
+#include "include/Prefetcher.h"
#include "include/SoftwareRenderer.h"
#include <binder/IPCThreadState.h>
@@ -118,6 +119,8 @@
mVideoEventPending = false;
mStreamDoneEvent = new AwesomeEvent(this, 1);
mStreamDoneEventPending = false;
+ mBufferingEvent = new AwesomeEvent(this, 2);
+ mBufferingEventPending = false;
mQueue.start();
@@ -132,11 +135,16 @@
mClient.disconnect();
}
-void AwesomePlayer::cancelPlayerEvents() {
+void AwesomePlayer::cancelPlayerEvents(bool keepBufferingGoing) {
mQueue.cancelEvent(mVideoEvent->eventID());
mVideoEventPending = false;
mQueue.cancelEvent(mStreamDoneEvent->eventID());
mStreamDoneEventPending = false;
+
+ if (!keepBufferingGoing) {
+ mQueue.cancelEvent(mBufferingEvent->eventID());
+ mBufferingEventPending = false;
+ }
}
void AwesomePlayer::setListener(const wp<MediaPlayerBase> &listener) {
@@ -149,12 +157,22 @@
reset_l();
- sp<MediaExtractor> extractor = MediaExtractor::CreateFromURI(uri);
+ sp<DataSource> dataSource = DataSource::CreateFromURI(uri);
+
+ if (dataSource == NULL) {
+ return UNKNOWN_ERROR;
+ }
+
+ sp<MediaExtractor> extractor = MediaExtractor::Create(dataSource);
if (extractor == NULL) {
return UNKNOWN_ERROR;
}
+ if (dataSource->flags() & DataSource::kWantsPrefetching) {
+ mPrefetcher = new Prefetcher;
+ }
+
return setDataSource_l(extractor);
}
@@ -182,8 +200,6 @@
}
status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) {
- reset_l();
-
bool haveAudio = false;
bool haveVideo = false;
for (size_t i = 0; i < extractor->countTracks(); ++i) {
@@ -253,6 +269,8 @@
mSeeking = false;
mSeekTimeUs = 0;
+
+ mPrefetcher.clear();
}
// static
@@ -278,16 +296,38 @@
}
}
-void AwesomePlayer::notifyListener_l(int msg) {
+void AwesomePlayer::notifyListener_l(int msg, int ext1) {
if (mListener != NULL) {
sp<MediaPlayerBase> listener = mListener.promote();
if (listener != NULL) {
- listener->sendEvent(msg);
+ listener->sendEvent(msg, ext1);
}
}
}
+void AwesomePlayer::onBufferingUpdate() {
+ Mutex::Autolock autoLock(mLock);
+ mBufferingEventPending = false;
+
+ if (mDurationUs >= 0) {
+ int64_t cachedDurationUs = mPrefetcher->getCachedDurationUs();
+ int64_t positionUs = 0;
+ if (mVideoRenderer != NULL) {
+ positionUs = mVideoTimeUs;
+ } else if (mAudioPlayer != NULL) {
+ positionUs = mAudioPlayer->getMediaTimeUs();
+ }
+
+ cachedDurationUs += positionUs;
+
+ double percentage = (double)cachedDurationUs / mDurationUs;
+ notifyListener_l(MEDIA_BUFFERING_UPDATE, percentage * 100.0);
+
+ postBufferingEvent_l();
+ }
+}
+
void AwesomePlayer::onStreamDone() {
// Posted whenever any stream finishes playing.
@@ -361,6 +401,8 @@
seekAudioIfNecessary_l();
}
+ postBufferingEvent_l();
+
return OK;
}
@@ -414,7 +456,7 @@
return OK;
}
- cancelPlayerEvents();
+ cancelPlayerEvents(true /* keepBufferingGoing */);
if (mAudioPlayer != NULL) {
mAudioPlayer->pause();
@@ -518,11 +560,15 @@
return OK;
}
-status_t AwesomePlayer::setAudioSource(const sp<MediaSource> &source) {
+status_t AwesomePlayer::setAudioSource(sp<MediaSource> source) {
if (source == NULL) {
return UNKNOWN_ERROR;
}
+ if (mPrefetcher != NULL) {
+ source = mPrefetcher->addSource(source);
+ }
+
sp<MetaData> meta = source->getFormat();
const char *mime;
@@ -549,11 +595,15 @@
return mAudioSource != NULL ? OK : UNKNOWN_ERROR;
}
-status_t AwesomePlayer::setVideoSource(const sp<MediaSource> &source) {
+status_t AwesomePlayer::setVideoSource(sp<MediaSource> source) {
if (source == NULL) {
return UNKNOWN_ERROR;
}
+ if (mPrefetcher != NULL) {
+ source = mPrefetcher->addSource(source);
+ }
+
mVideoSource = OMXCodec::Create(
mClient.interface(), source->getFormat(),
false, // createEncoder
@@ -580,9 +630,13 @@
if (code == 1) {
onStreamDone();
return;
+ } else if (code == 2) {
+ onBufferingUpdate();
+ return;
}
Mutex::Autolock autoLock(mLock);
+
mVideoEventPending = false;
if (mSeeking) {
@@ -718,5 +772,17 @@
mQueue.postEvent(mStreamDoneEvent);
}
+void AwesomePlayer::postBufferingEvent_l() {
+ if (mPrefetcher == NULL) {
+ return;
+ }
+
+ if (mBufferingEventPending) {
+ return;
+ }
+ mBufferingEventPending = true;
+ mQueue.postEventWithDelay(mBufferingEvent, 1000000ll);
+}
+
} // namespace android
diff --git a/media/libstagefright/CachingDataSource.cpp b/media/libstagefright/CachingDataSource.cpp
index 23f4897..8d04ead 100644
--- a/media/libstagefright/CachingDataSource.cpp
+++ b/media/libstagefright/CachingDataSource.cpp
@@ -65,6 +65,10 @@
return mSource->initCheck();
}
+uint32_t CachingDataSource::flags() {
+ return mSource->flags();
+}
+
ssize_t CachingDataSource::readAt(off_t offset, void *data, size_t size) {
Mutex::Autolock autoLock(mLock);
diff --git a/media/libstagefright/HTTPDataSource.cpp b/media/libstagefright/HTTPDataSource.cpp
index 7e8bbc6..cf189af 100644
--- a/media/libstagefright/HTTPDataSource.cpp
+++ b/media/libstagefright/HTTPDataSource.cpp
@@ -24,6 +24,8 @@
namespace android {
+static const char *kUserAgent = "stagefright-http";
+
// Given a connected HTTPStream, determine if the given path redirects
// somewhere else, if so, disconnect the stream, update host path and port
// accordingly and return true, otherwise return false and leave the stream
@@ -34,6 +36,9 @@
request.append("HEAD ");
request.append(path->c_str());
request.append(" HTTP/1.1\r\n");
+ request.append("User-Agent: ");
+ request.append(kUserAgent);
+ request.append("\r\n");
request.append("Host: ");
request.append(host->c_str());
request.append("\r\n\r\n");
@@ -78,6 +83,8 @@
CHECK(end > start && (*end == '\0'));
*port = (tmp >= 0 && tmp < 65536) ? (int)tmp : 80;
+
+ host->erase(colonPos, host->size() - colonPos);
} else {
*port = 80;
}
@@ -94,7 +101,8 @@
mPath(NULL),
mBuffer(malloc(kBufferSize)),
mBufferLength(0),
- mBufferOffset(0) {
+ mBufferOffset(0),
+ mFirstRequest(true) {
CHECK(!strncasecmp("http://", uri, 7));
string host;
@@ -123,10 +131,10 @@
host = string(host, 0, colon - host.c_str());
}
- LOGI("Connecting to host '%s', port %d, path '%s'",
- host.c_str(), port, path.c_str());
-
do {
+ LOGI("Connecting to host '%s', port %d, path '%s'",
+ host.c_str(), port, path.c_str());
+
mInitCheck = mHttp->connect(host.c_str(), port);
if (mInitCheck != OK) {
@@ -146,7 +154,8 @@
mPath(NULL),
mBuffer(malloc(kBufferSize)),
mBufferLength(0),
- mBufferOffset(0) {
+ mBufferOffset(0),
+ mFirstRequest(true) {
string host = _host;
string path = _path;
@@ -190,30 +199,19 @@
mHttp = NULL;
}
-ssize_t HTTPDataSource::readAt(off_t offset, void *data, size_t size) {
- if (offset >= mBufferOffset
- && offset < (off_t)(mBufferOffset + mBufferLength)) {
- size_t num_bytes_available = mBufferLength - (offset - mBufferOffset);
-
- size_t copy = num_bytes_available;
- if (copy > size) {
- copy = size;
- }
-
- memcpy(data, (const char *)mBuffer + (offset - mBufferOffset), copy);
-
- return copy;
- }
-
- mBufferOffset = offset;
- mBufferLength = 0;
+ssize_t HTTPDataSource::sendRangeRequest(size_t offset) {
+ char agent[128];
+ sprintf(agent, "User-Agent: %s\r\n", kUserAgent);
char host[128];
sprintf(host, "Host: %s\r\n", mHost);
char range[128];
- sprintf(range, "Range: bytes=%ld-%ld\r\n\r\n",
- mBufferOffset, mBufferOffset + kBufferSize - 1);
+ if (offset > 0) {
+ sprintf(range, "Range: bytes=%d-\r\n\r\n", offset);
+ } else {
+ range[0] = '\0';
+ }
int http_status;
@@ -223,6 +221,7 @@
if ((err = mHttp->send("GET ")) != OK
|| (err = mHttp->send(mPath)) != OK
|| (err = mHttp->send(" HTTP/1.1\r\n")) != OK
+ || (err = mHttp->send(agent)) != OK
|| (err = mHttp->send(host)) != OK
|| (err = mHttp->send(range)) != OK
|| (err = mHttp->send("\r\n")) != OK
@@ -245,18 +244,54 @@
string value;
if (!mHttp->find_header_value("Content-Length", &value)) {
- return UNKNOWN_ERROR;
+ return kBufferSize;
}
char *end;
unsigned long contentLength = strtoul(value.c_str(), &end, 10);
- ssize_t num_bytes_received = mHttp->receive(mBuffer, contentLength);
+ return contentLength;
+}
- if (num_bytes_received <= 0) {
- return num_bytes_received;
+ssize_t HTTPDataSource::readAt(off_t offset, void *data, size_t size) {
+ if (offset >= mBufferOffset
+ && offset < (off_t)(mBufferOffset + mBufferLength)) {
+ size_t num_bytes_available = mBufferLength - (offset - mBufferOffset);
+
+ size_t copy = num_bytes_available;
+ if (copy > size) {
+ copy = size;
+ }
+
+ memcpy(data, (const char *)mBuffer + (offset - mBufferOffset), copy);
+
+ return copy;
}
+ ssize_t contentLength = 0;
+ if (mFirstRequest || offset != mBufferOffset + mBufferLength) {
+ if (!mFirstRequest) {
+ mHttp->disconnect();
+ }
+ mFirstRequest = false;
+
+ contentLength = sendRangeRequest(offset);
+
+ if (contentLength > kBufferSize) {
+ contentLength = kBufferSize;
+ }
+ } else {
+ contentLength = kBufferSize;
+ }
+
+ mBufferOffset = offset;
+
+ if (contentLength <= 0) {
+ return contentLength;
+ }
+
+ ssize_t num_bytes_received = mHttp->receive(mBuffer, contentLength);
+
mBufferLength = (size_t)num_bytes_received;
size_t copy = mBufferLength;
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index 367459f..aee4d15 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -92,9 +92,11 @@
mTracks.clear();
}
-void MPEG4Writer::addSource(const sp<MediaSource> &source) {
+status_t MPEG4Writer::addSource(const sp<MediaSource> &source) {
Track *track = new Track(this, source);
mTracks.push_back(track);
+
+ return OK;
}
status_t MPEG4Writer::start() {
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 2686489..986dcb2 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -301,8 +301,8 @@
quirks |= kRequiresAllocateBufferOnOutputPorts;
}
if (!strncmp(componentName, "OMX.qcom.video.decoder.", 23)) {
- // XXX Required on P....on only.
quirks |= kRequiresAllocateBufferOnOutputPorts;
+ quirks |= kDefersOutputBufferAllocation;
}
if (!strncmp(componentName, "OMX.TI.", 7)) {
@@ -1237,8 +1237,15 @@
info.mMediaBuffer = NULL;
if (portIndex == kPortIndexOutput) {
- info.mMediaBuffer = new MediaBuffer(info.mData, info.mSize);
- info.mMediaBuffer->setObserver(this);
+ if (!(mOMXLivesLocally
+ && (mQuirks & kRequiresAllocateBufferOnOutputPorts)
+ && (mQuirks & kDefersOutputBufferAllocation))) {
+ // If the node does not fill in the buffer ptr at this time,
+ // we will defer creating the MediaBuffer until receiving
+ // the first FILL_BUFFER_DONE notification instead.
+ info.mMediaBuffer = new MediaBuffer(info.mData, info.mSize);
+ info.mMediaBuffer->setObserver(this);
+ }
}
mPortBuffers[portIndex].push(info);
@@ -1346,6 +1353,22 @@
} else if (mPortStatus[kPortIndexOutput] != SHUTTING_DOWN) {
CHECK_EQ(mPortStatus[kPortIndexOutput], ENABLED);
+ if (info->mMediaBuffer == NULL) {
+ CHECK(mOMXLivesLocally);
+ CHECK(mQuirks & kRequiresAllocateBufferOnOutputPorts);
+ CHECK(mQuirks & kDefersOutputBufferAllocation);
+
+ // The qcom video decoders on Nexus don't actually allocate
+ // output buffer memory on a call to OMX_AllocateBuffer
+ // the "pBuffer" member of the OMX_BUFFERHEADERTYPE
+ // structure is only filled in later.
+
+ info->mMediaBuffer = new MediaBuffer(
+ msg.u.extended_buffer_data.data_ptr,
+ info->mSize);
+ info->mMediaBuffer->setObserver(this);
+ }
+
MediaBuffer *buffer = info->mMediaBuffer;
buffer->set_range(
diff --git a/media/libstagefright/Prefetcher.cpp b/media/libstagefright/Prefetcher.cpp
new file mode 100644
index 0000000..862998a
--- /dev/null
+++ b/media/libstagefright/Prefetcher.cpp
@@ -0,0 +1,386 @@
+/*
+ * 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_TAG "Prefetcher"
+//#define LOG_NDEBUG 0
+#include <utils/Log.h>
+
+#include "include/Prefetcher.h"
+
+#include <media/stagefright/MediaBuffer.h>
+#include <media/stagefright/MediaDebug.h>
+#include <media/stagefright/MediaErrors.h>
+#include <media/stagefright/MediaSource.h>
+#include <media/stagefright/MetaData.h>
+#include <utils/List.h>
+
+namespace android {
+
+struct PrefetchedSource : public MediaSource {
+ PrefetchedSource(
+ const sp<Prefetcher> &prefetcher,
+ size_t index,
+ const sp<MediaSource> &source);
+
+ virtual status_t start(MetaData *params);
+ virtual status_t stop();
+
+ virtual status_t read(
+ MediaBuffer **buffer, const ReadOptions *options);
+
+ virtual sp<MetaData> getFormat();
+
+protected:
+ virtual ~PrefetchedSource();
+
+private:
+ friend struct Prefetcher;
+
+ Mutex mLock;
+ Condition mCondition;
+
+ sp<Prefetcher> mPrefetcher;
+ sp<MediaSource> mSource;
+ size_t mIndex;
+ bool mStarted;
+ bool mReachedEOS;
+ int64_t mSeekTimeUs;
+ int64_t mCacheDurationUs;
+
+ List<MediaBuffer *> mCachedBuffers;
+
+ // Returns true iff source is currently caching.
+ bool getCacheDurationUs(int64_t *durationUs);
+
+ void updateCacheDuration_l();
+ void clearCache_l();
+
+ void cacheMore();
+
+ PrefetchedSource(const PrefetchedSource &);
+ PrefetchedSource &operator=(const PrefetchedSource &);
+};
+
+Prefetcher::Prefetcher()
+ : mDone(false),
+ mThreadExited(false) {
+ startThread();
+}
+
+Prefetcher::~Prefetcher() {
+ stopThread();
+}
+
+sp<MediaSource> Prefetcher::addSource(const sp<MediaSource> &source) {
+ Mutex::Autolock autoLock(mLock);
+
+ sp<PrefetchedSource> psource =
+ new PrefetchedSource(this, mSources.size(), source);
+
+ mSources.add(psource);
+
+ return psource;
+}
+
+void Prefetcher::startThread() {
+ mThreadExited = false;
+ mDone = false;
+
+ int res = androidCreateThreadEtc(
+ ThreadWrapper, this, "Prefetcher",
+ ANDROID_PRIORITY_DEFAULT, 0, &mThread);
+
+ CHECK_EQ(res, 1);
+}
+
+void Prefetcher::stopThread() {
+ Mutex::Autolock autoLock(mLock);
+
+ while (!mThreadExited) {
+ mDone = true;
+ mCondition.signal();
+ mCondition.wait(mLock);
+ }
+}
+
+// static
+int Prefetcher::ThreadWrapper(void *me) {
+ static_cast<Prefetcher *>(me)->threadFunc();
+
+ return 0;
+}
+
+// Cache about 10secs for each source.
+static int64_t kMaxCacheDurationUs = 10000000ll;
+
+void Prefetcher::threadFunc() {
+ for (;;) {
+ Mutex::Autolock autoLock(mLock);
+ if (mDone) {
+ mThreadExited = true;
+ mCondition.signal();
+ break;
+ }
+ mCondition.waitRelative(mLock, 10000000ll);
+
+ int64_t minCacheDurationUs = -1;
+ ssize_t minIndex = -1;
+ for (size_t i = 0; i < mSources.size(); ++i) {
+ sp<PrefetchedSource> source = mSources[i].promote();
+
+ if (source == NULL) {
+ continue;
+ }
+
+ int64_t cacheDurationUs;
+ if (!source->getCacheDurationUs(&cacheDurationUs)) {
+ continue;
+ }
+
+ if (cacheDurationUs >= kMaxCacheDurationUs) {
+ continue;
+ }
+
+ if (minIndex < 0 || cacheDurationUs < minCacheDurationUs) {
+ minCacheDurationUs = cacheDurationUs;
+ minIndex = i;
+ }
+ }
+
+ if (minIndex < 0) {
+ continue;
+ }
+
+ sp<PrefetchedSource> source = mSources[minIndex].promote();
+ if (source != NULL) {
+ source->cacheMore();
+ }
+ }
+}
+
+int64_t Prefetcher::getCachedDurationUs() {
+ Mutex::Autolock autoLock(mLock);
+
+ int64_t minCacheDurationUs = -1;
+ ssize_t minIndex = -1;
+ for (size_t i = 0; i < mSources.size(); ++i) {
+ int64_t cacheDurationUs;
+ sp<PrefetchedSource> source = mSources[i].promote();
+ if (source == NULL) {
+ continue;
+ }
+
+ if (!source->getCacheDurationUs(&cacheDurationUs)) {
+ continue;
+ }
+
+ if (cacheDurationUs >= kMaxCacheDurationUs) {
+ continue;
+ }
+
+ if (minIndex < 0 || cacheDurationUs < minCacheDurationUs) {
+ minCacheDurationUs = cacheDurationUs;
+ minIndex = i;
+ }
+ }
+
+ return minCacheDurationUs < 0 ? 0 : minCacheDurationUs;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+PrefetchedSource::PrefetchedSource(
+ const sp<Prefetcher> &prefetcher,
+ size_t index,
+ const sp<MediaSource> &source)
+ : mPrefetcher(prefetcher),
+ mSource(source),
+ mIndex(index),
+ mStarted(false),
+ mReachedEOS(false),
+ mSeekTimeUs(0),
+ mCacheDurationUs(0) {
+}
+
+PrefetchedSource::~PrefetchedSource() {
+ if (mStarted) {
+ stop();
+ }
+}
+
+status_t PrefetchedSource::start(MetaData *params) {
+ Mutex::Autolock autoLock(mLock);
+
+ status_t err = mSource->start(params);
+
+ if (err != OK) {
+ return err;
+ }
+
+ mStarted = true;
+
+ for (;;) {
+ // Buffer 2 secs on startup.
+ if (mReachedEOS || mCacheDurationUs > 2000000) {
+ break;
+ }
+
+ mCondition.wait(mLock);
+ }
+
+ return OK;
+}
+
+status_t PrefetchedSource::stop() {
+ Mutex::Autolock autoLock(mLock);
+
+ clearCache_l();
+
+ status_t err = mSource->stop();
+
+ mStarted = false;
+
+ return err;
+}
+
+status_t PrefetchedSource::read(
+ MediaBuffer **out, const ReadOptions *options) {
+ *out = NULL;
+
+ Mutex::Autolock autoLock(mLock);
+
+ CHECK(mStarted);
+
+ int64_t seekTimeUs;
+ if (options && options->getSeekTo(&seekTimeUs)) {
+ CHECK(seekTimeUs >= 0);
+
+ clearCache_l();
+
+ mReachedEOS = false;
+ mSeekTimeUs = seekTimeUs;
+ }
+
+ while (!mReachedEOS && mCachedBuffers.empty()) {
+ mCondition.wait(mLock);
+ }
+
+ if (mCachedBuffers.empty()) {
+ return ERROR_END_OF_STREAM;
+ }
+
+ *out = *mCachedBuffers.begin();
+ mCachedBuffers.erase(mCachedBuffers.begin());
+ updateCacheDuration_l();
+
+ return OK;
+}
+
+sp<MetaData> PrefetchedSource::getFormat() {
+ return mSource->getFormat();
+}
+
+bool PrefetchedSource::getCacheDurationUs(int64_t *durationUs) {
+ Mutex::Autolock autoLock(mLock);
+
+ if (!mStarted || mReachedEOS) {
+ *durationUs = 0;
+
+ return false;
+ }
+
+ *durationUs = mCacheDurationUs;
+
+ return true;
+}
+
+void PrefetchedSource::cacheMore() {
+ MediaSource::ReadOptions options;
+
+ {
+ Mutex::Autolock autoLock(mLock);
+
+ if (!mStarted) {
+ return;
+ }
+
+ if (mSeekTimeUs >= 0) {
+ options.setSeekTo(mSeekTimeUs);
+ mSeekTimeUs = -1;
+ }
+ }
+
+ MediaBuffer *buffer;
+ status_t err = mSource->read(&buffer, &options);
+
+ Mutex::Autolock autoLock(mLock);
+
+ if (err != OK) {
+ mReachedEOS = true;
+ mCondition.signal();
+
+ return;
+ }
+
+ CHECK(buffer != NULL);
+
+ MediaBuffer *copy = new MediaBuffer(buffer->range_length());
+ memcpy(copy->data(),
+ (const uint8_t *)buffer->data() + buffer->range_offset(),
+ buffer->range_length());
+
+ sp<MetaData> from = buffer->meta_data();
+ sp<MetaData> to = copy->meta_data();
+
+ int64_t timeUs;
+ if (from->findInt64(kKeyTime, &timeUs)) {
+ to->setInt64(kKeyTime, timeUs);
+ }
+
+ buffer->release();
+ buffer = NULL;
+
+ mCachedBuffers.push_back(copy);
+ updateCacheDuration_l();
+ mCondition.signal();
+}
+
+void PrefetchedSource::updateCacheDuration_l() {
+ if (mCachedBuffers.size() < 2) {
+ mCacheDurationUs = 0;
+ } else {
+ int64_t firstTimeUs, lastTimeUs;
+ CHECK((*mCachedBuffers.begin())->meta_data()->findInt64(
+ kKeyTime, &firstTimeUs));
+ CHECK((*--mCachedBuffers.end())->meta_data()->findInt64(
+ kKeyTime, &lastTimeUs));
+
+ mCacheDurationUs = lastTimeUs - firstTimeUs;
+ }
+}
+
+void PrefetchedSource::clearCache_l() {
+ List<MediaBuffer *>::iterator it = mCachedBuffers.begin();
+ while (it != mCachedBuffers.end()) {
+ (*it)->release();
+
+ it = mCachedBuffers.erase(it);
+ }
+
+ updateCacheDuration_l();
+}
+
+} // namespace android
diff --git a/media/libstagefright/SampleIterator.cpp b/media/libstagefright/SampleIterator.cpp
index faad42ba..7155c61 100644
--- a/media/libstagefright/SampleIterator.cpp
+++ b/media/libstagefright/SampleIterator.cpp
@@ -54,6 +54,10 @@
status_t SampleIterator::seekTo(uint32_t sampleIndex) {
LOGV("seekTo(%d)", sampleIndex);
+ if (sampleIndex >= mTable->mNumSampleSizes) {
+ return ERROR_END_OF_STREAM;
+ }
+
if (mTable->mSampleToChunkOffset < 0
|| mTable->mChunkOffsetOffset < 0
|| mTable->mSampleSizeOffset < 0
diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp
index 313a9ed..dfba74f 100644
--- a/media/libstagefright/StagefrightMetadataRetriever.cpp
+++ b/media/libstagefright/StagefrightMetadataRetriever.cpp
@@ -276,8 +276,6 @@
}
const char *StagefrightMetadataRetriever::extractMetadata(int keyCode) {
- LOGV("extractMetadata %d", keyCode);
-
if (mExtractor == NULL) {
return NULL;
}
diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h
index b28a12c..c2e46c0 100644
--- a/media/libstagefright/include/AwesomePlayer.h
+++ b/media/libstagefright/include/AwesomePlayer.h
@@ -26,10 +26,11 @@
namespace android {
+struct AudioPlayer;
struct MediaBuffer;
struct MediaExtractor;
struct MediaSource;
-struct AudioPlayer;
+struct Prefetcher;
struct TimeSource;
struct AwesomeRenderer : public RefBase {
@@ -109,13 +110,18 @@
bool mVideoEventPending;
sp<TimedEventQueue::Event> mStreamDoneEvent;
bool mStreamDoneEventPending;
+ sp<TimedEventQueue::Event> mBufferingEvent;
+ bool mBufferingEventPending;
void postVideoEvent_l(int64_t delayUs = -1);
+ void postBufferingEvent_l();
void postStreamDoneEvent_l();
MediaBuffer *mLastVideoBuffer;
MediaBuffer *mVideoBuffer;
+ sp<Prefetcher> mPrefetcher;
+
status_t setDataSource_l(const sp<MediaExtractor> &extractor);
void reset_l();
status_t seekTo_l(int64_t timeUs);
@@ -123,17 +129,19 @@
void initRenderer_l();
void seekAudioIfNecessary_l();
- void cancelPlayerEvents();
+ void cancelPlayerEvents(bool keepBufferingGoing = false);
- status_t setAudioSource(const sp<MediaSource> &source);
- status_t setVideoSource(const sp<MediaSource> &source);
+ status_t setAudioSource(sp<MediaSource> source);
+ status_t setVideoSource(sp<MediaSource> source);
void onEvent(int32_t code);
static void AudioNotify(void *me, int what);
void onStreamDone();
- void notifyListener_l(int msg);
+ void notifyListener_l(int msg, int ext1 = 0);
+
+ void onBufferingUpdate();
AwesomePlayer(const AwesomePlayer &);
AwesomePlayer &operator=(const AwesomePlayer &);
diff --git a/media/libstagefright/include/Prefetcher.h b/media/libstagefright/include/Prefetcher.h
new file mode 100644
index 0000000..7a97785
--- /dev/null
+++ b/media/libstagefright/include/Prefetcher.h
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+#ifndef PREFETCHER_H_
+
+#define PREFETCHER_H_
+
+#include <utils/RefBase.h>
+#include <utils/Vector.h>
+#include <utils/threads.h>
+
+namespace android {
+
+struct MediaSource;
+struct PrefetchedSource;
+
+struct Prefetcher : public RefBase {
+ Prefetcher();
+
+ // Given an existing MediaSource returns a new MediaSource
+ // that will benefit from prefetching/caching the original one.
+ sp<MediaSource> addSource(const sp<MediaSource> &source);
+
+ int64_t getCachedDurationUs();
+
+protected:
+ virtual ~Prefetcher();
+
+private:
+ Mutex mLock;
+ Condition mCondition;
+
+ Vector<wp<PrefetchedSource> > mSources;
+ android_thread_id_t mThread;
+ bool mDone;
+ bool mThreadExited;
+
+ void startThread();
+ void stopThread();
+
+ static int ThreadWrapper(void *me);
+ void threadFunc();
+
+ Prefetcher(const Prefetcher &);
+ Prefetcher &operator=(const Prefetcher &);
+};
+
+} // namespace android
+
+#endif // PREFETCHER_H_
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp
index 918d055c..9ca060d 100644
--- a/media/libstagefright/omx/OMX.cpp
+++ b/media/libstagefright/omx/OMX.cpp
@@ -365,6 +365,7 @@
msg.u.extended_buffer_data.flags = pBuffer->nFlags;
msg.u.extended_buffer_data.timestamp = pBuffer->nTimeStamp;
msg.u.extended_buffer_data.platform_private = pBuffer->pPlatformPrivate;
+ msg.u.extended_buffer_data.data_ptr = pBuffer->pBuffer;
mDispatcher->post(msg);
diff --git a/media/sdutils/sdutil.cpp b/media/sdutils/sdutil.cpp
index 322f743..a61cccb 100644
--- a/media/sdutils/sdutil.cpp
+++ b/media/sdutils/sdutil.cpp
@@ -134,6 +134,12 @@
gMountService->unmountSecureContainer(sId);
}
+static void asec_rename(const char *oldId, const char *newId) {
+ String16 sOldId(oldId);
+ String16 sNewId(newId);
+ gMountService->renameSecureContainer(sOldId, sNewId);
+}
+
static int asec_path(const char *id) {
String16 sId(id);
gMountService->getSecureContainerPath(sId);
@@ -212,7 +218,13 @@
} else if (!strcmp(argument, "destroy")) {
return android::asec_destroy(id);
} else if (!strcmp(argument, "mount")) {
- return android::asec_mount(id, argv[4], atoi(argv[5]));
+ if (argc == 6)
+ return android::asec_mount(id, argv[4], atoi(argv[5]));
+ } else if (!strcmp(argument, "rename")) {
+ if (argc == 5) {
+ android::asec_rename(id, argv[4]);
+ return 0;
+ }
} else if (!strcmp(argument, "unmount")) {
android::asec_unmount(id);
return 0;
@@ -233,6 +245,7 @@
" sdutil asec destroy <id>\n"
" sdutil asec mount <id> <key> <ownerUid>\n"
" sdutil asec unmount <id>\n"
+ " sdutil asec rename <oldId, newId>\n"
" sdutil asec path <id>\n"
);
return -1;
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java
index 5127255..6087268 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java
@@ -274,6 +274,7 @@
//video thumbnail
public static final String THUMBNAIL_OUTPUT = "/sdcard/media_api/videoThumbnail.png";
public static final String GOLDEN_THUMBNAIL_OUTPUT = "/sdcard/media_api/goldenThumbnail.png";
+ public static final String GOLDEN_THUMBNAIL_OUTPUT_2 = "/sdcard/media_api/goldenThumbnail2.png";
//Metadata Utility
public static final String[] THUMBNAIL_CAPTURE_TEST_FILES = {
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
index 4e30f91..ee6067ab 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
@@ -420,7 +420,7 @@
@LargeTest
public void testGetThumbnail() throws Exception {
- boolean getThumbnail = CodecTest.getThumbnail(MediaNames.VIDEO_H264_AAC, MediaNames.GOLDEN_THUMBNAIL_OUTPUT);
+ boolean getThumbnail = CodecTest.getThumbnail(MediaNames.VIDEO_H264_AAC, MediaNames.GOLDEN_THUMBNAIL_OUTPUT_2);
assertTrue("Get Thumbnail", getThumbnail);
}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
index 4cdc06d..88e171d 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
@@ -255,13 +255,19 @@
}
//Write the ps output to the file
- public void getMemoryWriteToLog(Writer output) {
+ public void getMemoryWriteToLog(Writer output, int writeCount) {
String memusage = null;
- memusage = captureMediaserverInfo();
- Log.v(TAG, memusage);
try {
- //Write to file output
+ if (writeCount == 0) {
+ mStartMemory = getMediaserverVsize();
+ output.write("Start memory : " + mStartMemory + "\n");
+ }
+ memusage = captureMediaserverInfo();
output.write(memusage);
+ if (writeCount == NUM_STRESS_LOOP - 1) {
+ mEndMemory = getMediaserverVsize();
+ output.write("End Memory :" + mEndMemory + "\n");
+ }
} catch (Exception e) {
e.toString();
}
@@ -312,9 +318,6 @@
//Wait for 10 seconds to make sure the memory settle.
Thread.sleep(10000);
mEndPid = getMediaserverPid();
- mEndMemory = getMediaserverVsize();
- Log.v(TAG, "End Memory " + mEndMemory);
- output.write("End Memory :" + mEndMemory + "\n");
int memDiff = mEndMemory - startMemory;
if (memDiff < 0)
memDiff = 0;
@@ -348,12 +351,9 @@
File h263MemoryOut = new File(MEDIA_MEMORY_OUTPUT);
Writer output = new BufferedWriter(new FileWriter(h263MemoryOut, true));
output.write("H263 Video Playback Only\n");
- mStartMemory = getMediaserverVsize();
- output.write("Start memory : " + mStartMemory + "\n");
- Log.v(TAG, "first mem : " + mStartMemory);
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
mediaStressPlayback(MediaNames.VIDEO_HIGHRES_H263);
- getMemoryWriteToLog(output);
+ getMemoryWriteToLog(output, i);
}
output.write("\n");
memoryResult = validateMemoryResult(mStartPid, mStartMemory, output);
@@ -370,12 +370,9 @@
File h264MemoryOut = new File(MEDIA_MEMORY_OUTPUT);
Writer output = new BufferedWriter(new FileWriter(h264MemoryOut, true));
output.write("H264 Video Playback only\n");
- mStartMemory = getMediaserverVsize();
- output.write("Start memory : " + mStartMemory + "\n");
- Log.v(TAG, "first mem : " + mStartMemory);
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
mediaStressPlayback(MediaNames.VIDEO_H264_AMR);
- getMemoryWriteToLog(output);
+ getMemoryWriteToLog(output, i);
}
output.write("\n");
memoryResult = validateMemoryResult(mStartPid, mStartMemory, output);
@@ -392,12 +389,9 @@
File wmvMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
Writer output = new BufferedWriter(new FileWriter(wmvMemoryOut, true));
output.write("WMV video playback only\n");
- mStartMemory = getMediaserverVsize();
- output.write("Start memory : " + mStartMemory + "\n");
- Log.v(TAG, "first mem : " + mStartMemory);
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
mediaStressPlayback(MediaNames.VIDEO_WMV);
- getMemoryWriteToLog(output);
+ getMemoryWriteToLog(output, i);
}
output.write("\n");
memoryResult = validateMemoryResult(mStartPid, mStartMemory, output);
@@ -415,14 +409,10 @@
File videoH263RecordOnlyMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
Writer output = new BufferedWriter(new FileWriter(videoH263RecordOnlyMemoryOut, true));
output.write("H263 video record only\n");
- mStartMemory = getMediaserverVsize();
- output.write("Start memory : " + mStartMemory + "\n");
- Log.v(TAG, "first mem : " + mStartMemory);
-
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
stressVideoRecord(20, 352, 288, MediaRecorder.VideoEncoder.H263,
MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_VIDEO_3GP, true);
- getMemoryWriteToLog(output);
+ getMemoryWriteToLog(output, i);
}
output.write("\n");
memoryResult = validateMemoryResult(mStartPid, mStartMemory, output);
@@ -439,14 +429,10 @@
File videoMp4RecordOnlyMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
Writer output = new BufferedWriter(new FileWriter(videoMp4RecordOnlyMemoryOut, true));
output.write("MPEG4 video record only\n");
- mStartMemory = getMediaserverVsize();
- output.write("Start memory : " + mStartMemory + "\n");
- Log.v(TAG, "first mem : " + mStartMemory);
-
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
stressVideoRecord(20, 352, 288, MediaRecorder.VideoEncoder.MPEG_4_SP,
MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_VIDEO_3GP, true);
- getMemoryWriteToLog(output);
+ getMemoryWriteToLog(output, i);
}
output.write("\n");
memoryResult = validateMemoryResult(mStartPid, mStartMemory, output);
@@ -464,14 +450,10 @@
File videoRecordAudioMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
Writer output = new BufferedWriter(new FileWriter(videoRecordAudioMemoryOut, true));
output.write("Audio and h263 video record\n");
- mStartMemory = getMediaserverVsize();
- output.write("Start memory : " + mStartMemory + "\n");
- Log.v(TAG, "first mem : " + mStartMemory);
-
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
stressVideoRecord(20, 352, 288, MediaRecorder.VideoEncoder.H263,
MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_VIDEO_3GP, false);
- getMemoryWriteToLog(output);
+ getMemoryWriteToLog(output, i);
}
output.write("\n");
memoryResult = validateMemoryResult(mStartPid, mStartMemory, output);
@@ -488,13 +470,9 @@
File audioOnlyMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
Writer output = new BufferedWriter(new FileWriter(audioOnlyMemoryOut, true));
output.write("Audio record only\n");
- mStartMemory = getMediaserverVsize();
- output.write("Start memory : " + mStartMemory + "\n");
- Log.v(TAG, "first mem : " + mStartMemory);
-
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
stressAudioRecord(MediaNames.RECORDER_OUTPUT);
- getMemoryWriteToLog(output);
+ getMemoryWriteToLog(output, i);
}
output.write("\n");
memoryResult = validateMemoryResult(mStartPid, mStartMemory, output);
diff --git a/opengl/libagl/texture.cpp b/opengl/libagl/texture.cpp
index 13d078e..2875c13 100644
--- a/opengl/libagl/texture.cpp
+++ b/opengl/libagl/texture.cpp
@@ -583,7 +583,7 @@
static __attribute__((noinline))
-void set_depth_and_fog(ogles_context_t* c, GLint z)
+void set_depth_and_fog(ogles_context_t* c, GGLfixed z)
{
const uint32_t enables = c->rasterizer.state.enables;
// we need to compute Zw
@@ -592,8 +592,8 @@
GGLfixed Zw;
GGLfixed n = gglFloatToFixed(c->transforms.vpt.zNear);
GGLfixed f = gglFloatToFixed(c->transforms.vpt.zFar);
- if (z<=0) Zw = n;
- else if (z>=1) Zw = f;
+ if (z<=0) Zw = n;
+ else if (z>=0x10000) Zw = f;
else Zw = gglMulAddx(z, (f-n), n);
if (enables & GGL_ENABLE_FOG) {
// set up fog if needed...
@@ -836,7 +836,7 @@
c->rasterizer.procs.texCoord2i(c, s0, t0);
const uint32_t enables = c->rasterizer.state.enables;
if (ggl_unlikely(enables & (GGL_ENABLE_DEPTH_TEST|GGL_ENABLE_FOG)))
- set_depth_and_fog(c, z);
+ set_depth_and_fog(c, gglIntToFixed(z));
c->rasterizer.procs.color4xv(c, c->currentColorClamped.v);
c->rasterizer.procs.disable(c, GGL_W_LERP);
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index c22c21b..d2f8ced 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -1111,10 +1111,10 @@
if (cur_c == NULL) {
// no current context
if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) {
- // calling eglMakeCurrent( ..., EGL_NO_CONTEXT, !=0, !=0);
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+ // calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT);
+ return setError(EGL_BAD_MATCH, EGL_FALSE);
}
- // not an error, there is just not current context.
+ // not an error, there is just no current context.
return EGL_TRUE;
}
}
diff --git a/packages/DefaultContainerService/Android.mk b/packages/DefaultContainerService/Android.mk
new file mode 100755
index 0000000..2f1d6ab
--- /dev/null
+++ b/packages/DefaultContainerService/Android.mk
@@ -0,0 +1,12 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := DefaultContainerService
+
+LOCAL_CERTIFICATE := platform
+
+include $(BUILD_PACKAGE)
diff --git a/packages/DefaultContainerService/AndroidManifest.xml b/packages/DefaultContainerService/AndroidManifest.xml
new file mode 100755
index 0000000..3d72017
--- /dev/null
+++ b/packages/DefaultContainerService/AndroidManifest.xml
@@ -0,0 +1,18 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.defcontainer">
+ <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/>
+ <uses-permission android:name="android.permission.ASEC_ACCESS"/>
+ <uses-permission android:name="android.permission.ASEC_CREATE"/>
+ <uses-permission android:name="android.permission.ASEC_DESTROY"/>
+ <uses-permission android:name="android.permission.ASEC_MOUNT_UNMOUNT"/>
+
+ <application android:process="def.container.service"
+ android:label="@string/service_name">
+
+ <service android:name=".DefaultContainerService"
+ android:enabled="true"
+ android:exported="true"
+ android:permission="android.permission.COPY_PROTECTED_DATA"/>
+ </application>
+
+</manifest>
diff --git a/packages/DefaultContainerService/res/values/strings.xml b/packages/DefaultContainerService/res/values/strings.xml
new file mode 100644
index 0000000..2897f34
--- /dev/null
+++ b/packages/DefaultContainerService/res/values/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 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.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- service name -->
+ <string name="service_name">Media Container Service</string>
+</resources>
diff --git a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
new file mode 100644
index 0000000..d36207b
--- /dev/null
+++ b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
@@ -0,0 +1,305 @@
+package com.android.defcontainer;
+
+import com.android.internal.app.IMediaContainerService;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Debug;
+import android.os.IBinder;
+import android.os.IMountService;
+import android.os.ParcelFileDescriptor;
+import android.os.Process;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.app.Service;
+import android.util.Log;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import android.os.FileUtils;
+
+
+/*
+ * This service copies a downloaded apk to a file passed in as
+ * a ParcelFileDescriptor or to a newly created container specified
+ * by parameters. The DownloadManager gives access to this process
+ * based on its uid. This process also needs the ACCESS_DOWNLOAD_MANAGER
+ * permission to access apks downloaded via the download manager.
+ */
+public class DefaultContainerService extends Service {
+ private static final String TAG = "DefContainer";
+ private static final boolean localLOGV = false;
+
+ private IMediaContainerService.Stub mBinder = new IMediaContainerService.Stub() {
+ /*
+ * Creates a new container and copies resource there.
+ * @param paackageURI the uri of resource to be copied. Can be either
+ * a content uri or a file uri
+ * @param containerId the id of the secure container that should
+ * be used for creating a secure container into which the resource
+ * will be copied.
+ * @param key Refers to key used for encrypting the secure container
+ * @param resFileName Name of the target resource file(relative to newly
+ * created secure container)
+ * @return Returns the new cache path where the resource has been copied into
+ *
+ */
+ public String copyResourceToContainer(final Uri packageURI,
+ final String containerId,
+ final String key, final String resFileName) {
+ if (packageURI == null || containerId == null) {
+ return null;
+ }
+ return copyResourceInner(packageURI, containerId, key, resFileName);
+ }
+
+ /*
+ * Copy specified resource to output stream
+ * @param packageURI the uri of resource to be copied. Should be a
+ * file uri
+ * @param outStream Remote file descriptor to be used for copying
+ * @return Returns true if copy succeded or false otherwise.
+ */
+ public boolean copyResource(final Uri packageURI,
+ ParcelFileDescriptor outStream) {
+ if (packageURI == null || outStream == null) {
+ return false;
+ }
+ ParcelFileDescriptor.AutoCloseOutputStream
+ autoOut = new ParcelFileDescriptor.AutoCloseOutputStream(outStream);
+ return copyFile(packageURI, autoOut);
+ }
+ };
+
+ public IBinder onBind(Intent intent) {
+ return mBinder;
+ }
+
+ private IMountService getMountService() {
+ return IMountService.Stub.asInterface(ServiceManager.getService("mount"));
+ }
+
+ private String copyResourceInner(Uri packageURI, String newCacheId, String key, String resFileName) {
+ // Create new container at newCachePath
+ String codePath = packageURI.getPath();
+ String newCachePath = null;
+ final int CREATE_FAILED = 1;
+ final int COPY_FAILED = 2;
+ final int FINALIZE_FAILED = 3;
+ final int PASS = 4;
+ int errCode = CREATE_FAILED;
+ // Create new container
+ if ((newCachePath = createSdDir(packageURI, newCacheId, key)) != null) {
+ File resFile = new File(newCachePath, resFileName);
+ errCode = COPY_FAILED;
+ if (localLOGV) Log.i(TAG, "Trying to copy " + codePath + " to " + resFile);
+ // Copy file from codePath
+ if (FileUtils.copyFile(new File(codePath), resFile)) {
+ errCode = FINALIZE_FAILED;
+ if (finalizeSdDir(newCacheId)) {
+ errCode = PASS;
+ }
+ }
+ }
+ // Print error based on errCode
+ String errMsg = "";
+ switch (errCode) {
+ case CREATE_FAILED:
+ errMsg = "CREATE_FAILED";
+ break;
+ case COPY_FAILED:
+ errMsg = "COPY_FAILED";
+ destroySdDir(newCacheId);
+ break;
+ case FINALIZE_FAILED:
+ errMsg = "FINALIZE_FAILED";
+ destroySdDir(newCacheId);
+ break;
+ default:
+ errMsg = "PASS";
+ unMountSdDir(newCacheId);
+ break;
+ }
+ Log.i(TAG, "Status: " + errMsg);
+ if (errCode != PASS) {
+ return null;
+ }
+ return newCachePath;
+ }
+
+ private String createSdDir(final Uri packageURI,
+ String containerId, String sdEncKey) {
+ File tmpPackageFile = new File(packageURI.getPath());
+ // Create mount point via MountService
+ IMountService mountService = getMountService();
+ long len = tmpPackageFile.length();
+ int mbLen = (int) (len/(1024*1024));
+ if ((len - (mbLen * 1024 * 1024)) > 0) {
+ mbLen++;
+ }
+ if (localLOGV) Log.i(TAG, "mbLen="+mbLen);
+ String cachePath = null;
+ int ownerUid = Process.myUid();
+ try {
+ cachePath = mountService.createSecureContainer(containerId,
+ mbLen,
+ "vfat", sdEncKey, ownerUid);
+ if (localLOGV) Log.i(TAG, "Trying to create secure container for "
+ + containerId + ", cachePath =" + cachePath);
+ return cachePath;
+ } catch(IllegalStateException e) {
+ Log.e(TAG, "Failed to create storage on sdcard with exception: " + e);
+ } catch(RemoteException e) {
+ Log.e(TAG, "MounteService not running?");
+ return null;
+ }
+ // TODO just fail here and let the user delete later on.
+ try {
+ mountService.destroySecureContainer(containerId);
+ if (localLOGV) Log.i(TAG, "Destroying cache for " + containerId
+ + ", cachePath =" + cachePath);
+ } catch(IllegalStateException e) {
+ Log.e(TAG, "Failed to destroy existing cache: " + e);
+ return null;
+ } catch(RemoteException e) {
+ Log.e(TAG, "MounteService not running?");
+ return null;
+ }
+ try {
+ cachePath = mountService.createSecureContainer(containerId,
+ mbLen,
+ "vfat", sdEncKey, ownerUid);
+ if (localLOGV) Log.i(TAG, "Trying to install again " + containerId
+ + ", cachePath =" + cachePath);
+ return cachePath;
+ } catch(IllegalStateException e) {
+ Log.e(TAG, "Failed to create storage on sdcard with exception: " + e);
+ } catch(RemoteException e) {
+ Log.e(TAG, "MounteService not running?");
+ }
+ return null;
+ }
+
+ private boolean destroySdDir(String containerId) {
+ try {
+ // We need to destroy right away
+ getMountService().destroySecureContainer(containerId);
+ return true;
+ } catch (IllegalStateException e) {
+ Log.i(TAG, "Failed to destroy container : " + containerId);
+ } catch(RemoteException e) {
+ Log.e(TAG, "MounteService not running?");
+ }
+ return false;
+ }
+
+ private boolean finalizeSdDir(String containerId){
+ try {
+ getMountService().finalizeSecureContainer(containerId);
+ return true;
+ } catch (IllegalStateException e) {
+ Log.i(TAG, "Failed to finalize container for pkg : " + containerId);
+ } catch(RemoteException e) {
+ Log.e(TAG, "MounteService not running?");
+ }
+ return false;
+ }
+
+ private boolean unMountSdDir(String containerId) {
+ try {
+ getMountService().unmountSecureContainer(containerId);
+ return true;
+ } catch (IllegalStateException e) {
+ Log.e(TAG, "Failed to unmount id: " + containerId + " with exception " + e);
+ } catch(RemoteException e) {
+ Log.e(TAG, "MounteService not running?");
+ }
+ return false;
+ }
+
+ private String mountSdDir(String containerId, String key) {
+ try {
+ return getMountService().mountSecureContainer(containerId, key, Process.myUid());
+ } catch (IllegalStateException e) {
+ Log.e(TAG, "Failed to mount id: " +
+ containerId + " with exception " + e);
+ } catch(RemoteException e) {
+ Log.e(TAG, "MounteService not running?");
+ }
+ return null;
+ }
+
+ public static boolean copyToFile(InputStream inputStream, FileOutputStream out) {
+ try {
+ byte[] buffer = new byte[4096];
+ int bytesRead;
+ while ((bytesRead = inputStream.read(buffer)) >= 0) {
+ out.write(buffer, 0, bytesRead);
+ }
+ return true;
+ } catch (IOException e) {
+ Log.i(TAG, "Exception : " + e + " when copying file");
+ return false;
+ }
+ }
+
+ public static boolean copyToFile(File srcFile, FileOutputStream out) {
+ InputStream inputStream = null;
+ try {
+ inputStream = new FileInputStream(srcFile);
+ return copyToFile(inputStream, out);
+ } catch (IOException e) {
+ return false;
+ } finally {
+ try { if (inputStream != null) inputStream.close(); } catch (IOException e) {}
+ }
+ }
+
+ private boolean copyFile(Uri pPackageURI, FileOutputStream outStream) {
+ if (pPackageURI.getScheme().equals("file")) {
+ final File srcPackageFile = new File(pPackageURI.getPath());
+ // We copy the source package file to a temp file and then rename it to the
+ // destination file in order to eliminate a window where the package directory
+ // scanner notices the new package file but it's not completely copied yet.
+ if (!copyToFile(srcPackageFile, outStream)) {
+ Log.e(TAG, "Couldn't copy file: " + srcPackageFile);
+ return false;
+ }
+ } else if (pPackageURI.getScheme().equals("content")) {
+ ParcelFileDescriptor fd = null;
+ try {
+ fd = getContentResolver().openFileDescriptor(pPackageURI, "r");
+ } catch (FileNotFoundException e) {
+ Log.e(TAG, "Couldn't open file descriptor from download service. Failed with exception " + e);
+ return false;
+ }
+ if (fd == null) {
+ Log.e(TAG, "Couldn't open file descriptor from download service (null).");
+ return false;
+ } else {
+ if (localLOGV) {
+ Log.v(TAG, "Opened file descriptor from download service.");
+ }
+ ParcelFileDescriptor.AutoCloseInputStream
+ dlStream = new ParcelFileDescriptor.AutoCloseInputStream(fd);
+ // We copy the source package file to a temp file and then rename it to the
+ // destination file in order to eliminate a window where the package directory
+ // scanner notices the new package file but it's not completely copied yet.
+ if (!copyToFile(dlStream, outStream)) {
+ Log.e(TAG, "Couldn't copy " + pPackageURI + " to temp file.");
+ return false;
+ }
+ }
+ } else {
+ Log.e(TAG, "Package URI is not 'file:' or 'content:' - " + pPackageURI);
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/preloaded-classes b/preloaded-classes
index 90bbb37..d108883 100644
--- a/preloaded-classes
+++ b/preloaded-classes
@@ -694,9 +694,7 @@
com.ibm.icu4jni.charset.CharsetEncoderICU
com.ibm.icu4jni.charset.CharsetICU
com.ibm.icu4jni.text.CollationAttribute
-com.ibm.icu4jni.text.DecimalFormat
-com.ibm.icu4jni.text.DecimalFormatSymbols
-com.ibm.icu4jni.text.NativeDecimalFormat$UNumberFormatAttribute
+com.ibm.icu4jni.text.NativeDecimalFormat
com.ibm.icu4jni.text.RuleBasedCollator
com.ibm.icu4jni.util.Resources$DefaultTimeZones
dalvik.system.DexFile
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 2e45512..72e26f8 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -161,7 +161,7 @@
= new HashMap<String,IBackupTransport>();
String mCurrentTransport;
IBackupTransport mLocalTransport, mGoogleTransport;
- RestoreSession mActiveRestoreSession;
+ ActiveRestoreSession mActiveRestoreSession;
class RestoreParams {
public IBackupTransport transport;
@@ -2068,20 +2068,20 @@
Log.d(TAG, "Restore session requested but one already active");
return null;
}
- mActiveRestoreSession = new RestoreSession(transport);
+ mActiveRestoreSession = new ActiveRestoreSession(transport);
}
return mActiveRestoreSession;
}
// ----- Restore session -----
- class RestoreSession extends IRestoreSession.Stub {
+ class ActiveRestoreSession extends IRestoreSession.Stub {
private static final String TAG = "RestoreSession";
private IBackupTransport mRestoreTransport = null;
RestoreSet[] mRestoreSets = null;
- RestoreSession(String transport) {
+ ActiveRestoreSession(String transport) {
mRestoreTransport = getTransport(transport);
}
diff --git a/services/java/com/android/server/BootReceiver.java b/services/java/com/android/server/BootReceiver.java
index debbbb4..1dbd0ae 100644
--- a/services/java/com/android/server/BootReceiver.java
+++ b/services/java/com/android/server/BootReceiver.java
@@ -20,8 +20,10 @@
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.os.Build;
import android.os.DropBoxManager;
+import android.os.FileObserver;
import android.os.FileUtils;
import android.os.RecoverySystem;
import android.os.SystemProperties;
@@ -38,10 +40,14 @@
public class BootReceiver extends BroadcastReceiver {
private static final String TAG = "BootReceiver";
- // Negative meaning capture the *last* 64K of the file
- // (passed to FileUtils.readTextFile)
+ // Negative to read the *last* 64K of the file (per FileUtils.readTextFile)
private static final int LOG_SIZE = -65536;
+ private static final File TOMBSTONE_DIR = new File("/data/tombstones");
+
+ // Keep a reference to the observer so the finalizer doesn't disable it.
+ private static FileObserver sTombstoneObserver = null;
+
@Override
public void onReceive(Context context, Intent intent) {
try {
@@ -68,51 +74,71 @@
}
}
- private void logBootEvents(Context context) throws IOException {
- DropBoxManager db = (DropBoxManager) context.getSystemService(Context.DROPBOX_SERVICE);
+ private void logBootEvents(Context ctx) throws IOException {
+ final DropBoxManager db = (DropBoxManager) ctx.getSystemService(Context.DROPBOX_SERVICE);
+ final SharedPreferences prefs = ctx.getSharedPreferences("log_files", Context.MODE_PRIVATE);
+ final String props = new StringBuilder()
+ .append("Build: ").append(Build.FINGERPRINT).append("\n")
+ .append("Hardware: ").append(Build.BOARD).append("\n")
+ .append("Bootloader: ").append(Build.BOOTLOADER).append("\n")
+ .append("Radio: ").append(Build.RADIO).append("\n")
+ .append("Kernel: ")
+ .append(FileUtils.readTextFile(new File("/proc/version"), 1024, "...\n"))
+ .toString();
- StringBuilder props = new StringBuilder();
- props.append("Build: ").append(Build.FINGERPRINT).append("\n");
- props.append("Hardware: ").append(Build.BOARD).append("\n");
- props.append("Bootloader: ").append(Build.BOOTLOADER).append("\n");
- props.append("Radio: ").append(Build.RADIO).append("\n");
- props.append("Kernel: ");
- props.append(FileUtils.readTextFile(new File("/proc/version"), 1024, "...\n"));
+ if (db == null || prefs == null) return;
if (SystemProperties.getLong("ro.runtime.firstboot", 0) == 0) {
String now = Long.toString(System.currentTimeMillis());
SystemProperties.set("ro.runtime.firstboot", now);
- if (db != null) db.addText("SYSTEM_BOOT", props.toString());
+ db.addText("SYSTEM_BOOT", props);
+ addFileToDropBox(db, prefs, props, "/proc/last_kmsg", "SYSTEM_LAST_KMSG");
+ addFileToDropBox(db, prefs, props, "/cache/recovery/log", "SYSTEM_RECOVERY_LOG");
+ addFileToDropBox(db, prefs, props, "/data/dontpanic/apanic_console", "APANIC_CONSOLE");
+ addFileToDropBox(db, prefs, props, "/data/dontpanic/apanic_threads", "APANIC_THREADS");
} else {
- if (db != null) db.addText("SYSTEM_RESTART", props.toString());
- return; // Subsequent boot, don't log kernel boot log
+ db.addText("SYSTEM_RESTART", props);
}
- ContentResolver cr = context.getContentResolver();
- logBootFile(cr, db, "/cache/recovery/log", "SYSTEM_RECOVERY_LOG");
- logBootFile(cr, db, "/proc/last_kmsg", "SYSTEM_LAST_KMSG");
- logBootFile(cr, db, "/data/dontpanic/apanic_console", "APANIC_CONSOLE");
- logBootFile(cr, db, "/data/dontpanic/apanic_threads", "APANIC_THREADS");
+ // Scan existing tombstones (in case any new ones appeared)
+ File[] tombstoneFiles = TOMBSTONE_DIR.listFiles();
+ for (int i = 0; tombstoneFiles != null && i < tombstoneFiles.length; i++) {
+ addFileToDropBox(db, prefs, props, tombstoneFiles[i].getPath(), "SYSTEM_TOMBSTONE");
+ }
+
+ // Start watching for new tombstone files; will record them as they occur.
+ // This gets registered with the singleton file observer thread.
+ sTombstoneObserver = new FileObserver(TOMBSTONE_DIR.getPath(), FileObserver.CLOSE_WRITE) {
+ @Override
+ public void onEvent(int event, String path) {
+ try {
+ String filename = new File(TOMBSTONE_DIR, path).getPath();
+ addFileToDropBox(db, prefs, props, filename, "SYSTEM_TOMBSTONE");
+ } catch (IOException e) {
+ Log.e(TAG, "Can't log tombstone", e);
+ }
+ }
+ };
+
+ sTombstoneObserver.startWatching();
}
- private void logBootFile(ContentResolver cr, DropBoxManager db, String filename, String tag)
- throws IOException {
- if (cr == null || db == null || !db.isTagEnabled(tag)) return; // Logging disabled
+ private static void addFileToDropBox(
+ DropBoxManager db, SharedPreferences prefs,
+ String headers, String filename, String tag) throws IOException {
+ if (!db.isTagEnabled(tag)) return; // Logging disabled
File file = new File(filename);
long fileTime = file.lastModified();
if (fileTime <= 0) return; // File does not exist
- String setting = "logfile:" + filename;
- long lastTime = Settings.Secure.getLong(cr, setting, 0);
+ long lastTime = prefs.getLong(filename, 0);
if (lastTime == fileTime) return; // Already logged this particular file
- Settings.Secure.putLong(cr, setting, fileTime);
+ prefs.edit().putLong(filename, fileTime).commit();
- StringBuilder report = new StringBuilder();
- report.append("Build: ").append(Build.FINGERPRINT).append("\n");
- report.append("Kernel: ");
- report.append(FileUtils.readTextFile(new File("/proc/version"), 1024, "...\n"));
- report.append(FileUtils.readTextFile(new File(filename), LOG_SIZE, "[[TRUNCATED]]\n"));
+ StringBuilder report = new StringBuilder(headers).append("\n");
+ report.append(FileUtils.readTextFile(file, LOG_SIZE, "[[TRUNCATED]]\n"));
db.addText(tag, report.toString());
+ Log.i(TAG, "Logging " + filename + " to DropBox (" + tag + ")");
}
}
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 5a8d35f..4417d7b 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -828,6 +828,28 @@
info.getExtraInfo());
}
+ NetworkStateTracker newNet = tryFailover(prevNetType);
+ if (newNet != null) {
+ NetworkInfo switchTo = newNet.getNetworkInfo();
+ intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
+ } else {
+ intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
+ }
+ // do this before we broadcast the change
+ handleConnectivityChange();
+
+ sendStickyBroadcast(intent);
+ /*
+ * If the failover network is already connected, then immediately send
+ * out a followup broadcast indicating successful failover
+ */
+ if (newNet != null && newNet.getNetworkInfo().isConnected()) {
+ sendConnectedBroadcast(newNet.getNetworkInfo());
+ }
+ }
+
+ // returns -1 if no failover available
+ private NetworkStateTracker tryFailover(int prevNetType) {
/*
* If this is a default network, check if other defaults are available
* or active
@@ -840,8 +862,7 @@
int newType = -1;
int newPriority = -1;
- for (int checkType=0; checkType <=
- ConnectivityManager.MAX_NETWORK_TYPE; checkType++) {
+ for (int checkType=0; checkType <= ConnectivityManager.MAX_NETWORK_TYPE; checkType++) {
if (checkType == prevNetType) continue;
if (mNetAttributes[checkType] == null) continue;
if (mNetAttributes[checkType].isDefault()) {
@@ -884,29 +905,13 @@
switchTo.getTypeName());
}
}
- intent.putExtra(ConnectivityManager.
- EXTRA_OTHER_NETWORK_INFO, switchTo);
} else {
- intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY,
- true);
newNet.reconnect();
}
- } else {
- intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY,
- true);
}
}
- // do this before we broadcast the change
- handleConnectivityChange();
-
- sendStickyBroadcast(intent);
- /*
- * If the failover network is already connected, then immediately send
- * out a followup broadcast indicating successful failover
- */
- if (newNet != null && newNet.getNetworkInfo().isConnected())
- sendConnectedBroadcast(newNet.getNetworkInfo());
+ return newNet;
}
private void sendConnectedBroadcast(NetworkInfo info) {
@@ -964,7 +969,25 @@
intent.putExtra(ConnectivityManager.EXTRA_IS_FAILOVER, true);
info.setFailover(false);
}
+
+ NetworkStateTracker newNet = tryFailover(info.getType());
+ if (newNet != null) {
+ NetworkInfo switchTo = newNet.getNetworkInfo();
+ intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
+ } else {
+ intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
+ }
+ // do this before we broadcast the change
+ handleConnectivityChange();
+
sendStickyBroadcast(intent);
+ /*
+ * If the failover network is already connected, then immediately send
+ * out a followup broadcast indicating successful failover
+ */
+ if (newNet != null && newNet.getNetworkInfo().isConnected()) {
+ sendConnectedBroadcast(newNet.getNetworkInfo());
+ }
}
private void sendStickyBroadcast(Intent intent) {
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/DevicePolicyManagerService.java
index 36da4eb..7b8645f 100644
--- a/services/java/com/android/server/DevicePolicyManagerService.java
+++ b/services/java/com/android/server/DevicePolicyManagerService.java
@@ -23,10 +23,12 @@
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
+import android.app.Activity;
import android.app.DeviceAdmin;
import android.app.DeviceAdminInfo;
import android.app.DevicePolicyManager;
import android.app.IDevicePolicyManager;
+import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -36,6 +38,7 @@
import android.os.IBinder;
import android.os.IPowerManager;
import android.os.RecoverySystem;
+import android.os.RemoteCallback;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
@@ -45,6 +48,8 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
/**
@@ -61,19 +66,74 @@
int mActivePasswordLength = 0;
int mFailedPasswordAttempts = 0;
- ActiveAdmin mActiveAdmin;
+ final HashMap<ComponentName, ActiveAdmin> mAdminMap
+ = new HashMap<ComponentName, ActiveAdmin>();
+ final ArrayList<ActiveAdmin> mAdminList
+ = new ArrayList<ActiveAdmin>();
static class ActiveAdmin {
- ActiveAdmin(DeviceAdminInfo _info) {
- info = _info;
- }
-
final DeviceAdminInfo info;
- int getUid() { return info.getActivityInfo().applicationInfo.uid; }
int passwordMode = DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED;
int minimumPasswordLength = 0;
long maximumTimeToUnlock = 0;
+ int maximumFailedPasswordsForWipe = 0;
+
+ ActiveAdmin(DeviceAdminInfo _info) {
+ info = _info;
+ }
+
+ int getUid() { return info.getActivityInfo().applicationInfo.uid; }
+
+ 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 (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) {
+ out.startTag(null, "max-time-to-unlock");
+ out.attribute(null, "value", Long.toString(maximumTimeToUnlock));
+ out.endTag(null, "max-time-to-unlock");
+ }
+ if (maximumFailedPasswordsForWipe != 0) {
+ out.startTag(null, "max-failed-password-wipe");
+ out.attribute(null, "value", Integer.toString(maximumFailedPasswordsForWipe));
+ out.endTag(null, "max-failed-password-wipe");
+ }
+ }
+
+ void readFromXml(XmlPullParser parser)
+ throws XmlPullParserException, IOException {
+ int outerDepth = parser.getDepth();
+ int type;
+ while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
+ if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
+ continue;
+ }
+ String tag = parser.getName();
+ if ("password-mode".equals(tag)) {
+ passwordMode = Integer.parseInt(
+ parser.getAttributeValue(null, "value"));
+ } else if ("min-password-length".equals(tag)) {
+ minimumPasswordLength = Integer.parseInt(
+ parser.getAttributeValue(null, "value"));
+ } else if ("max-time-to-unlock".equals(tag)) {
+ maximumTimeToUnlock = Long.parseLong(
+ parser.getAttributeValue(null, "value"));
+ } else if ("max-failed-password-wipe".equals(tag)) {
+ maximumFailedPasswordsForWipe = Integer.parseInt(
+ parser.getAttributeValue(null, "value"));
+ }
+ }
+ }
}
/**
@@ -91,46 +151,68 @@
return mIPowerManager;
}
- ActiveAdmin getActiveAdminForCallerLocked(ComponentName who) throws SecurityException {
- if (mActiveAdmin != null && mActiveAdmin.getUid() == Binder.getCallingUid()) {
- if (who != null) {
- if (!who.getPackageName().equals(mActiveAdmin.info.getActivityInfo().packageName)
- || !who.getClassName().equals(mActiveAdmin.info.getActivityInfo().name)) {
- throw new SecurityException("Current admin is not " + who);
- }
- }
- return mActiveAdmin;
- }
- throw new SecurityException("Current admin is not owned by uid " + Binder.getCallingUid());
- }
-
-
- void sendAdminCommandLocked(ActiveAdmin policy, String action) {
- Intent intent = new Intent(action);
- intent.setComponent(policy.info.getComponent());
- mContext.sendBroadcast(intent);
- }
-
- void sendAdminCommandLocked(String action) {
- if (mActiveAdmin != null) {
- sendAdminCommandLocked(mActiveAdmin, action);
- }
- }
-
- ComponentName getActiveAdminLocked() {
- if (mActiveAdmin != null) {
- return mActiveAdmin.info.getComponent();
+ ActiveAdmin getActiveAdminUncheckedLocked(ComponentName who) {
+ ActiveAdmin admin = mAdminMap.get(who);
+ if (admin != null
+ && who.getPackageName().equals(admin.info.getActivityInfo().packageName)
+ && who.getClassName().equals(admin.info.getActivityInfo().name)) {
+ return admin;
}
return null;
}
+ ActiveAdmin getActiveAdminForCallerLocked(ComponentName who)
+ throws SecurityException {
+ ActiveAdmin admin = mAdminMap.get(who);
+ if (admin != null && admin.getUid() == Binder.getCallingUid()) {
+ if (who != null) {
+ if (!who.getPackageName().equals(admin.info.getActivityInfo().packageName)
+ || !who.getClassName().equals(admin.info.getActivityInfo().name)) {
+ throw new SecurityException("Current admin is not " + who);
+ }
+ }
+ return admin;
+ }
+ throw new SecurityException("Current admin is not owned by uid " + Binder.getCallingUid());
+ }
+
+ ActiveAdmin getActiveAdminForCallerLocked(ComponentName who, int reqPolicy)
+ throws SecurityException {
+ ActiveAdmin admin = getActiveAdminForCallerLocked(who);
+ if (!admin.info.usesPolicy(reqPolicy)) {
+ throw new SecurityException("Admin " + admin.info.getComponent()
+ + " did not specify uses-policy for: "
+ + admin.info.getTagForPolicy(reqPolicy));
+ }
+ return admin;
+ }
+
+ void sendAdminCommandLocked(ActiveAdmin admin, String action) {
+ Intent intent = new Intent(action);
+ intent.setComponent(admin.info.getComponent());
+ mContext.sendBroadcast(intent);
+ }
+
+ void sendAdminCommandLocked(String action, int reqPolicy) {
+ final int N = mAdminList.size();
+ if (N > 0) {
+ for (int i=0; i<N; i++) {
+ ActiveAdmin admin = mAdminList.get(i);
+ if (admin.info.usesPolicy(reqPolicy)) {
+ sendAdminCommandLocked(admin, action);
+ }
+ }
+ }
+ }
+
void removeActiveAdminLocked(ComponentName adminReceiver) {
- ComponentName cur = getActiveAdminLocked();
- if (cur != null && cur.equals(adminReceiver)) {
- sendAdminCommandLocked(mActiveAdmin,
+ ActiveAdmin admin = getActiveAdminUncheckedLocked(adminReceiver);
+ if (admin != null) {
+ sendAdminCommandLocked(admin,
DeviceAdmin.ACTION_DEVICE_ADMIN_DISABLED);
// XXX need to wait for it to complete.
- mActiveAdmin = null;
+ mAdminList.remove(admin);
+ mAdminMap.remove(adminReceiver);
}
}
@@ -170,29 +252,25 @@
out.startTag(null, "policies");
- ActiveAdmin ap = mActiveAdmin;
- if (ap != null) {
- out.startTag(null, "admin");
- out.attribute(null, "name", ap.info.getComponent().flattenToString());
- if (ap.passwordMode != DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED) {
- out.startTag(null, "password-mode");
- out.attribute(null, "value", Integer.toString(ap.passwordMode));
- out.endTag(null, "password-mode");
- if (ap.minimumPasswordLength > 0) {
- out.startTag(null, "min-password-length");
- out.attribute(null, "value", Integer.toString(ap.minimumPasswordLength));
- out.endTag(null, "mn-password-length");
- }
+ final int N = mAdminList.size();
+ for (int i=0; i<N; i++) {
+ ActiveAdmin ap = mAdminList.get(i);
+ if (ap != null) {
+ out.startTag(null, "admin");
+ out.attribute(null, "name", ap.info.getComponent().flattenToString());
+ ap.writeToXml(out);
+ out.endTag(null, "admin");
}
- if (ap.maximumTimeToUnlock != DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED) {
- out.startTag(null, "max-time-to-unlock");
- out.attribute(null, "value", Long.toString(ap.maximumTimeToUnlock));
- out.endTag(null, "max-time-to-unlock");
- }
- out.endTag(null, "admin");
}
+
out.endTag(null, "policies");
+ if (mFailedPasswordAttempts != 0) {
+ out.startTag(null, "failed-password-attempts");
+ out.attribute(null, "value", Integer.toString(mFailedPasswordAttempts));
+ out.endTag(null, "failed-password-attempts");
+ }
+
out.endDocument();
stream.close();
journal.commit();
@@ -212,51 +290,42 @@
JournaledFile journal = makeJournaledFile();
FileInputStream stream = null;
File file = journal.chooseForRead();
- boolean success = false;
try {
stream = new FileInputStream(file);
XmlPullParser parser = Xml.newPullParser();
parser.setInput(stream, null);
- int type = parser.next();
- while (type != XmlPullParser.START_TAG) {
- type = parser.next();
+ int type;
+ while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
+ && type != XmlPullParser.START_TAG) {
}
String tag = parser.getName();
- if ("policies".equals(tag)) {
- ActiveAdmin ap = null;
- do {
- type = parser.next();
- if (type == XmlPullParser.START_TAG) {
- tag = parser.getName();
- if (ap == null) {
- if ("admin".equals(tag)) {
- DeviceAdminInfo dai = findAdmin(
- ComponentName.unflattenFromString(
- parser.getAttributeValue(null, "name")));
- if (dai != null) {
- ap = new ActiveAdmin(dai);
- }
- }
- } else if ("password-mode".equals(tag)) {
- ap.passwordMode = Integer.parseInt(
- parser.getAttributeValue(null, "value"));
- } else if ("min-password-length".equals(tag)) {
- ap.minimumPasswordLength = Integer.parseInt(
- parser.getAttributeValue(null, "value"));
- } else if ("max-time-to-unlock".equals(tag)) {
- ap.maximumTimeToUnlock = Long.parseLong(
- parser.getAttributeValue(null, "value"));
- }
- } else if (type == XmlPullParser.END_TAG) {
- tag = parser.getName();
- if (ap != null && "admin".equals(tag)) {
- mActiveAdmin = ap;
- ap = null;
- }
+ if (!"policies".equals(tag)) {
+ throw new XmlPullParserException(
+ "Settings do not start with policies tag: found " + tag);
+ }
+ type = parser.next();
+ int outerDepth = parser.getDepth();
+ while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
+ if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
+ continue;
+ }
+ tag = parser.getName();
+ if ("admin".equals(tag)) {
+ DeviceAdminInfo dai = findAdmin(
+ ComponentName.unflattenFromString(
+ parser.getAttributeValue(null, "name")));
+ if (dai != null) {
+ ActiveAdmin ap = new ActiveAdmin(dai);
+ ap.readFromXml(parser);
+ mAdminMap.put(ap.info.getComponent(), ap);
+ mAdminList.add(ap);
}
- } while (type != XmlPullParser.END_DOCUMENT);
- success = true;
+ } else if ("failed-password-attempts".equals(tag)) {
+ mFailedPasswordAttempts = Integer.parseInt(
+ parser.getAttributeValue(null, "value"));
+ }
}
} catch (NullPointerException e) {
Log.w(TAG, "failed parsing " + file + " " + e);
@@ -277,10 +346,6 @@
// Ignore
}
- if (!success) {
- Log.w(TAG, "No valid start tag found in policies file");
- }
-
long timeMs = getMaximumTimeToLock();
if (timeMs <= 0) {
timeMs = Integer.MAX_VALUE;
@@ -310,16 +375,14 @@
synchronized (this) {
long ident = Binder.clearCallingIdentity();
try {
- ComponentName cur = getActiveAdminLocked();
- if (cur != null && cur.equals(adminReceiver)) {
- throw new IllegalStateException("An admin is already set");
+ if (getActiveAdminUncheckedLocked(adminReceiver) != null) {
+ throw new IllegalArgumentException("Admin is already added");
}
- if (cur != null) {
- removeActiveAdminLocked(adminReceiver);
- }
- mActiveAdmin = new ActiveAdmin(info);
+ ActiveAdmin admin = new ActiveAdmin(info);
+ mAdminMap.put(adminReceiver, admin);
+ mAdminList.add(admin);
saveSettingsLocked();
- sendAdminCommandLocked(mActiveAdmin,
+ sendAdminCommandLocked(admin,
DeviceAdmin.ACTION_DEVICE_ADMIN_ENABLED);
} finally {
Binder.restoreCallingIdentity(ident);
@@ -327,15 +390,33 @@
}
}
- public ComponentName getActiveAdmin() {
+ public boolean isAdminActive(ComponentName adminReceiver) {
synchronized (this) {
- return getActiveAdminLocked();
+ return getActiveAdminUncheckedLocked(adminReceiver) != null;
+ }
+ }
+
+ public List<ComponentName> getActiveAdmins() {
+ synchronized (this) {
+ final int N = mAdminList.size();
+ if (N <= 0) {
+ return null;
+ }
+ ArrayList<ComponentName> res = new ArrayList<ComponentName>(N);
+ for (int i=0; i<N; i++) {
+ res.add(mAdminList.get(i).info.getComponent());
+ }
+ return res;
}
}
public void removeActiveAdmin(ComponentName adminReceiver) {
synchronized (this) {
- if (mActiveAdmin == null || mActiveAdmin.getUid() != Binder.getCallingUid()) {
+ ActiveAdmin admin = getActiveAdminUncheckedLocked(adminReceiver);
+ if (admin == null) {
+ return;
+ }
+ if (admin.getUid() != Binder.getCallingUid()) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.BIND_DEVICE_ADMIN, null);
}
@@ -353,7 +434,8 @@
if (who == null) {
throw new NullPointerException("ComponentName is null");
}
- ActiveAdmin ap = getActiveAdminForCallerLocked(who);
+ ActiveAdmin ap = getActiveAdminForCallerLocked(who,
+ DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD);
if (ap.passwordMode != mode) {
ap.passwordMode = mode;
saveSettingsLocked();
@@ -363,8 +445,15 @@
public int getPasswordMode() {
synchronized (this) {
- return mActiveAdmin != null ? mActiveAdmin.passwordMode
- : DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED;
+ final int N = mAdminList.size();
+ int mode = DevicePolicyManager.PASSWORD_MODE_UNSPECIFIED;
+ for (int i=0; i<N; i++) {
+ ActiveAdmin admin = mAdminList.get(i);
+ if (mode < admin.passwordMode) {
+ mode = admin.passwordMode;
+ }
+ }
+ return mode;
}
}
@@ -373,7 +462,8 @@
if (who == null) {
throw new NullPointerException("ComponentName is null");
}
- ActiveAdmin ap = getActiveAdminForCallerLocked(who);
+ ActiveAdmin ap = getActiveAdminForCallerLocked(who,
+ DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD);
if (ap.minimumPasswordLength != length) {
ap.minimumPasswordLength = length;
saveSettingsLocked();
@@ -383,7 +473,15 @@
public int getMinimumPasswordLength() {
synchronized (this) {
- return mActiveAdmin != null ? mActiveAdmin.minimumPasswordLength : 0;
+ final int N = mAdminList.size();
+ int length = 0;
+ for (int i=0; i<N; i++) {
+ ActiveAdmin admin = mAdminList.get(i);
+ if (length < admin.minimumPasswordLength) {
+ length = admin.minimumPasswordLength;
+ }
+ }
+ return length;
}
}
@@ -391,7 +489,8 @@
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);
+ getActiveAdminForCallerLocked(null,
+ DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD);
return mActivePasswordMode >= getPasswordMode()
&& mActivePasswordLength >= getMinimumPasswordLength();
}
@@ -401,17 +500,51 @@
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);
+ getActiveAdminForCallerLocked(null,
+ DeviceAdminInfo.USES_POLICY_WATCH_LOGIN);
return mFailedPasswordAttempts;
}
}
+ public void setMaximumFailedPasswordsForWipe(ComponentName who, int num) {
+ 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(who,
+ DeviceAdminInfo.USES_POLICY_WIPE_DATA);
+ ActiveAdmin ap = getActiveAdminForCallerLocked(who,
+ DeviceAdminInfo.USES_POLICY_WATCH_LOGIN);
+ if (ap.maximumFailedPasswordsForWipe != num) {
+ ap.maximumFailedPasswordsForWipe = num;
+ saveSettingsLocked();
+ }
+ }
+ }
+
+ public int getMaximumFailedPasswordsForWipe() {
+ synchronized (this) {
+ final int N = mAdminList.size();
+ int count = 0;
+ for (int i=0; i<N; i++) {
+ ActiveAdmin admin = mAdminList.get(i);
+ if (count == 0) {
+ count = admin.maximumFailedPasswordsForWipe;
+ } else if (admin.maximumFailedPasswordsForWipe != 0
+ && count > admin.maximumFailedPasswordsForWipe) {
+ count = admin.maximumFailedPasswordsForWipe;
+ }
+ }
+ return count;
+ }
+ }
+
public boolean resetPassword(String password) {
int mode;
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);
+ getActiveAdminForCallerLocked(null,
+ DeviceAdminInfo.USES_POLICY_RESET_PASSWORD);
mode = getPasswordMode();
if (password.length() < getMinimumPasswordLength()) {
return false;
@@ -436,7 +569,8 @@
if (who == null) {
throw new NullPointerException("ComponentName is null");
}
- ActiveAdmin ap = getActiveAdminForCallerLocked(who);
+ ActiveAdmin ap = getActiveAdminForCallerLocked(who,
+ DeviceAdminInfo.USES_POLICY_LIMIT_UNLOCK);
if (ap.maximumTimeToUnlock != timeMs) {
ap.maximumTimeToUnlock = timeMs;
@@ -460,7 +594,18 @@
public long getMaximumTimeToLock() {
synchronized (this) {
- return mActiveAdmin != null ? mActiveAdmin.maximumTimeToUnlock : 0;
+ final int N = mAdminList.size();
+ long time = 0;
+ for (int i=0; i<N; i++) {
+ ActiveAdmin admin = mAdminList.get(i);
+ if (time == 0) {
+ time = admin.maximumTimeToUnlock;
+ } else if (admin.maximumTimeToUnlock != 0
+ && time > admin.maximumTimeToUnlock) {
+ time = admin.maximumTimeToUnlock;
+ }
+ }
+ return time;
}
}
@@ -468,24 +613,59 @@
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);
+ getActiveAdminForCallerLocked(null,
+ DeviceAdminInfo.USES_POLICY_FORCE_LOCK);
// STOPSHIP need to implement.
}
}
+ void wipeDataLocked(int flags) {
+ try {
+ RecoverySystem.rebootWipeUserData(mContext);
+ } catch (IOException e) {
+ Log.w(TAG, "Failed requesting data wipe", e);
+ }
+ }
+
public void wipeData(int flags) {
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);
+ getActiveAdminForCallerLocked(null,
+ DeviceAdminInfo.USES_POLICY_WIPE_DATA);
+ long ident = Binder.clearCallingIdentity();
+ try {
+ wipeDataLocked(flags);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
}
- long ident = Binder.clearCallingIdentity();
- try {
- RecoverySystem.rebootWipeUserData(mContext);
- } catch (IOException e) {
- Log.w(TAG, "Failed requesting data wipe", e);
- } finally {
- Binder.restoreCallingIdentity(ident);
+ }
+
+ public void getRemoveWarning(ComponentName comp, final RemoteCallback result) {
+ mContext.enforceCallingOrSelfPermission(
+ android.Manifest.permission.BIND_DEVICE_ADMIN, null);
+
+ synchronized (this) {
+ ActiveAdmin admin = getActiveAdminUncheckedLocked(comp);
+ if (admin == null) {
+ try {
+ result.sendResult(null);
+ } catch (RemoteException e) {
+ }
+ return;
+ }
+ Intent intent = new Intent(DeviceAdmin.ACTION_DEVICE_ADMIN_DISABLE_REQUESTED);
+ intent.setComponent(admin.info.getComponent());
+ mContext.sendOrderedBroadcast(intent, null, new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ try {
+ result.sendResult(getResultExtras(false));
+ } catch (RemoteException e) {
+ }
+ }
+ }, null, Activity.RESULT_OK, null, null);
}
}
@@ -500,8 +680,12 @@
try {
mActivePasswordMode = mode;
mActivePasswordLength = length;
- mFailedPasswordAttempts = 0;
- sendAdminCommandLocked(DeviceAdmin.ACTION_PASSWORD_CHANGED);
+ if (mFailedPasswordAttempts != 0) {
+ mFailedPasswordAttempts = 0;
+ saveSettingsLocked();
+ }
+ sendAdminCommandLocked(DeviceAdmin.ACTION_PASSWORD_CHANGED,
+ DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD);
} finally {
Binder.restoreCallingIdentity(ident);
}
@@ -517,7 +701,13 @@
long ident = Binder.clearCallingIdentity();
try {
mFailedPasswordAttempts++;
- sendAdminCommandLocked(DeviceAdmin.ACTION_PASSWORD_FAILED);
+ saveSettingsLocked();
+ int max = getMaximumFailedPasswordsForWipe();
+ if (max > 0 && mFailedPasswordAttempts >= max) {
+ wipeDataLocked(0);
+ }
+ sendAdminCommandLocked(DeviceAdmin.ACTION_PASSWORD_FAILED,
+ DeviceAdminInfo.USES_POLICY_WATCH_LOGIN);
} finally {
Binder.restoreCallingIdentity(ident);
}
@@ -533,7 +723,9 @@
long ident = Binder.clearCallingIdentity();
try {
mFailedPasswordAttempts = 0;
- sendAdminCommandLocked(DeviceAdmin.ACTION_PASSWORD_SUCCEEDED);
+ saveSettingsLocked();
+ sendAdminCommandLocked(DeviceAdmin.ACTION_PASSWORD_SUCCEEDED,
+ DeviceAdminInfo.USES_POLICY_WATCH_LOGIN);
} finally {
Binder.restoreCallingIdentity(ident);
}
diff --git a/services/java/com/android/server/Installer.java b/services/java/com/android/server/Installer.java
index 6a7d432..88b1f02 100644
--- a/services/java/com/android/server/Installer.java
+++ b/services/java/com/android/server/Installer.java
@@ -263,10 +263,15 @@
return execute(builder.toString());
}
- public int setForwardLockPerm(String packageName, int gid) {
+ /*
+ * @param packagePathSuffix The name of the path relative to install
+ * directory. Say if the path name is /data/app/com.test-1.apk,
+ * the package suffix path will be com.test-1
+ */
+ public int setForwardLockPerm(String packagePathSuffix, int gid) {
StringBuilder builder = new StringBuilder("protect");
builder.append(' ');
- builder.append(packageName);
+ builder.append(packagePathSuffix);
builder.append(' ');
builder.append(gid);
return execute(builder.toString());
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 0cee31d..0b7cfae 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -526,21 +526,55 @@
* Callback from NativeDaemonConnector
*/
public void onDaemonConnected() {
+ /*
+ * Since we'll be calling back into the NativeDaemonConnector,
+ * we need to do our work in a new thread.
+ */
new Thread() {
public void run() {
+ /**
+ * Determine media state and UMS detection status
+ */
+ String path = Environment.getExternalStorageDirectory().getPath();
+ String state = Environment.MEDIA_REMOVED;
+
try {
- if (!getVolumeState(Environment.getExternalStorageDirectory().getPath())
- .equals(Environment.MEDIA_MOUNTED)) {
- try {
- mountVolume(Environment.getExternalStorageDirectory().getPath());
- } catch (Exception ex) {
- Log.w(TAG, "Connection-mount failed");
+ String[] vols = mConnector.doListCommand(
+ "list_volumes", VoldResponseCode.VolumeListResult);
+ for (String volstr : vols) {
+ String[] tok = volstr.split(" ");
+ // FMT: <label> <mountpoint> <state>
+ if (!tok[1].equals(path)) {
+ Log.w(TAG, String.format(
+ "Skipping unknown volume '%s'",tok[1]));
+ continue;
}
- } else {
- Log.d(TAG, "Skipping connection-mount; already mounted");
+ int st = Integer.parseInt(tok[2]);
+ if (st == VolumeState.NoMedia) {
+ state = Environment.MEDIA_REMOVED;
+ } else if (st == VolumeState.Idle) {
+ state = null;
+ try {
+ mountVolume(path);
+ } catch (Exception ex) {
+ Log.e(TAG, "Connection-mount failed", ex);
+ }
+ } else if (st == VolumeState.Mounted) {
+ state = Environment.MEDIA_MOUNTED;
+ Log.i(TAG, "Media already mounted on daemon connection");
+ } else if (st == VolumeState.Shared) {
+ state = Environment.MEDIA_SHARED;
+ Log.i(TAG, "Media shared on daemon connection");
+ } else {
+ throw new Exception(String.format("Unexpected state %d", st));
+ }
}
- } catch (IllegalStateException rex) {
- Log.e(TAG, "Exception while handling connection mount ", rex);
+ if (state != null) {
+ updatePublicVolumeState(path, state);
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "Error processing initial volume state", e);
+ updatePublicVolumeState(path, Environment.MEDIA_REMOVED);
}
try {
@@ -1024,11 +1058,21 @@
}
public String[] getSecureContainerList() throws IllegalStateException {
+ if (mContext.checkCallingOrSelfPermission(
+ android.Manifest.permission.ASEC_ACCESS)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Requires ASEC_ACCESS permission");
+ }
return mConnector.doListCommand("list_asec", VoldResponseCode.AsecListResult);
}
public String createSecureContainer(String id, int sizeMb, String fstype,
String key, int ownerUid) throws IllegalStateException {
+ if (mContext.checkCallingOrSelfPermission(
+ android.Manifest.permission.ASEC_CREATE)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Requires ASEC_CREATE permission");
+ }
String cmd = String.format("create_asec %s %d %s %s %d",
id, sizeMb, fstype, key, ownerUid);
mConnector.doCommand(cmd);
@@ -1036,15 +1080,31 @@
}
public void finalizeSecureContainer(String id) throws IllegalStateException {
+ if (mContext.checkCallingOrSelfPermission(
+ android.Manifest.permission.ASEC_CREATE)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Requires ASEC_CREATE permission");
+ }
mConnector.doCommand(String.format("finalize_asec %s", id));
}
public void destroySecureContainer(String id) throws IllegalStateException {
+ if (mContext.checkCallingOrSelfPermission(
+ android.Manifest.permission.ASEC_DESTROY)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Requires ASEC_DESTROY permission");
+ }
mConnector.doCommand(String.format("destroy_asec %s", id));
}
public String mountSecureContainer(String id, String key,
int ownerUid) throws IllegalStateException {
+ if (mContext.checkCallingOrSelfPermission(
+ android.Manifest.permission.ASEC_MOUNT_UNMOUNT)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Requires ASEC_MOUNT_UNMOUNT permission");
+ }
+ mConnector.doCommand(String.format("destroy_asec %s", id));
String cmd = String.format("mount_asec %s %s %d",
id, key, ownerUid);
mConnector.doCommand(cmd);
@@ -1052,11 +1112,31 @@
}
public void unmountSecureContainer(String id) throws IllegalStateException {
+ if (mContext.checkCallingOrSelfPermission(
+ android.Manifest.permission.ASEC_MOUNT_UNMOUNT)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Requires ASEC_MOUNT_UNMOUNT permission");
+ }
String cmd = String.format("unmount_asec %s", id);
mConnector.doCommand(cmd);
}
+ public void renameSecureContainer(String oldId, String newId) throws IllegalStateException {
+ if (mContext.checkCallingOrSelfPermission(
+ android.Manifest.permission.ASEC_RENAME)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Requires ASEC_RENAME permission");
+ }
+ String cmd = String.format("rename_asec %s %s", oldId, newId);
+ mConnector.doCommand(cmd);
+ }
+
public String getSecureContainerPath(String id) throws IllegalStateException {
+ if (mContext.checkCallingOrSelfPermission(
+ android.Manifest.permission.ASEC_ACCESS)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Requires ASEC_ACCESS permission");
+ }
ArrayList<String> rsp = mConnector.doCommand("asec_path " + id);
for (String line : rsp) {
diff --git a/services/java/com/android/server/NativeDaemonConnector.java b/services/java/com/android/server/NativeDaemonConnector.java
index 98e00dc..92ba5f8 100644
--- a/services/java/com/android/server/NativeDaemonConnector.java
+++ b/services/java/com/android/server/NativeDaemonConnector.java
@@ -255,11 +255,7 @@
String[] tok = line.split(" ");
int code = Integer.parseInt(tok[0]);
if (code == expectedResponseCode) {
- if (tok.length !=2) {
- throw new IllegalStateException(
- String.format("Malformatted list entry '%s'", line));
- }
- rdata[idx++] = tok[1];
+ rdata[idx++] = line.substring(tok[0].length() + 1);
} else if (code == NativeDaemonConnector.ResponseCode.CommandOkay) {
return rdata;
} else {
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 8594e44..b34b50a 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -78,7 +78,7 @@
*
* @param context Binder context for this service
*/
- private NetworkManagementService(Context context) {
+ public NetworkManagementService(Context context) {
mContext = context;
mObservers = new ArrayList<INetworkManagementEventObserver>();
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index cafc804..1cf3bad 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -16,6 +16,7 @@
package com.android.server;
+import com.android.internal.app.IMediaContainerService;
import com.android.internal.app.ResolverActivity;
import com.android.common.FastXmlSerializer;
import com.android.common.XmlUtils;
@@ -31,6 +32,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
+import android.content.ServiceConnection;
import android.content.IntentSender.SendIntentException;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
@@ -62,6 +64,7 @@
import android.os.Build;
import android.os.Bundle;
import android.os.HandlerThread;
+import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
@@ -283,26 +286,79 @@
final HashMap<String, ArrayList<String>> mPendingBroadcasts
= new HashMap<String, ArrayList<String>>();
static final int SEND_PENDING_BROADCAST = 1;
- static final int DESTROY_SD_CONTAINER = 2;
+ static final int MCS_BOUND = 3;
+ static final int END_COPY = 4;
+ static final int INIT_COPY = 5;
+ static final int MCS_UNBIND = 6;
// Delay time in millisecs
static final int BROADCAST_DELAY = 10 * 1000;
- static final int DESTROY_SD_CONTAINER_DELAY = 30 * 1000;
+ private ServiceConnection mDefContainerConn = new ServiceConnection() {
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ IMediaContainerService imcs =
+ IMediaContainerService.Stub.asInterface(service);
+ Message msg = mHandler.obtainMessage(MCS_BOUND, imcs);
+ mHandler.sendMessage(msg);
+ }
+
+ public void onServiceDisconnected(ComponentName name) {
+ }
+ };
class PackageHandler extends Handler {
+ final ArrayList<InstallArgs> mPendingInstalls =
+ new ArrayList<InstallArgs>();
+ // Service Connection to remote media container service to copy
+ // package uri's from external media onto secure containers
+ // or internal storage.
+ private IMediaContainerService mContainerService = null;
+
PackageHandler(Looper looper) {
super(looper);
}
public void handleMessage(Message msg) {
switch (msg.what) {
- case DESTROY_SD_CONTAINER:
- String pkgName = (String) msg.obj;
- if (pkgName != null) {
- // Too bad we cannot handle the errors from destroying the containers.
- if (!destroySdDir(pkgName)) {
- Log.e(TAG, "Failed to destroy container for pkg : " + pkgName);
+ case INIT_COPY: {
+ InstallArgs args = (InstallArgs) msg.obj;
+ args.createCopyFile();
+ Intent service = new Intent().setComponent(new ComponentName(
+ "com.android.defcontainer",
+ "com.android.defcontainer.DefaultContainerService"));
+ if (mContainerService != null) {
+ // No need to add to pending list. Use remote stub directly
+ handleStartCopy(args);
+ } else {
+ if (mContext.bindService(service, mDefContainerConn,
+ Context.BIND_AUTO_CREATE)) {
+ mPendingInstalls.add(args);
+ } else {
+ Log.e(TAG, "Failed to bind to media container service");
+ // Indicate install failure TODO add new error code
+ processPendingInstall(args,
+ PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE);
}
}
break;
+ }
+ case MCS_BOUND: {
+ // Initialize mContainerService if needed.
+ if (msg.obj != null) {
+ mContainerService = (IMediaContainerService) msg.obj;
+ }
+ if (mPendingInstalls.size() > 0) {
+ InstallArgs args = mPendingInstalls.remove(0);
+ if (args != null) {
+ handleStartCopy(args);
+ }
+ }
+ break;
+ }
+ case MCS_UNBIND : {
+ if (mPendingInstalls.size() == 0) {
+ mContext.unbindService(mDefContainerConn);
+ mContainerService = null;
+ }
+ break;
+ }
case SEND_PENDING_BROADCAST : {
String packages[];
ArrayList components[];
@@ -343,7 +399,37 @@
}
}
}
+
+ // Utility method to initiate copying apk via media
+ // container service.
+ private void handleStartCopy(InstallArgs args) {
+ int ret = PackageManager.INSTALL_SUCCEEDED;
+ if (mContainerService == null) {
+ // Install error
+ ret = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
+ } else {
+ ret = args.copyApk(mContainerService);
+ }
+ mHandler.sendEmptyMessage(MCS_UNBIND);
+ processPendingInstall(args, ret);
+ }
}
+
+ static boolean installOnSd(int flags) {
+ if (((flags & PackageManager.INSTALL_FORWARD_LOCK) != 0) ||
+ ((flags & PackageManager.INSTALL_ON_SDCARD) == 0)) {
+ return false;
+ }
+ return true;
+ }
+
+ static boolean isFwdLocked(int flags) {
+ if ((flags & PackageManager.INSTALL_FORWARD_LOCK) != 0) {
+ return true;
+ }
+ return false;
+ }
+
public static final IPackageManager main(Context context, boolean factoryTest) {
PackageManagerService m = new PackageManagerService(context, factoryTest);
ServiceManager.addService("package", m);
@@ -2022,11 +2108,12 @@
int parseFlags,
int scanMode) {
mLastScanError = PackageManager.INSTALL_SUCCEEDED;
+ String scanPath = scanFile.getPath();
parseFlags |= mDefParseFlags;
- PackageParser pp = new PackageParser(scanFile.getPath());
+ PackageParser pp = new PackageParser(scanPath);
pp.setSeparateProcesses(mSeparateProcesses);
final PackageParser.Package pkg = pp.parsePackage(scanFile,
- scanFile.getPath(),
+ scanPath,
mMetrics, parseFlags);
if (pkg == null) {
mLastScanError = pp.getParseError();
@@ -2066,7 +2153,8 @@
// Just remove the loaded entries from package lists.
mPackages.remove(ps.name);
}
- deletePackageResourcesLI(ps.name, ps.codePathString, ps.resourcePathString);
+ InstallArgs args = new FileInstallArgs(ps.codePathString, ps.resourcePathString);
+ args.cleanUpResourcesLI();
mSettings.enableSystemPackageLP(ps.name);
}
}
@@ -2077,6 +2165,18 @@
if (ps != null && !ps.codePath.equals(ps.resourcePath)) {
parseFlags |= PackageParser.PARSE_FORWARD_LOCK;
}
+
+ if ((parseFlags & PackageParser.PARSE_FORWARD_LOCK) != 0) {
+ if (ps != null && ps.resourcePathString != null) {
+ pkg.applicationInfo.publicSourceDir = ps.resourcePathString;
+ } else {
+ // Should not happen at all. Just log an error.
+ Log.e(TAG, "Resource path not set for pkg : " + pkg.packageName);
+ }
+ } else {
+ pkg.applicationInfo.publicSourceDir = pkg.mScanPath;
+ }
+ pkg.applicationInfo.sourceDir = pkg.mScanPath;
// Note that we invoke the following method only if we are about to unpack an application
return scanPackageLI(pkg, parseFlags, scanMode | SCAN_UPDATE_SIGNATURE);
}
@@ -2230,41 +2330,8 @@
}
// Initialize package source and resource directories
- File destResourceFile = null;
- File destCodeFile = null;
- if ((scanMode & SCAN_NO_PATHS) == 0) {
- boolean fwdLocked = (parseFlags & PackageParser.PARSE_FORWARD_LOCK) != 0;
- final String pkgFileName = pkgName + ".apk";
- File destDir = null;
-
- if (fwdLocked) {
- destDir = mDrmAppPrivateInstallDir;
- destResourceFile = new File(mAppInstallDir, pkgName + ".zip");
- } else {
- boolean onSd = (parseFlags & PackageParser.PARSE_ON_SDCARD) != 0;
- if (!onSd) {
- destDir = mAppInstallDir;
- } else {
- String cachePath = getSdDir(pkgName);
- if (cachePath == null) {
- Log.e(TAG, "Secure container path for pkg: " + pkgName + " at location: " + cachePath +
- " not found");
- mLastScanError = PackageManager.INSTALL_FAILED_CONTAINER_ERROR;
- return null;
- }
- destDir = new File(cachePath);
- }
- destResourceFile = new File(destDir, pkgFileName);
- }
- destCodeFile = new File(destDir, pkgFileName);
- pkg.mPath = destCodeFile.getAbsolutePath();
- } else {
- pkg.mPath = pkg.mScanPath;
- destCodeFile = new File(pkg.mScanPath);
- destResourceFile = new File(pkg.mScanPath);
- }
- pkg.applicationInfo.sourceDir = destCodeFile.getAbsolutePath();
- pkg.applicationInfo.publicSourceDir = destResourceFile.getAbsolutePath();
+ File destCodeFile = new File(pkg.applicationInfo.sourceDir);
+ File destResourceFile = new File(pkg.applicationInfo.publicSourceDir);
SharedUserSetting suid = null;
PackageSetting pkgSetting = null;
@@ -2568,21 +2635,17 @@
// We don't expect installation to fail beyond this point,
if ((scanMode&SCAN_MONITOR) != 0) {
- pkg.mPath = destCodeFile.getAbsolutePath();
mAppDirs.put(pkg.mPath, pkg);
}
// Request the ActivityManager to kill the process(only for existing packages)
// so that we do not end up in a confused state while the user is still using the older
// version of the application while the new one gets installed.
- IActivityManager am = ActivityManagerNative.getDefault();
- if ((am != null) && ((parseFlags & PackageManager.INSTALL_REPLACE_EXISTING ) != 0)) {
- try {
- am.killApplicationWithUid(pkg.applicationInfo.packageName,
+ if ((parseFlags & PackageManager.INSTALL_REPLACE_EXISTING ) != 0) {
+ killApplication(pkg.applicationInfo.packageName,
pkg.applicationInfo.uid);
- } catch (RemoteException e) {
- }
}
+
synchronized (mPackages) {
// Add the new setting to mSettings
mSettings.insertPackageSettingLP(pkgSetting, pkg);
@@ -2835,6 +2898,19 @@
return pkg;
}
+ private void killApplication(String pkgName, int uid) {
+ // Request the ActivityManager to kill the process(only for existing packages)
+ // so that we do not end up in a confused state while the user is still using the older
+ // version of the application while the new one gets installed.
+ IActivityManager am = ActivityManagerNative.getDefault();
+ if (am != null) {
+ try {
+ am.killApplicationWithUid(pkgName, uid);
+ } catch (RemoteException e) {
+ }
+ }
+ }
+
// The following constants are returned by cachePackageSharedLibsForAbiLI
// to indicate if native shared libraries were found in the package.
// Values are:
@@ -2855,9 +2931,8 @@
// room left on the data partition, or a ZipException if the package
// file is malformed.
//
- private int cachePackageSharedLibsForAbiLI( PackageParser.Package pkg,
- File dataPath, File scanFile, String cpuAbi)
- throws IOException, ZipException {
+ private int cachePackageSharedLibsForAbiLI(PackageParser.Package pkg,
+ File dataPath, File scanFile, String cpuAbi) throws IOException, ZipException {
File sharedLibraryDir = new File(dataPath.getPath() + "/lib");
final String apkLib = "lib/";
final int apkLibLen = apkLib.length();
@@ -2935,7 +3010,7 @@
if (mInstaller == null) {
sharedLibraryDir.mkdir();
}
- cacheSharedLibLI(pkg, zipFile, entry, sharedLibraryDir,
+ cacheNativeBinaryLI(pkg, zipFile, entry, sharedLibraryDir,
sharedLibraryFile);
}
}
@@ -2948,6 +3023,54 @@
return PACKAGE_INSTALL_NATIVE_FOUND_LIBRARIES;
}
+ // Find the gdbserver executable program in a package at
+ // lib/<cpuAbi>/gdbserver and copy it to /data/data/<name>/lib/gdbserver
+ //
+ // Returns PACKAGE_INSTALL_NATIVE_FOUND_LIBRARIES on success,
+ // or PACKAGE_INSTALL_NATIVE_NO_LIBRARIES otherwise.
+ //
+ private int cachePackageGdbServerLI(PackageParser.Package pkg,
+ File dataPath, File scanFile, String cpuAbi) throws IOException, ZipException {
+ File installGdbServerDir = new File(dataPath.getPath() + "/lib");
+ final String GDBSERVER = "gdbserver";
+ final String apkGdbServerPath = "lib/" + cpuAbi + "/" + GDBSERVER;
+
+ ZipFile zipFile = new ZipFile(scanFile);
+ Enumeration<ZipEntry> entries =
+ (Enumeration<ZipEntry>) zipFile.entries();
+
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ // skip directories
+ if (entry.isDirectory()) {
+ continue;
+ }
+ String entryName = entry.getName();
+
+ if (!entryName.equals(apkGdbServerPath)) {
+ continue;
+ }
+
+ String installGdbServerPath = installGdbServerDir.getPath() +
+ "/" + GDBSERVER;
+ File installGdbServerFile = new File(installGdbServerPath);
+ if (! installGdbServerFile.exists() ||
+ installGdbServerFile.length() != entry.getSize() ||
+ installGdbServerFile.lastModified() != entry.getTime()) {
+ if (Config.LOGD) {
+ Log.d(TAG, "Caching gdbserver " + entry.getName());
+ }
+ if (mInstaller == null) {
+ installGdbServerDir.mkdir();
+ }
+ cacheNativeBinaryLI(pkg, zipFile, entry, installGdbServerDir,
+ installGdbServerFile);
+ }
+ return PACKAGE_INSTALL_NATIVE_FOUND_LIBRARIES;
+ }
+ return PACKAGE_INSTALL_NATIVE_NO_LIBRARIES;
+ }
+
// extract shared libraries stored in the APK as lib/<cpuAbi>/lib<name>.so
// and copy them to /data/data/<appname>/lib.
//
@@ -2957,7 +3080,7 @@
//
private int cachePackageSharedLibsLI(PackageParser.Package pkg,
File dataPath, File scanFile) {
- final String cpuAbi = Build.CPU_ABI;
+ String cpuAbi = Build.CPU_ABI;
try {
int result = cachePackageSharedLibsForAbiLI(pkg, dataPath, scanFile, cpuAbi);
@@ -2968,7 +3091,7 @@
//
// only scan the package twice in case of ABI mismatch
if (result == PACKAGE_INSTALL_NATIVE_ABI_MISMATCH) {
- String cpuAbi2 = SystemProperties.get("ro.product.cpu.abi2",null);
+ final String cpuAbi2 = SystemProperties.get("ro.product.cpu.abi2",null);
if (cpuAbi2 != null) {
result = cachePackageSharedLibsForAbiLI(pkg, dataPath, scanFile, cpuAbi2);
}
@@ -2977,6 +3100,20 @@
Log.w(TAG,"Native ABI mismatch from package file");
return PackageManager.INSTALL_FAILED_INVALID_APK;
}
+
+ if (result == PACKAGE_INSTALL_NATIVE_FOUND_LIBRARIES) {
+ cpuAbi = cpuAbi2;
+ }
+ }
+
+ // for debuggable packages, also extract gdbserver from lib/<abi>
+ // into /data/data/<appname>/lib too.
+ if (result == PACKAGE_INSTALL_NATIVE_FOUND_LIBRARIES &&
+ (pkg.applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
+ int result2 = cachePackageGdbServerLI(pkg, dataPath, scanFile, cpuAbi);
+ if (result2 == PACKAGE_INSTALL_NATIVE_FOUND_LIBRARIES) {
+ pkg.applicationInfo.flags |= ApplicationInfo.FLAG_NATIVE_DEBUGGABLE;
+ }
}
} catch (ZipException e) {
Log.w(TAG, "Failed to extract data from package file", e);
@@ -2988,26 +3125,27 @@
return PackageManager.INSTALL_SUCCEEDED;
}
- private void cacheSharedLibLI(PackageParser.Package pkg,
+ private void cacheNativeBinaryLI(PackageParser.Package pkg,
ZipFile zipFile, ZipEntry entry,
- File sharedLibraryDir,
- File sharedLibraryFile) throws IOException {
+ File binaryDir,
+ File binaryFile) throws IOException {
InputStream inputStream = zipFile.getInputStream(entry);
try {
- File tempFile = File.createTempFile("tmp", "tmp", sharedLibraryDir);
+ File tempFile = File.createTempFile("tmp", "tmp", binaryDir);
String tempFilePath = tempFile.getPath();
- // XXX package manager can't change owner, so the lib files for
+ // XXX package manager can't change owner, so the executable files for
// now need to be left as world readable and owned by the system.
if (! FileUtils.copyToFile(inputStream, tempFile) ||
! tempFile.setLastModified(entry.getTime()) ||
FileUtils.setPermissions(tempFilePath,
FileUtils.S_IRUSR|FileUtils.S_IWUSR|FileUtils.S_IRGRP
+ |FileUtils.S_IXUSR|FileUtils.S_IXGRP|FileUtils.S_IXOTH
|FileUtils.S_IROTH, -1, -1) != 0 ||
- ! tempFile.renameTo(sharedLibraryFile)) {
+ ! tempFile.renameTo(binaryFile)) {
// Failed to properly write file.
tempFile.delete();
- throw new IOException("Couldn't create cached shared lib "
- + sharedLibraryFile + " in " + sharedLibraryDir);
+ throw new IOException("Couldn't create cached binary "
+ + binaryFile + " in " + binaryDir);
}
} finally {
inputStream.close();
@@ -3804,26 +3942,51 @@
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.INSTALL_PACKAGES, null);
+ Message msg = mHandler.obtainMessage(INIT_COPY);
+ msg.obj = createInstallArgs(packageURI, observer, flags, installerPackageName);
+ mHandler.sendMessage(msg);
+ }
+
+ private InstallArgs createInstallArgs(Uri packageURI, IPackageInstallObserver observer,
+ int flags, String installerPackageName) {
+ if (installOnSd(flags)) {
+ return new SdInstallArgs(packageURI, observer, flags,
+ installerPackageName);
+ } else {
+ return new FileInstallArgs(packageURI, observer, flags,
+ installerPackageName);
+ }
+ }
+
+ private InstallArgs createInstallArgs(int flags, String fullCodePath, String fullResourcePath) {
+ if (installOnSd(flags)) {
+ return new SdInstallArgs(fullCodePath, fullResourcePath);
+ } else {
+ return new FileInstallArgs(fullCodePath, fullResourcePath);
+ }
+ }
+
+ private void processPendingInstall(final InstallArgs args, final int currentStatus) {
// Queue up an async operation since the package installation may take a little while.
mHandler.post(new Runnable() {
public void run() {
mHandler.removeCallbacks(this);
// Result object to be returned
PackageInstalledInfo res = new PackageInstalledInfo();
- res.returnCode = PackageManager.INSTALL_SUCCEEDED;
+ res.returnCode = currentStatus;
res.uid = -1;
res.pkg = null;
res.removedInfo = new PackageRemovedInfo();
- // Make a temporary copy of file from given packageURI
- File tmpPackageFile = copyTempInstallFile(packageURI, res);
- if (tmpPackageFile != null) {
+ args.doPreInstall(res.returnCode);
+ if (res.returnCode == PackageManager.INSTALL_SUCCEEDED) {
synchronized (mInstallLock) {
- installPackageLI(packageURI, flags, true, installerPackageName, tmpPackageFile, res);
+ installPackageLI(args, true, res);
}
+ args.doPostInstall(res.returnCode);
}
- if (observer != null) {
+ if (args.observer != null) {
try {
- observer.packageInstalled(res.name, res.returnCode);
+ args.observer.packageInstalled(res.name, res.returnCode);
} catch (RemoteException e) {
Log.i(TAG, "Observer no longer exists.");
}
@@ -3846,12 +4009,403 @@
res.pkg.applicationInfo.packageName,
extras);
}
+ if (res.removedInfo.args != null) {
+ // Remove the replaced package's older resources safely now
+ synchronized (mInstallLock) {
+ res.removedInfo.args.cleanUpResourcesLI();
+ }
+ }
}
Runtime.getRuntime().gc();
}
});
}
+ static abstract class InstallArgs {
+ final IPackageInstallObserver observer;
+ final int flags;
+ final Uri packageURI;
+ final String installerPackageName;
+
+ InstallArgs(Uri packageURI,
+ IPackageInstallObserver observer, int flags,
+ String installerPackageName) {
+ this.packageURI = packageURI;
+ this.flags = flags;
+ this.observer = observer;
+ this.installerPackageName = installerPackageName;
+ }
+
+ abstract void createCopyFile();
+ abstract int copyApk(IMediaContainerService imcs);
+ abstract void doPreInstall(int status);
+ abstract boolean doRename(int status, String pkgName, String oldCodePath);
+ abstract void doPostInstall(int status);
+ abstract String getCodePath();
+ abstract String getResourcePath();
+ // Need installer lock especially for dex file removal.
+ abstract void cleanUpResourcesLI();
+ }
+
+ class FileInstallArgs extends InstallArgs {
+ File installDir;
+ String codeFileName;
+ String resourceFileName;
+
+ FileInstallArgs(Uri packageURI,
+ IPackageInstallObserver observer, int flags,
+ String installerPackageName) {
+ super(packageURI, observer, flags, installerPackageName);
+ }
+
+ FileInstallArgs(String fullCodePath, String fullResourcePath) {
+ super(null, null, 0, null);
+ File codeFile = new File(fullCodePath);
+ installDir = codeFile.getParentFile();
+ codeFileName = fullCodePath;
+ resourceFileName = fullResourcePath;
+ }
+
+ void createCopyFile() {
+ boolean fwdLocked = isFwdLocked(flags);
+ installDir = fwdLocked ? mDrmAppPrivateInstallDir : mAppInstallDir;
+ codeFileName = createTempPackageFile(installDir).getPath();
+ resourceFileName = getResourcePathFromCodePath();
+ }
+
+ String getCodePath() {
+ return codeFileName;
+ }
+
+ int copyApk(IMediaContainerService imcs) {
+ // Get a ParcelFileDescriptor to write to the output file
+ File codeFile = new File(codeFileName);
+ ParcelFileDescriptor out = null;
+ try {
+ out = ParcelFileDescriptor.open(codeFile,
+ ParcelFileDescriptor.MODE_READ_WRITE);
+ } catch (FileNotFoundException e) {
+ Log.e(TAG, "Failed to create file descritpor for : " + codeFileName);
+ return PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
+ }
+ // Copy the resource now
+ int ret = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
+ try {
+ if (imcs.copyResource(packageURI, out)) {
+ ret = PackageManager.INSTALL_SUCCEEDED;
+ }
+ } catch (RemoteException e) {
+ } finally {
+ try { if (out != null) out.close(); } catch (IOException e) {}
+ }
+ return ret;
+ }
+
+ void doPreInstall(int status) {
+ if (status != PackageManager.INSTALL_SUCCEEDED) {
+ cleanUp();
+ }
+ }
+
+ boolean doRename(int status, final String pkgName, String oldCodePath) {
+ if (status != PackageManager.INSTALL_SUCCEEDED) {
+ cleanUp();
+ return false;
+ } else {
+ // Rename based on packageName
+ File codeFile = new File(getCodePath());
+ String apkName = getNextCodePath(oldCodePath, pkgName, ".apk");
+ File desFile = new File(installDir, apkName + ".apk");
+ if (!codeFile.renameTo(desFile)) {
+ return false;
+ }
+ // Reset paths since the file has been renamed.
+ codeFileName = desFile.getPath();
+ resourceFileName = getResourcePathFromCodePath();
+ // Set permissions
+ if (!setPermissions(pkgName)) {
+ // Failed setting permissions.
+ return false;
+ }
+ return true;
+ }
+ }
+
+ void doPostInstall(int status) {
+ if (status != PackageManager.INSTALL_SUCCEEDED) {
+ cleanUp();
+ }
+ }
+
+ String getResourcePath() {
+ return resourceFileName;
+ }
+
+ String getResourcePathFromCodePath() {
+ String codePath = getCodePath();
+ if ((flags & PackageManager.INSTALL_FORWARD_LOCK) != 0) {
+ String apkNameOnly = getApkName(codePath);
+ return mAppInstallDir.getPath() + "/" + apkNameOnly + ".zip";
+ } else {
+ return codePath;
+ }
+ }
+
+ private boolean cleanUp() {
+ boolean ret = true;
+ String sourceDir = getCodePath();
+ String publicSourceDir = getResourcePath();
+ if (sourceDir != null) {
+ File sourceFile = new File(sourceDir);
+ if (!sourceFile.exists()) {
+ Log.w(TAG, "Package source " + sourceDir + " does not exist.");
+ ret = false;
+ }
+ // Delete application's code and resources
+ sourceFile.delete();
+ }
+ if (publicSourceDir != null && !publicSourceDir.equals(sourceDir)) {
+ final File publicSourceFile = new File(publicSourceDir);
+ if (!publicSourceFile.exists()) {
+ Log.w(TAG, "Package public source " + publicSourceFile + " does not exist.");
+ }
+ if (publicSourceFile.exists()) {
+ publicSourceFile.delete();
+ }
+ }
+ return ret;
+ }
+
+ void cleanUpResourcesLI() {
+ String sourceDir = getCodePath();
+ if (cleanUp() && mInstaller != null) {
+ int retCode = mInstaller.rmdex(sourceDir);
+ if (retCode < 0) {
+ Log.w(TAG, "Couldn't remove dex file for package: "
+ + " at location "
+ + sourceDir + ", retcode=" + retCode);
+ // we don't consider this to be a failure of the core package deletion
+ }
+ }
+ }
+
+ private boolean setPermissions(String pkgName) {
+ // TODO Do this in a more elegant way later on. for now just a hack
+ if (!isFwdLocked(flags)) {
+ final int filePermissions =
+ FileUtils.S_IRUSR|FileUtils.S_IWUSR|FileUtils.S_IRGRP
+ |FileUtils.S_IROTH;
+ int retCode = FileUtils.setPermissions(getCodePath(), filePermissions, -1, -1);
+ if (retCode != 0) {
+ Log.e(TAG, "Couldn't set new package file permissions for " +
+ getCodePath()
+ + ". The return code was: " + retCode);
+ // TODO Define new internal error
+ return false;
+ }
+ return true;
+ }
+ return true;
+ }
+ }
+
+ class SdInstallArgs extends InstallArgs {
+ String cid;
+ String cachePath;
+ static final String RES_FILE_NAME = "pkg.apk";
+
+ SdInstallArgs(Uri packageURI,
+ IPackageInstallObserver observer, int flags,
+ String installerPackageName) {
+ super(packageURI, observer, flags, installerPackageName);
+ }
+
+ SdInstallArgs(String fullCodePath, String fullResourcePath) {
+ super(null, null, 0, null);
+ // Extract cid from fullCodePath
+ int eidx = fullCodePath.lastIndexOf("/");
+ String subStr1 = fullCodePath.substring(0, eidx);
+ int sidx = subStr1.lastIndexOf("/");
+ cid = subStr1.substring(sidx+1, eidx);
+ cachePath = subStr1;
+ }
+
+ void createCopyFile() {
+ cid = getTempContainerId();
+ }
+
+ int copyApk(IMediaContainerService imcs) {
+ try {
+ cachePath = imcs.copyResourceToContainer(
+ packageURI, cid,
+ getEncryptKey(), RES_FILE_NAME);
+ } catch (RemoteException e) {
+ }
+
+ if (cachePath != null) {
+ // Mount container once its created with system_uid
+ cachePath = mountSdDir(cid, Process.SYSTEM_UID);
+ }
+ if (cachePath == null) {
+ return PackageManager.INSTALL_FAILED_CONTAINER_ERROR;
+ } else {
+ return PackageManager.INSTALL_SUCCEEDED;
+ }
+ }
+
+ @Override
+ String getCodePath() {
+ return cachePath + "/" + RES_FILE_NAME;
+ }
+
+ @Override
+ String getResourcePath() {
+ return cachePath + "/" + RES_FILE_NAME;
+ }
+
+ void doPreInstall(int status) {
+ if (status != PackageManager.INSTALL_SUCCEEDED) {
+ // Destroy container
+ destroySdDir(cid);
+ }
+ }
+
+ boolean doRename(int status, final String pkgName,
+ String oldCodePath) {
+ String newCacheId = getNextCodePath(oldCodePath, pkgName, "/" + RES_FILE_NAME);
+ // STOPSHIP TEMPORARY HACK FOR RENAME
+ // Create new container at newCachePath
+ String codePath = getCodePath();
+ String newCachePath = null;
+ final int CREATE_FAILED = 1;
+ final int COPY_FAILED = 3;
+ final int FINALIZE_FAILED = 5;
+ final int PASS = 7;
+ int errCode = CREATE_FAILED;
+ if ((newCachePath = createSdDir(new File(codePath), newCacheId)) != null) {
+ errCode = COPY_FAILED;
+ // Copy file from codePath
+ if (FileUtils.copyFile(new File(codePath), new File(newCachePath, RES_FILE_NAME))) {
+ errCode = FINALIZE_FAILED;
+ if (finalizeSdDir(newCacheId)) {
+ errCode = PASS;
+ }
+ }
+ }
+ // Print error based on errCode
+ String errMsg = "";
+ switch (errCode) {
+ case CREATE_FAILED:
+ errMsg = "CREATE_FAILED";
+ break;
+ case COPY_FAILED:
+ errMsg = "COPY_FAILED";
+ destroySdDir(newCacheId);
+ break;
+ case FINALIZE_FAILED:
+ errMsg = "FINALIZE_FAILED";
+ destroySdDir(newCacheId);
+ break;
+ default:
+ errMsg = "PASS";
+ break;
+ }
+ // Destroy the temporary container
+ destroySdDir(cid);
+ Log.i(TAG, "Status: " + errMsg);
+ if (errCode != PASS) {
+ return false;
+ }
+ cid = newCacheId;
+ cachePath = newCachePath;
+
+ return true;
+ }
+
+ void doPostInstall(int status) {
+ if (status != PackageManager.INSTALL_SUCCEEDED) {
+ cleanUp();
+ } else {
+ // Unmount container
+ // Rename and remount based on package name and new uid
+ }
+ }
+
+ private void cleanUp() {
+ // Destroy secure container
+ destroySdDir(cid);
+ }
+
+ void cleanUpResourcesLI() {
+ String sourceFile = getCodePath();
+ // Remove dex file
+ if (mInstaller != null) {
+ int retCode = mInstaller.rmdex(sourceFile.toString());
+ if (retCode < 0) {
+ Log.w(TAG, "Couldn't remove dex file for package: "
+ + " at location "
+ + sourceFile.toString() + ", retcode=" + retCode);
+ // we don't consider this to be a failure of the core package deletion
+ }
+ }
+ cleanUp();
+ }
+ };
+
+ // Utility method used to create code paths based on package name and available index.
+ private static String getNextCodePath(String oldCodePath, String prefix, String suffix) {
+ String idxStr = "";
+ int idx = 1;
+ if (oldCodePath != null) {
+ int eidx = -1;
+ if (suffix != null) {
+ eidx = oldCodePath.indexOf(suffix);
+ }
+ if (eidx == -1) {
+ eidx = oldCodePath.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);
+ }
+ try {
+ idx = Integer.parseInt(subStr);
+ if (idx <= 1) {
+ idx++;
+ } else {
+ idx--;
+ }
+ } catch(NumberFormatException e) {
+ }
+ }
+ }
+ idxStr = "-" + Integer.toString(idx);
+ return prefix + idxStr;
+ }
+
+ // Utility method that returns the relative package path with respect
+ // to the installation directory. Like say for /data/data/com.test-1.apk
+ // string com.test-1 is returned.
+ static String getApkName(String codePath) {
+ if (codePath == null) {
+ return null;
+ }
+ int sidx = codePath.lastIndexOf("/");
+ int eidx = codePath.lastIndexOf(".");
+ if (eidx == -1) {
+ eidx = codePath.length();
+ } else if (eidx == 0) {
+ Log.w(TAG, " Invalid code path, "+ codePath + " Not a valid apk name");
+ return null;
+ }
+ return codePath.substring(sidx+1, eidx);
+ }
+
class PackageInstalledInfo {
String name;
int uid;
@@ -3870,7 +4424,6 @@
// Remember this for later, in case we need to rollback this install
boolean dataDirExists;
String pkgName = pkg.packageName;
- boolean onSd = (parseFlags & PackageParser.PARSE_ON_SDCARD) != 0;
if (useEncryptedFilesystemForPackage(pkg)) {
dataDirExists = (new File(mSecureAppDataDir, pkgName)).exists();
@@ -3888,14 +4441,6 @@
}
}
mLastScanError = PackageManager.INSTALL_SUCCEEDED;
- if (onSd) {
- // Create secure container mount point for package
- String cPath = createSdDir(new File(pkg.mScanPath), pkgName);
- if (cPath == null) {
- mLastScanError = res.returnCode = PackageManager.INSTALL_FAILED_CONTAINER_ERROR;
- return;
- }
- }
PackageParser.Package newPackage = scanPackageLI(pkg, parseFlags, scanMode);
if (newPackage == null) {
Log.w(TAG, "Package couldn't be installed in " + pkg.mPath);
@@ -3903,21 +4448,9 @@
res.returnCode = PackageManager.INSTALL_FAILED_INVALID_APK;
}
} else {
- File destPackageFile = new File(pkg.mPath);
- if (destPackageFile.exists()) {
- // It's safe to do this because we know (from the above check) that the file
- // isn't currently used for an installed package.
- destPackageFile.delete();
- }
updateSettingsLI(newPackage,
installerPackageName,
res);
- if (res.returnCode == PackageManager.INSTALL_SUCCEEDED) {
- // Check if container can be finalized
- if(onSd && !finalizeSdDir(pkgName)) {
- res.returnCode = PackageManager.INSTALL_FAILED_CONTAINER_ERROR;
- }
- }
// delete the partially installed application. the data directory will have to be
// restored if it was already existing
if (res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
@@ -3926,15 +4459,11 @@
// scanPackageLocked, unless those directories existed before we even tried to
// install.
deletePackageLI(
- pkgName, true,
+ pkgName, false,
dataDirExists ? PackageManager.DONT_DELETE_DATA : 0,
res.removedInfo);
}
}
- if (onSd && res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
- // Destroy cache
- destroySdDir(pkgName);
- }
}
private void replacePackageLI(PackageParser.Package pkg,
@@ -3977,7 +4506,7 @@
parseFlags |= PackageManager.INSTALL_REPLACE_EXISTING;
// First delete the existing package while retaining the data directory
- if (!deletePackageLI(pkgName, false, PackageManager.DONT_DELETE_DATA,
+ if (!deletePackageLI(pkgName, true, PackageManager.DONT_DELETE_DATA,
res.removedInfo)) {
// If the existing package was'nt successfully deleted
res.returnCode = PackageManager.INSTALL_FAILED_REPLACE_COULDNT_DELETE;
@@ -4001,17 +4530,10 @@
if (res.returnCode == PackageManager.INSTALL_SUCCEEDED) {
// If we deleted an exisiting package, the old source and resource files that we
- // were keeping around in case we needed them (see below) can now be deleted
- final ApplicationInfo deletedPackageAppInfo = deletedPackage.applicationInfo;
- final ApplicationInfo installedPackageAppInfo =
- newPackage.applicationInfo;
- deletePackageResourcesLI(pkgName,
- !deletedPackageAppInfo.sourceDir
- .equals(installedPackageAppInfo.sourceDir)
- ? deletedPackageAppInfo.sourceDir : null,
- !deletedPackageAppInfo.publicSourceDir
- .equals(installedPackageAppInfo.publicSourceDir)
- ? deletedPackageAppInfo.publicSourceDir : null);
+ // were keeping around in case we needed them (see below) can now be deleted.
+ // This info will be set on the res.removedInfo to clean up later on as post
+ // install action.
+
//update signature on the new package setting
//this should always succeed, since we checked the
//signature earlier.
@@ -4038,22 +4560,15 @@
Log.e(TAG, "Failed allocating storage when restoring pkg : " + pkgName);
return;
}
- File restoreTmpFile = createTempPackageFile();
- if (restoreTmpFile == null) {
- Log.e(TAG, "Failed creating temp file when restoring pkg : " + pkgName);
- return;
- }
- if (!FileUtils.copyFile(restoreFile, restoreTmpFile)) {
- Log.e(TAG, "Failed copying temp file when restoring pkg : " + pkgName);
- return;
- }
PackageInstalledInfo restoreRes = new PackageInstalledInfo();
restoreRes.removedInfo = new PackageRemovedInfo();
- installPackageLI(
- Uri.fromFile(restoreFile),
- isForwardLocked(deletedPackage)
- ? PackageManager.INSTALL_FORWARD_LOCK
- : 0, false, oldInstallerPackageName, restoreTmpFile, restoreRes);
+ // Parse old package
+ parseFlags |= ~PackageManager.INSTALL_REPLACE_EXISTING;
+ scanPackageLI(restoreFile, parseFlags, scanMode);
+ synchronized (mPackages) {
+ grantPermissionsLP(deletedPackage, false);
+ mSettings.writeLP();
+ }
if (restoreRes.returnCode != PackageManager.INSTALL_SUCCEEDED) {
Log.e(TAG, "Failed restoring pkg : " + pkgName + " after failed upgrade");
}
@@ -4158,24 +4673,11 @@
return;
}
}
- // XXX There are probably some big issues here: upon doing
- // the rename, we have reached the point of no return (the
- // original .apk is gone!), so we can't fail. Yet... we can.
- File scanFile = new File(newPackage.mScanPath);
- if (!scanFile.renameTo(new File(newPackage.mPath))) {
- Log.e(TAG, "Couldn't move package file: " + newPackage.mScanPath + " to: " + newPackage.mPath);
- // TODO rename should work. Workaround
- if (!FileUtils.copyFile(scanFile, new File(newPackage.mPath))) {
- Log.e(TAG, "Couldn't move package file to: " + newPackage.mPath);
- res.returnCode = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
- }
+ res.returnCode = setPermissionsLI(newPackage);
+ if(res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
+ return;
} else {
- res.returnCode = setPermissionsLI(newPackage);
- if(res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
- return;
- } else {
- Log.d(TAG, "New package installed in " + newPackage.mPath);
- }
+ Log.d(TAG, "New package installed in " + newPackage.mPath);
}
if(res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
if (mInstaller != null) {
@@ -4196,67 +4698,11 @@
}
}
- private File copyTempInstallFile(Uri pPackageURI,
- PackageInstalledInfo res) {
- File tmpPackageFile = createTempPackageFile();
- int retCode = PackageManager.INSTALL_SUCCEEDED;
- if (tmpPackageFile == null) {
- res.returnCode = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
- return null;
- }
-
- if (pPackageURI.getScheme().equals("file")) {
- final File srcPackageFile = new File(pPackageURI.getPath());
- // We copy the source package file to a temp file and then rename it to the
- // destination file in order to eliminate a window where the package directory
- // scanner notices the new package file but it's not completely copied yet.
- if (!FileUtils.copyFile(srcPackageFile, tmpPackageFile)) {
- Log.e(TAG, "Couldn't copy package file to temp file.");
- retCode = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
- }
- } else if (pPackageURI.getScheme().equals("content")) {
- ParcelFileDescriptor fd = null;
- try {
- fd = mContext.getContentResolver().openFileDescriptor(pPackageURI, "r");
- } catch (FileNotFoundException e) {
- Log.e(TAG, "Couldn't open file descriptor from download service. Failed with exception " + e);
- retCode = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
- }
- if (fd == null) {
- Log.e(TAG, "Couldn't open file descriptor from download service (null).");
- retCode = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
- } else {
- if (Config.LOGV) {
- Log.v(TAG, "Opened file descriptor from download service.");
- }
- ParcelFileDescriptor.AutoCloseInputStream
- dlStream = new ParcelFileDescriptor.AutoCloseInputStream(fd);
- // We copy the source package file to a temp file and then rename it to the
- // destination file in order to eliminate a window where the package directory
- // scanner notices the new package file but it's not completely copied yet.
- if (!FileUtils.copyToFile(dlStream, tmpPackageFile)) {
- Log.e(TAG, "Couldn't copy package stream to temp file.");
- retCode = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
- }
- }
- } else {
- Log.e(TAG, "Package URI is not 'file:' or 'content:' - " + pPackageURI);
- retCode = PackageManager.INSTALL_FAILED_INVALID_URI;
- }
-
- res.returnCode = retCode;
- if (retCode != PackageManager.INSTALL_SUCCEEDED) {
- if (tmpPackageFile != null && tmpPackageFile.exists()) {
- tmpPackageFile.delete();
- }
- return null;
- }
- return tmpPackageFile;
- }
-
- private void installPackageLI(Uri pPackageURI,
- int pFlags, boolean newInstall, String installerPackageName,
- File tmpPackageFile, PackageInstalledInfo res) {
+ private void installPackageLI(InstallArgs args,
+ boolean newInstall, PackageInstalledInfo res) {
+ int pFlags = args.flags;
+ String installerPackageName = args.installerPackageName;
+ File tmpPackageFile = new File(args.getCodePath());
boolean forwardLocked = ((pFlags & PackageManager.INSTALL_FORWARD_LOCK) != 0);
boolean onSd = ((pFlags & PackageManager.INSTALL_ON_SDCARD) != 0);
boolean replacingExistingPackage = false;
@@ -4291,14 +4737,25 @@
break main_flow;
}
+ // Get rid of all references to package scan path via parser.
+ pp = null;
+ String oldCodePath = null;
synchronized (mPackages) {
//check if installing already existing package
if ((pFlags&PackageManager.INSTALL_REPLACE_EXISTING) != 0
&& mPackages.containsKey(pkgName)) {
replacingExistingPackage = true;
+ oldCodePath = mSettings.mPackages.get(pkgName).codePathString;
}
}
+ if (!args.doRename(res.returnCode, pkgName, oldCodePath)) {
+ res.returnCode = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
+ break main_flow;
+ }
+ // TODO rename pkg.mScanPath In scanPackageLI let it just set values based on mScanPath
+ pkg.applicationInfo.sourceDir = pkg.mScanPath= pkg.mPath = args.getCodePath();
+ pkg.applicationInfo.publicSourceDir = args.getResourcePath();
if(replacingExistingPackage) {
replacePackageLI(pkg, parseFlags, scanMode,
installerPackageName, res);
@@ -4307,15 +4764,16 @@
installerPackageName,res);
}
} finally {
- if (tmpPackageFile != null && tmpPackageFile.exists()) {
- tmpPackageFile.delete();
+ if (res.returnCode == PackageManager.INSTALL_SUCCEEDED) {
}
}
}
private int setPermissionsLI(PackageParser.Package newPackage) {
String pkgName = newPackage.packageName;
- int retCode;
+ int retCode = 0;
+ // TODO Gross hack but fix later. Ideally move this to be a post installation
+ // check after alloting uid.
if ((newPackage.applicationInfo.flags
& ApplicationInfo.FLAG_FORWARD_LOCK) != 0) {
File destResourceFile = new File(newPackage.applicationInfo.publicSourceDir);
@@ -4329,7 +4787,7 @@
//TODO clean up the extracted public files
}
if (mInstaller != null) {
- retCode = mInstaller.setForwardLockPerm(pkgName,
+ retCode = mInstaller.setForwardLockPerm(getApkName(newPackage.mPath),
newPackage.applicationInfo.uid);
} else {
final int filePermissions =
@@ -4338,15 +4796,16 @@
newPackage.applicationInfo.uid);
}
} else {
- final int filePermissions =
- FileUtils.S_IRUSR|FileUtils.S_IWUSR|FileUtils.S_IRGRP
- |FileUtils.S_IROTH;
- retCode = FileUtils.setPermissions(newPackage.mPath, filePermissions, -1, -1);
+ // The permissions on the resource file was set when it was copied for
+ // non forward locked apps and apps on sdcard
}
+
if (retCode != 0) {
Log.e(TAG, "Couldn't set new package file permissions for " +
newPackage.mPath
+ ". The return code was: " + retCode);
+ // TODO Define new internal error
+ return PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
}
return PackageManager.INSTALL_SUCCEEDED;
}
@@ -4429,10 +4888,10 @@
}
}
- private File createTempPackageFile() {
+ private File createTempPackageFile(File installDir) {
File tmpPackageFile;
try {
- tmpPackageFile = File.createTempFile("vmdl", ".tmp", mAppInstallDir);
+ tmpPackageFile = File.createTempFile("vmdl", ".tmp", installDir);
} catch (IOException e) {
Log.e(TAG, "Couldn't create temp file for downloaded package file.");
return null;
@@ -4508,6 +4967,13 @@
sendPackageBroadcast(Intent.ACTION_PACKAGE_REPLACED, packageName, extras);
}
}
+ // Delete the resources here after sending the broadcast to let
+ // other processes clean up before deleting resources.
+ synchronized (mInstallLock) {
+ if (info.args != null) {
+ info.args.cleanUpResourcesLI();
+ }
+ }
return res;
}
@@ -4516,6 +4982,8 @@
int uid = -1;
int removedUid = -1;
boolean isRemovedPackageSystemUpdate = false;
+ // Clean up resources deleted packages.
+ InstallArgs args = null;
void sendBroadcast(boolean fullRemove, boolean replacing) {
Bundle extras = new Bundle(1);
@@ -4645,36 +5113,6 @@
return true;
}
- private void deletePackageResourcesLI(String packageName,
- String sourceDir, String publicSourceDir) {
- if (sourceDir != null) {
- File sourceFile = new File(sourceDir);
- if (!sourceFile.exists()) {
- Log.w(TAG, "Package source " + sourceDir + " does not exist.");
- }
- // Delete application's code and resources
- sourceFile.delete();
- if (mInstaller != null) {
- int retCode = mInstaller.rmdex(sourceFile.toString());
- if (retCode < 0) {
- Log.w(TAG, "Couldn't remove dex file for package: "
- + packageName + " at location "
- + sourceFile.toString() + ", retcode=" + retCode);
- // we don't consider this to be a failure of the core package deletion
- }
- }
- }
- if (publicSourceDir != null && !publicSourceDir.equals(sourceDir)) {
- final File publicSourceFile = new File(publicSourceDir);
- if (!publicSourceFile.exists()) {
- Log.w(TAG, "Package public source " + publicSourceFile + " does not exist.");
- }
- if (publicSourceFile.exists()) {
- publicSourceFile.delete();
- }
- }
- }
-
private boolean deleteInstalledPackageLI(PackageParser.Package p,
boolean deleteCodeAndResources, int flags, PackageRemovedInfo outInfo) {
ApplicationInfo applicationInfo = p.applicationInfo;
@@ -4691,7 +5129,12 @@
// Delete application code and resources
if (deleteCodeAndResources) {
- deletePackageResourcesLI(applicationInfo.packageName,
+ // TODO can pick up from PackageSettings as well
+ int installFlags = ((p.applicationInfo.flags & ApplicationInfo.FLAG_ON_SDCARD)!=0) ?
+ PackageManager.INSTALL_ON_SDCARD : 0;
+ installFlags |= ((p.applicationInfo.flags & ApplicationInfo.FLAG_FORWARD_LOCK)!=0) ?
+ PackageManager.INSTALL_FORWARD_LOCK : 0;
+ outInfo.args = createInstallArgs(installFlags,
applicationInfo.sourceDir, applicationInfo.publicSourceDir);
}
return true;
@@ -4736,12 +5179,6 @@
Log.w(TAG, "Package " + p.packageName + " has no applicationInfo.");
return false;
}
- boolean onSd = (p.applicationInfo.flags & ApplicationInfo.FLAG_ON_SDCARD) != 0;
- // Mount sd container if needed
- if (onSd) {
- // TODO Better error handling from MountService api later
- mountSdDir(p.packageName, Process.SYSTEM_UID) ;
- }
boolean ret = false;
if ( (p.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
Log.i(TAG, "Removing system package:"+p.packageName);
@@ -4750,22 +5187,10 @@
ret = deleteSystemPackageLI(p, flags, outInfo);
} else {
Log.i(TAG, "Removing non-system package:"+p.packageName);
+ // Kill application pre-emptively especially for apps on sd.
+ killApplication(packageName, p.applicationInfo.uid);
ret = deleteInstalledPackageLI (p, deleteCodeAndResources, flags, outInfo);
}
- if (ret && onSd) {
- if (deleteCodeAndResources) {
- // Post a delayed destroy on the container since there might
- // be active processes holding open file handles to package
- // resources which will get killed by the process killer when
- // destroying the container. This might even kill the current
- // process and crash the system. Delay the destroy a bit so
- // that the active processes get to handle the uninstall broadcasts.
- sendDelayedDestroySdDir(packageName);
- } else {
- // Just unmount the directory
- unMountSdDir(packageName);
- }
- }
return ret;
}
@@ -7458,11 +7883,31 @@
final private String mSdEncryptKey = "AppsOnSD";
final private String mSdEncryptAlg = "AES";
private boolean mMediaMounted = false;
+ private static final int MAX_CONTAINERS = 250;
- private MountService getMountService() {
+
+ static MountService getMountService() {
return (MountService) ServiceManager.getService("mount");
}
+ private String getEncryptKey() {
+ try {
+ String sdEncKey = SystemKeyStore.getInstance().retrieveKeyHexString(mSdEncryptKey);
+ if (sdEncKey == null) {
+ sdEncKey = SystemKeyStore.getInstance().
+ generateNewKeyHexString(128, mSdEncryptAlg, mSdEncryptKey);
+ if (sdEncKey == null) {
+ Log.e(TAG, "Failed to create encryption keys");
+ return null;
+ }
+ }
+ return sdEncKey;
+ } catch (NoSuchAlgorithmException nsae) {
+ Log.e(TAG, "Failed to create encryption keys with exception: " + nsae);
+ return null;
+ }
+ }
+
private String createSdDir(File tmpPackageFile, String pkgName) {
// Create mount point via MountService
MountService mountService = getMountService();
@@ -7473,8 +7918,6 @@
}
if (DEBUG_SD_INSTALL) Log.i(TAG, "mbLen="+mbLen);
String cachePath = null;
- // Remove any pending destroy messages
- mHandler.removeMessages(DESTROY_SD_CONTAINER, pkgName);
String sdEncKey;
try {
sdEncKey = SystemKeyStore.getInstance().retrieveKeyHexString(mSdEncryptKey);
@@ -7535,7 +7978,13 @@
private boolean unMountSdDir(String pkgName) {
// STOPSHIP unmount directory
- return true;
+ try {
+ getMountService().unmountSecureContainer(pkgName);
+ return true;
+ } catch (IllegalStateException e) {
+ Log.e(TAG, "Failed to unmount : " + pkgName + " with exception " + e);
+ }
+ return false;
}
private String getSdDir(String pkgName) {
@@ -7560,10 +8009,6 @@
private boolean destroySdDir(String pkgName) {
try {
- if (mHandler.hasMessages(DESTROY_SD_CONTAINER, pkgName)) {
- // Don't have to send message again
- mHandler.removeMessages(DESTROY_SD_CONTAINER, pkgName);
- }
// We need to destroy right away
getMountService().destroySecureContainer(pkgName);
return true;
@@ -7573,7 +8018,7 @@
}
}
- private String[] getSecureContainerList() {
+ static String[] getSecureContainerList() {
try {
return getMountService().getSecureContainerList();
} catch (IllegalStateException e) {
@@ -7582,13 +8027,47 @@
return null;
}
- private void sendDelayedDestroySdDir(String pkgName) {
- if (mHandler.hasMessages(DESTROY_SD_CONTAINER, pkgName)) {
- // Don't have to send message again
- return;
+ static String getTempContainerId() {
+ String prefix = "smdl1tmp";
+ int tmpIdx = 1;
+ String list[] = getSecureContainerList();
+ if (list != null) {
+ int idx = 0;
+ int idList[] = new int[MAX_CONTAINERS];
+ boolean neverFound = true;
+ for (String name : list) {
+ // Ignore null entries
+ if (name == null) {
+ continue;
+ }
+ int sidx = name.indexOf(prefix);
+ if (sidx == -1) {
+ // Not a temp file. just ignore
+ continue;
+ }
+ String subStr = name.substring(sidx + prefix.length());
+ idList[idx] = -1;
+ if (subStr != null) {
+ try {
+ int cid = Integer.parseInt(subStr);
+ idList[idx++] = cid;
+ neverFound = false;
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ if (!neverFound) {
+ // Sort idList
+ Arrays.sort(idList);
+ for (int j = 1; j <= idList.length; j++) {
+ if (idList[j-1] != j) {
+ tmpIdx = j;
+ break;
+ }
+ }
+ }
}
- Message msg = mHandler.obtainMessage(DESTROY_SD_CONTAINER, pkgName);
- mHandler.sendMessageDelayed(msg, DESTROY_SD_CONTAINER_DELAY);
+ return prefix + tmpIdx;
}
public void updateExternalMediaStatus(final boolean mediaStatus) {
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 6b3f433..22447ed 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -249,6 +249,14 @@
}
try {
+ Log.i(TAG, "NetworkManagement Service");
+ ServiceManager.addService(
+ Context.NETWORKMANAGEMENT_SERVICE, new NetworkManagementService(context));
+ } catch (Throwable e) {
+ Log.e(TAG, "Failure starting NetworkManagement Service", e);
+ }
+
+ try {
Log.i(TAG, "Connectivity Service");
connectivity = ConnectivityService.getInstance(context);
ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity);
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 44b6624..c2c6e76 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -61,6 +61,7 @@
import android.content.pm.IPackageDataObserver;
import android.content.pm.IPackageManager;
import android.content.pm.InstrumentationInfo;
+import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PathPermission;
import android.content.pm.ProviderInfo;
@@ -8845,7 +8846,26 @@
sb.append("Process: system_server\n");
} else {
sb.append("Process: ").append(process.processName).append("\n");
- sb.append("Flags: 0x").append(Integer.toString(process.info.flags, 16)).append("\n");
+ }
+ if (process != null) {
+ int flags = process.info.flags;
+ IPackageManager pm = ActivityThread.getPackageManager();
+ sb.append("Flags: 0x").append(Integer.toString(flags, 16)).append("\n");
+ for (String pkg : process.pkgList) {
+ sb.append("Package: ").append(pkg);
+ try {
+ PackageInfo pi = pm.getPackageInfo(pkg, 0);
+ if (pi != null) {
+ sb.append(" v").append(pi.versionCode);
+ if (pi.versionName != null) {
+ sb.append(" (").append(pi.versionName).append(")");
+ }
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error getting package info: " + pkg, e);
+ }
+ sb.append("\n");
+ }
}
if (activity != null) {
sb.append("Activity: ").append(activity.shortComponentName).append("\n");
diff --git a/telephony/java/com/android/internal/telephony/MccTable.java b/telephony/java/com/android/internal/telephony/MccTable.java
index e25eb7b..7f62169 100644
--- a/telephony/java/com/android/internal/telephony/MccTable.java
+++ b/telephony/java/com/android/internal/telephony/MccTable.java
@@ -590,7 +590,7 @@
if (mcc != 0) {
setTimezoneFromMccIfNeeded(phone, mcc);
setLocaleFromMccIfNeeded(phone, mcc);
- setWifiChannelsFromMccIfNeeded(phone, mcc);
+ setWifiChannelsFromMcc(phone, mcc);
}
try {
Configuration config = ActivityManagerNative.getDefault().getConfiguration();
@@ -646,20 +646,14 @@
* @param phone PhoneBase to act on (get context from).
* @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA)
*/
- private static void setWifiChannelsFromMccIfNeeded(PhoneBase phone, int mcc) {
+ private static void setWifiChannelsFromMcc(PhoneBase phone, int mcc) {
int wifiChannels = MccTable.wifiChannelsForMcc(mcc);
if (wifiChannels != 0) {
Context context = phone.getContext();
- // only set to this default if the user hasn't manually set it
- try {
- Settings.Secure.getInt(context.getContentResolver(),
- Settings.Secure.WIFI_NUM_ALLOWED_CHANNELS);
- } catch (Settings.SettingNotFoundException e) {
- Log.d(LOG_TAG, "WIFI_NUM_ALLOWED_CHANNESL set to " + wifiChannels);
- WifiManager wM = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
- // don't persist
- wM.setNumAllowedChannels(wifiChannels, false);
- }
+ Log.d(LOG_TAG, "WIFI_NUM_ALLOWED_CHANNELS set to " + wifiChannels);
+ WifiManager wM = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
+ //persist
+ wM.setNumAllowedChannels(wifiChannels, true);
}
}
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java b/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java
index d27f240..9caae3d 100644
--- a/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java
+++ b/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java
@@ -282,7 +282,7 @@
private void readAdnFileAndWait(int recNum) {
Map <Integer,Integer> fileIds;
fileIds = mPbrFile.mFileIds.get(recNum);
- if (fileIds == null) return;
+ if (fileIds == null || fileIds.isEmpty()) return;
mAdnCache.requestLoadAllAdnLike(fileIds.get(USIM_EFADN_TAG),
fileIds.get(USIM_EFEXT1_TAG), obtainMessage(EVENT_USIM_ADN_LOAD_DONE));
diff --git a/telephony/tests/TelephonyTest/src/com/android/telephonytest/TelephonyUnitTestRunner.java b/telephony/tests/TelephonyTest/src/com/android/telephonytest/TelephonyUnitTestRunner.java
deleted file mode 100644
index 9e1af31..0000000
--- a/telephony/tests/TelephonyTest/src/com/android/telephonytest/TelephonyUnitTestRunner.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.telephonytest;
-
-import junit.framework.TestSuite;
-
-import android.test.InstrumentationTestRunner;
-import android.test.InstrumentationTestSuite;
-
-/**
- * Instrumentation Test Runner for all Telephony unit tests.
- *
- * Running all tests:
- *
- * runtest telephony-unit
- * or
- * adb shell am instrument -w com.android.telephonytest/.TelephonyUnitTestRunner
- */
-
-public class TelephonyUnitTestRunner extends InstrumentationTestRunner {
-
- @Override
- public TestSuite getAllTests() {
- TestSuite suite = new InstrumentationTestSuite(this);
- suite.addTestSuite(com.android.telephonytest.unit.CallerInfoUnitTest.class);
- suite.addTestSuite(com.android.telephonytest.unit.PhoneNumberUtilsUnitTest.class);
- return suite;
- }
-
- @Override
- public ClassLoader getLoader() {
- return TelephonyUnitTestRunner.class.getClassLoader();
- }
-}
diff --git a/telephony/tests/TelephonyTest/Android.mk b/telephony/tests/telephonytests/Android.mk
similarity index 80%
rename from telephony/tests/TelephonyTest/Android.mk
rename to telephony/tests/telephonytests/Android.mk
index 1ef8448..45e265a 100644
--- a/telephony/tests/TelephonyTest/Android.mk
+++ b/telephony/tests/telephonytests/Android.mk
@@ -7,6 +7,6 @@
LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_PACKAGE_NAME := telephonytest
+LOCAL_PACKAGE_NAME := FrameworksTelephonyTests
include $(BUILD_PACKAGE)
diff --git a/telephony/tests/TelephonyTest/AndroidManifest.xml b/telephony/tests/telephonytests/AndroidManifest.xml
similarity index 83%
rename from telephony/tests/TelephonyTest/AndroidManifest.xml
rename to telephony/tests/telephonytests/AndroidManifest.xml
index b2a481b..70aeebc 100644
--- a/telephony/tests/TelephonyTest/AndroidManifest.xml
+++ b/telephony/tests/telephonytests/AndroidManifest.xml
@@ -16,7 +16,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.telephonytest">
+ package="com.android.frameworks.telephonytests">
<application>
<uses-library android:name="android.test.runner" />
@@ -28,9 +28,9 @@
</intent-filter>
</activity>
</application>
- <instrumentation android:name=".TelephonyUnitTestRunner"
- android:targetPackage="com.android.telephonytest"
- android:label="Telephony unit tests InstrumentationRunner">
+ <instrumentation android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.android.frameworks.telephonytests"
+ android:label="Frameworks Telephony Tests">
</instrumentation>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
</manifest>
diff --git a/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java b/telephony/tests/telephonytests/src/android/telephony/PhoneNumberUtilsTest.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java
rename to telephony/tests/telephonytests/src/android/telephony/PhoneNumberUtilsTest.java
diff --git a/tests/CoreTests/com/android/internal/telephony/PhoneNumberWatcherTest.java b/telephony/tests/telephonytests/src/android/telephony/PhoneNumberWatcherTest.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/PhoneNumberWatcherTest.java
rename to telephony/tests/telephonytests/src/android/telephony/PhoneNumberWatcherTest.java
diff --git a/tests/CoreTests/com/android/internal/telephony/ATResponseParserTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/ATResponseParserTest.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/ATResponseParserTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/ATResponseParserTest.java
diff --git a/tests/CoreTests/com/android/internal/telephony/AdnRecordTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/AdnRecordTest.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/AdnRecordTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/AdnRecordTest.java
diff --git a/tests/CoreTests/com/android/internal/telephony/GsmAlphabetTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/GsmAlphabetTest.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/GsmAlphabetTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/GsmAlphabetTest.java
diff --git a/tests/CoreTests/com/android/internal/telephony/SMSDispatcherTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/SMSDispatcherTest.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/SMSDispatcherTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/SMSDispatcherTest.java
diff --git a/tests/CoreTests/com/android/internal/telephony/SimPhoneBookTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/SimPhoneBookTest.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/SimPhoneBookTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/SimPhoneBookTest.java
diff --git a/tests/CoreTests/com/android/internal/telephony/SimSmsTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/SimSmsTest.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/SimSmsTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/SimSmsTest.java
diff --git a/tests/CoreTests/com/android/internal/telephony/SimUtilsTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/SimUtilsTest.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/SimUtilsTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/SimUtilsTest.java
diff --git a/tests/CoreTests/com/android/internal/telephony/TelephonyUtilsTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/TelephonyUtilsTest.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/TelephonyUtilsTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/TelephonyUtilsTest.java
diff --git a/tests/CoreTests/com/android/internal/telephony/TestPhoneNotifier.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/TestPhoneNotifier.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/TestPhoneNotifier.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/TestPhoneNotifier.java
diff --git a/tests/CoreTests/com/android/internal/telephony/gsm/GSMPhoneTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/gsm/GSMPhoneTest.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/gsm/GSMPhoneTest.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/gsm/GSMPhoneTest.java
diff --git a/tests/CoreTests/com/android/internal/telephony/gsm/GSMTestHandler.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/gsm/GSMTestHandler.java
similarity index 100%
rename from tests/CoreTests/com/android/internal/telephony/gsm/GSMTestHandler.java
rename to telephony/tests/telephonytests/src/com/android/internal/telephony/gsm/GSMTestHandler.java
diff --git a/telephony/tests/TelephonyTest/src/com/android/telephonytest/unit/CallerInfoUnitTest.java b/telephony/tests/telephonytests/src/com/android/telephonytest/unit/CallerInfoUnitTest.java
similarity index 100%
rename from telephony/tests/TelephonyTest/src/com/android/telephonytest/unit/CallerInfoUnitTest.java
rename to telephony/tests/telephonytests/src/com/android/telephonytest/unit/CallerInfoUnitTest.java
diff --git a/telephony/tests/TelephonyTest/src/com/android/telephonytest/unit/PhoneNumberUtilsUnitTest.java b/telephony/tests/telephonytests/src/com/android/telephonytest/unit/PhoneNumberUtilsUnitTest.java
similarity index 100%
rename from telephony/tests/TelephonyTest/src/com/android/telephonytest/unit/PhoneNumberUtilsUnitTest.java
rename to telephony/tests/telephonytests/src/com/android/telephonytest/unit/PhoneNumberUtilsUnitTest.java
diff --git a/tests/AndroidTests/src/com/android/unit_tests/DatabaseGeneralTest.java b/tests/AndroidTests/src/com/android/unit_tests/DatabaseGeneralTest.java
index 69d55c1..d7dd601 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/DatabaseGeneralTest.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/DatabaseGeneralTest.java
@@ -17,14 +17,17 @@
package com.android.unit_tests;
import android.content.ContentValues;
+import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.CharArrayBuffer;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
+import android.os.Environment;
import android.os.Handler;
import android.os.Parcel;
+import android.test.AndroidTestCase;
import android.test.PerformanceTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
@@ -41,7 +44,7 @@
import static android.database.DatabaseUtils.InsertHelper.TABLE_INFO_PRAGMA_COLUMNNAME_INDEX;
import static android.database.DatabaseUtils.InsertHelper.TABLE_INFO_PRAGMA_DEFAULT_INDEX;
-public class DatabaseGeneralTest extends TestCase implements PerformanceTestCase {
+public class DatabaseGeneralTest extends AndroidTestCase implements PerformanceTestCase {
private static final String sString1 = "this is a test";
private static final String sString2 = "and yet another test";
@@ -55,7 +58,8 @@
@Override
protected void setUp() throws Exception {
super.setUp();
- mDatabaseFile = new File("/sqlite_stmt_journals", "database_test.db");
+ File dbDir = getContext().getDir(this.getClass().getName(), Context.MODE_PRIVATE);
+ mDatabaseFile = new File(dbDir, "database_test.db");
if (mDatabaseFile.exists()) {
mDatabaseFile.delete();
}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/internal/util/HanziToPinyinTest.java b/tests/AndroidTests/src/com/android/unit_tests/internal/util/HanziToPinyinTest.java
new file mode 100644
index 0000000..8e1ff0b
--- /dev/null
+++ b/tests/AndroidTests/src/com/android/unit_tests/internal/util/HanziToPinyinTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.unit_tests.internal.util;
+
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Locale;
+
+import android.test.suitebuilder.annotation.SmallTest;
+import android.util.Log;
+
+import com.android.internal.util.HanziToPinyin;
+import com.android.internal.util.HanziToPinyin.Token;
+
+import junit.framework.TestCase;
+
+public class HanziToPinyinTest extends TestCase {
+ private final static String ONE_HANZI = "\u675C";
+ private final static String TWO_HANZI = "\u675C\u9D51";
+ private final static String ASSIC = "test";
+ private final static String ONE_UNKNOWN = "\uFF71";
+ private final static String MISC = "test\u675C Test with space\uFF71\uFF71\u675C";
+
+ @SmallTest
+ public void testGetToken() throws Exception {
+ ArrayList<Token> tokens = HanziToPinyin.getInstance().get(ONE_HANZI);
+ assertEquals(tokens.size(), 1);
+ assertEquals(tokens.get(0).type, Token.PINYIN);
+ assertTrue(tokens.get(0).target.equalsIgnoreCase("DU"));
+
+ tokens = HanziToPinyin.getInstance().get(TWO_HANZI);
+ assertEquals(tokens.size(), 2);
+ assertEquals(tokens.get(0).type, Token.PINYIN);
+ assertEquals(tokens.get(1).type, Token.PINYIN);
+ assertTrue(tokens.get(0).target.equalsIgnoreCase("DU"));
+ assertTrue(tokens.get(1).target.equalsIgnoreCase("JUAN"));
+
+ tokens = HanziToPinyin.getInstance().get(ASSIC);
+ assertEquals(tokens.size(), 1);
+ assertEquals(tokens.get(0).type, Token.LATIN);
+
+ tokens = HanziToPinyin.getInstance().get(ONE_UNKNOWN);
+ assertEquals(tokens.size(), 1);
+ assertEquals(tokens.get(0).type, Token.UNKNOWN);
+
+ tokens = HanziToPinyin.getInstance().get(MISC);
+ assertEquals(tokens.size(), 7);
+ assertEquals(tokens.get(0).type, Token.LATIN);
+ assertEquals(tokens.get(1).type, Token.PINYIN);
+ assertEquals(tokens.get(2).type, Token.LATIN);
+ assertEquals(tokens.get(3).type, Token.LATIN);
+ assertEquals(tokens.get(4).type, Token.LATIN);
+ assertEquals(tokens.get(5).type, Token.UNKNOWN);
+ assertEquals(tokens.get(6).type, Token.PINYIN);
+ }
+}
diff --git a/tests/CoreTests/android/content/SyncQueueTest.java b/tests/CoreTests/android/content/SyncQueueTest.java
new file mode 100644
index 0000000..5f4ab78
--- /dev/null
+++ b/tests/CoreTests/android/content/SyncQueueTest.java
@@ -0,0 +1,164 @@
+/*
+ * 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.content;
+
+import android.test.AndroidTestCase;
+import android.test.RenamingDelegatingContext;
+import android.test.mock.MockContext;
+import android.test.mock.MockContentResolver;
+import android.accounts.Account;
+import android.os.Bundle;
+import android.os.SystemClock;
+
+public class SyncQueueTest extends AndroidTestCase {
+ private static final Account ACCOUNT1 = new Account("test.account1", "test.type1");
+ private static final Account ACCOUNT2 = new Account("test.account2", "test.type2");
+ private static final String AUTHORITY1 = "test.authority1";
+ private static final String AUTHORITY2 = "test.authority2";
+ private static final String AUTHORITY3 = "test.authority3";
+
+ private SyncStorageEngine mSettings;
+ private SyncQueue mSyncQueue;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ MockContentResolver mockResolver = new MockContentResolver();
+ mSettings = SyncStorageEngine.newTestInstance(new TestContext(mockResolver, getContext()));
+ mSyncQueue = new SyncQueue(mSettings);
+ }
+
+ public void testSyncQueueOrder() throws Exception {
+ final SyncOperation op1 = new SyncOperation(
+ ACCOUNT1, SyncStorageEngine.SOURCE_USER, AUTHORITY1, newTestBundle("1"), 0);
+ final SyncOperation op2 = new SyncOperation(
+ ACCOUNT2, SyncStorageEngine.SOURCE_USER, AUTHORITY2, newTestBundle("2"), 100);
+ final SyncOperation op3 = new SyncOperation(
+ ACCOUNT1, SyncStorageEngine.SOURCE_USER, AUTHORITY1, newTestBundle("3"), 150);
+ final SyncOperation op4 = new SyncOperation(
+ ACCOUNT2, SyncStorageEngine.SOURCE_USER, AUTHORITY2, newTestBundle("4"), 60);
+ final SyncOperation op5 = new SyncOperation(
+ ACCOUNT1, SyncStorageEngine.SOURCE_USER, AUTHORITY1, newTestBundle("5"), 80);
+ final SyncOperation op6 = new SyncOperation(
+ ACCOUNT2, SyncStorageEngine.SOURCE_USER, AUTHORITY2, newTestBundle("6"), 0);
+ op6.expedited = true;
+
+ mSyncQueue.add(op1);
+ mSyncQueue.add(op2);
+ mSyncQueue.add(op3);
+ mSyncQueue.add(op4);
+ mSyncQueue.add(op5);
+ mSyncQueue.add(op6);
+
+ long now = SystemClock.elapsedRealtime() + 200;
+
+ assertEquals(op6, mSyncQueue.nextReadyToRun(now));
+ mSyncQueue.remove(op6);
+
+ assertEquals(op1, mSyncQueue.nextReadyToRun(now));
+ mSyncQueue.remove(op1);
+
+ assertEquals(op4, mSyncQueue.nextReadyToRun(now));
+ mSyncQueue.remove(op4);
+
+ assertEquals(op5, mSyncQueue.nextReadyToRun(now));
+ mSyncQueue.remove(op5);
+
+ assertEquals(op2, mSyncQueue.nextReadyToRun(now));
+ mSyncQueue.remove(op2);
+
+ assertEquals(op3, mSyncQueue.nextReadyToRun(now));
+ mSyncQueue.remove(op3);
+ }
+
+ public void testOrderWithBackoff() throws Exception {
+ final SyncOperation op1 = new SyncOperation(
+ ACCOUNT1, SyncStorageEngine.SOURCE_USER, AUTHORITY1, newTestBundle("1"), 0);
+ final SyncOperation op2 = new SyncOperation(
+ ACCOUNT2, SyncStorageEngine.SOURCE_USER, AUTHORITY2, newTestBundle("2"), 100);
+ final SyncOperation op3 = new SyncOperation(
+ ACCOUNT1, SyncStorageEngine.SOURCE_USER, AUTHORITY1, newTestBundle("3"), 150);
+ final SyncOperation op4 = new SyncOperation(
+ ACCOUNT2, SyncStorageEngine.SOURCE_USER, AUTHORITY3, newTestBundle("4"), 60);
+ final SyncOperation op5 = new SyncOperation(
+ ACCOUNT1, SyncStorageEngine.SOURCE_USER, AUTHORITY1, newTestBundle("5"), 80);
+ final SyncOperation op6 = new SyncOperation(
+ ACCOUNT2, SyncStorageEngine.SOURCE_USER, AUTHORITY2, newTestBundle("6"), 0);
+ op6.expedited = true;
+
+ mSyncQueue.add(op1);
+ mSyncQueue.add(op2);
+ mSyncQueue.add(op3);
+ mSyncQueue.add(op4);
+ mSyncQueue.add(op5);
+ mSyncQueue.add(op6);
+
+ long now = SystemClock.elapsedRealtime() + 200;
+
+ assertEquals(op6, mSyncQueue.nextReadyToRun(now));
+ mSyncQueue.remove(op6);
+
+ assertEquals(op1, mSyncQueue.nextReadyToRun(now));
+ mSyncQueue.remove(op1);
+
+ mSettings.setBackoff(ACCOUNT2, AUTHORITY3, now + 200, 5);
+ assertEquals(op5, mSyncQueue.nextReadyToRun(now));
+
+ mSettings.setBackoff(ACCOUNT2, AUTHORITY3, SyncStorageEngine.NOT_IN_BACKOFF_MODE, 0);
+ assertEquals(op4, mSyncQueue.nextReadyToRun(now));
+
+ mSettings.setDelayUntilTime(ACCOUNT2, AUTHORITY3, now + 200);
+ assertEquals(op5, mSyncQueue.nextReadyToRun(now));
+
+ mSettings.setDelayUntilTime(ACCOUNT2, AUTHORITY3, 0);
+ assertEquals(op4, mSyncQueue.nextReadyToRun(now));
+ mSyncQueue.remove(op4);
+
+ assertEquals(op5, mSyncQueue.nextReadyToRun(now));
+ mSyncQueue.remove(op5);
+
+ assertEquals(op2, mSyncQueue.nextReadyToRun(now));
+ mSyncQueue.remove(op2);
+
+ assertEquals(op3, mSyncQueue.nextReadyToRun(now));
+ mSyncQueue.remove(op3);
+ }
+
+ Bundle newTestBundle(String val) {
+ Bundle bundle = new Bundle();
+ bundle.putString("test", val);
+ return bundle;
+ }
+
+ static class TestContext extends ContextWrapper {
+ ContentResolver mResolver;
+
+ public TestContext(ContentResolver resolver, Context realContext) {
+ super(new RenamingDelegatingContext(new MockContext(), realContext, "test."));
+ mResolver = resolver;
+ }
+
+ @Override
+ public void enforceCallingOrSelfPermission(String permission, String message) {
+ }
+
+ @Override
+ public ContentResolver getContentResolver() {
+ return mResolver;
+ }
+ }
+}
diff --git a/tests/CoreTests/android/core/CoreTests.java b/tests/CoreTests/android/core/CoreTests.java
deleted file mode 100644
index 442fe0f..0000000
--- a/tests/CoreTests/android/core/CoreTests.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.core;
-
-import com.android.internal.telephony.TelephonyTests;
-
-import junit.framework.TestSuite;
-
-import android.graphics.ColorStateListTest;
-import android.location.LocationManagerProximityTest;
-import android.location.LocationTest;
-import android.test.AndroidTestRunnerTest;
-import android.test.InstrumentationTestRunnerTest;
-import android.util.*;
-import android.view.FocusFinderTest;
-import android.view.ViewGroupAttributesTest;
-import android.webkit.*;
-
-public class CoreTests extends TestSuite {
-
- /**
- * To run these tests:
- * $ mmm java/tests && adb sync
- * $ adb shell am instrument -w \
- * -e class android.core.CoreTests \
- * android.core/android.test.InstrumentationTestRunner
- */
- public static TestSuite suite() {
- TestSuite suite = new TestSuite(CoreTests.class.getName());
-
- // Re-enable StateListDrawableTest when we are running in the
- // framework-test directory which allows access to package private
- // access for MockView
- // suite.addTestSuite(StateListDrawableTest.class);
- suite.addTestSuite(DayOfMonthCursorTest.class);
- suite.addTestSuite(MonthDisplayHelperTest.class);
- suite.addTestSuite(StateSetTest.class);
- suite.addTestSuite(ColorStateListTest.class);
- suite.addTestSuite(FocusFinderTest.class);
- suite.addTestSuite(ViewGroupAttributesTest.class);
- suite.addTest(TelephonyTests.suite());
- suite.addTestSuite(FloatMathTest.class);
- suite.addTest(JavaTests.suite());
- suite.addTestSuite(LocationTest.class);
- suite.addTestSuite(LocationManagerProximityTest.class);
- suite.addTestSuite(AndroidTestRunnerTest.class);
- suite.addTestSuite(InstrumentationTestRunnerTest.class);
-
- return suite;
- }
-}
diff --git a/tests/CoreTests/android/core/JavaTests.java b/tests/CoreTests/android/core/JavaTests.java
deleted file mode 100644
index bd8cbf0..0000000
--- a/tests/CoreTests/android/core/JavaTests.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.core;
-
-import junit.framework.TestSuite;
-
-public class JavaTests {
- public static TestSuite suite() {
- TestSuite suite = new TestSuite(JavaTests.class.getName());
-
- //Disabling until bug http://b/issue?id=1200337 is resolved
- //suite.addTestSuite(RequestAPITest.class);
- suite.addTestSuite(MathTest.class);
- suite.addTestSuite(StrictMathTest.class);
- suite.addTestSuite(HashMapPerfTest.class);
- suite.addTestSuite(TreeMapTest.class);
- suite.addTestSuite(FloatDoubleTest.class);
- suite.addTestSuite(Sha1Test.class);
- suite.addTestSuite(NIOTest.class);
- suite.addTestSuite(ReflectArrayTest.class);
- //Commenting out until we find a better way to exclude from continuous testing.
- //suite.addTestSuite(URLTest.class);
- suite.addTestSuite(URITest.class);
- suite.addTestSuite(RegexTest.class);
- suite.addTestSuite(HashMapTest.class);
- suite.addTestSuite(ArrayListTest.class);
- suite.addTestSuite(BooleanTest.class);
- suite.addTestSuite(StringTest.class);
- suite.addTestSuite(BufferedReaderTest.class);
- suite.addTestSuite(CharArrayReaderTest.class);
- suite.addTestSuite(PushbackReaderTest.class);
- suite.addTestSuite(StringReaderTest.class);
- suite.addTestSuite(StreamTokenizerTest.class);
- suite.addTestSuite(ByteArrayInputStreamTest.class);
- suite.addTestSuite(DataInputStreamTest.class);
- suite.addTestSuite(BufferedInputStreamTest.class);
- suite.addTestSuite(PushbackInputStreamTest.class);
- suite.addTestSuite(ByteArrayOutputStreamTest.class);
- suite.addTestSuite(DataOutputStreamTest.class);
- suite.addTestSuite(BufferedOutputStreamTest.class);
- suite.addTestSuite(CharArrayWriterTest.class);
- suite.addTestSuite(StringWriterTest.class);
- suite.addTestSuite(PrintWriterTest.class);
- suite.addTestSuite(BufferedWriterTest.class);
- suite.addTestSuite(ClassTest.class);
- //To be unccommented when Bug #799327 is fixed.
- //suite.addTestSuite(ClassLoaderTest.class);
- suite.addTestSuite(LineNumberReaderTest.class);
- suite.addTestSuite(InputStreamReaderTest.class);
- suite.addTestSuite(OutputStreamWriterTest.class);
- suite.addTestSuite(EnumTest.class);
- suite.addTestSuite(ParseIntTest.class);
- suite.addTestSuite(PipedStreamTest.class);
- suite.addTestSuite(LocaleTest.class);
- //Commenting out until we find a better way to exclude from continuous testing.
- //suite.addTestSuite(InetAddrTest.class);
- suite.addTestSuite(SocketTest.class);
- suite.addTestSuite(ChecksumTest.class);
- suite.addTestSuite(DeflateTest.class);
- suite.addTestSuite(ZipStreamTest.class);
- suite.addTestSuite(GZIPStreamTest.class);
- suite.addTestSuite(ZipFileTest.class);
- suite.addTestSuite(FileTest.class);
- suite.addTestSuite(SQLiteJDBCDriverTest.class);
- suite.addTestSuite(AtParserTest.class);
- suite.addTestSuite(DatagramTest.class);
- suite.addTestSuite(CryptoTest.class);
- suite.addTestSuite(MiscRegressionTest.class);
-
- return suite;
- }
-}
diff --git a/tests/CoreTests/android/location/LocationManagerProximityTest.java b/tests/CoreTests/android/location/LocationManagerProximityTest.java
deleted file mode 100644
index e82d878..0000000
--- a/tests/CoreTests/android/location/LocationManagerProximityTest.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright (C) 2008 Google Inc.
- *
- * 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.location;
-
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.location.Criteria;
-import android.location.Location;
-import android.location.LocationManager;
-import android.provider.Settings;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.Suppress;
-import android.util.Log;
-
-/**
- * Tests for LocationManager.addProximityAlert
- *
- * TODO: add tests for more scenarios
- *
- * To run:
- * adb shell am instrument -e class android.location.LocationManagerProximityTest \
- * -w android.core/android.test.InstrumentationTestRunner
- *
- * This test requires that the "Allow mock locations" setting be enabled.
- * To ensure reliable results, all location providers should be disabled.
- *
- */
-@Suppress
-@MediumTest
-public class LocationManagerProximityTest extends AndroidTestCase {
-
- private static final int UPDATE_LOCATION_WAIT_TIME = 1000;
- private static final int PROXIMITY_WAIT_TIME = 2000;
-
- private LocationManager mLocationManager;
- private PendingIntent mPendingIntent;
- private TestIntentReceiver mIntentReceiver;
-
- private static final String LOG_TAG = "LocationProximityTest";
-
- private static final String PROVIDER_NAME = "test";
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- // test that mock locations are allowed so a more descriptive error message can be logged
- if (Settings.Secure.getInt(getContext().getContentResolver(),
- Settings.Secure.ALLOW_MOCK_LOCATION, 0) == 0) {
- fail("Mock locations are currently disabled in Settings - this test requires " +
- "mock locations");
- }
-
- mLocationManager = (LocationManager) getContext().
- getSystemService(Context.LOCATION_SERVICE);
- if (mLocationManager.getProvider(PROVIDER_NAME) != null) {
- mLocationManager.removeTestProvider(PROVIDER_NAME);
- }
-
- mLocationManager.addTestProvider(PROVIDER_NAME, true, //requiresNetwork,
- false, // requiresSatellite,
- true, // requiresCell,
- false, // hasMonetaryCost,
- false, // supportsAltitude,
- false, // supportsSpeed, s
- false, // upportsBearing,
- Criteria.POWER_MEDIUM, // powerRequirement
- Criteria.ACCURACY_FINE); // accuracy
- mLocationManager.setTestProviderEnabled(PROVIDER_NAME, true);
- }
-
- @Override
- protected void tearDown() throws Exception {
- mLocationManager.removeTestProvider(PROVIDER_NAME);
-
- if (mPendingIntent != null) {
- mLocationManager.removeProximityAlert(mPendingIntent);
- }
- if (mIntentReceiver != null) {
- getContext().unregisterReceiver(mIntentReceiver);
- }
- }
-
- /**
- * Tests basic proximity alert when entering proximity
- */
- public void testEnterProximity() throws Exception {
- doTestEnterProximity(10000);
- }
-
- /**
- * Tests proximity alert when entering proximity, with no expiration
- */
- public void testEnterProximity_noexpire() throws Exception {
- doTestEnterProximity(-1);
- }
-
- /**
- * Helper variant for testing enter proximity scenario
- * TODO: add additional parameters as more scenarios are added
- *
- * @param expiration - expiry of proximity alert
- */
- private void doTestEnterProximity(long expiration) throws Exception {
- // update location to outside proximity range
- synchronousSendLocation(30, 30);
- registerProximityListener(0, 0, 1000, expiration);
- sendLocation(0, 0);
- waitForAlert();
- assertProximityType(true);
- }
-
- /**
- * Tests basic proximity alert when exiting proximity
- */
- public void testExitProximity() throws Exception {
- // first do enter proximity scenario
- doTestEnterProximity(-1);
-
- // now update to trigger exit proximity proximity
- mIntentReceiver.clearReceivedIntents();
- sendLocation(20, 20);
- waitForAlert();
- assertProximityType(false);
- }
-
- /**
- * Registers the proximity intent receiver
- */
- private void registerProximityListener(double latitude, double longitude,
- float radius, long expiration) {
- String intentKey = "testProximity";
- Intent proximityIntent = new Intent(intentKey);
- mPendingIntent = PendingIntent.getBroadcast(getContext(), 0,
- proximityIntent, PendingIntent.FLAG_CANCEL_CURRENT);
- mIntentReceiver = new TestIntentReceiver(intentKey);
-
- mLocationManager.addProximityAlert(latitude, longitude, radius,
- expiration, mPendingIntent);
-
- getContext().registerReceiver(mIntentReceiver,
- mIntentReceiver.getFilter());
-
- }
-
- /**
- * Blocks until proximity intent notification is received
- * @throws InterruptedException
- */
- private void waitForAlert() throws InterruptedException {
- Log.d(LOG_TAG, "Waiting for proximity update");
- synchronized (mIntentReceiver) {
- mIntentReceiver.wait(PROXIMITY_WAIT_TIME);
- }
-
- assertNotNull("Did not receive proximity alert",
- mIntentReceiver.getLastReceivedIntent());
- }
-
- /**
- * Asserts that the received intent had the enter proximity property set as
- * expected
- * @param expectedEnterProximity - true if enter proximity expected, false if
- * exit expected
- */
- private void assertProximityType(boolean expectedEnterProximity)
- throws Exception {
- boolean proximityTest = mIntentReceiver.getLastReceivedIntent().
- getBooleanExtra(LocationManager.KEY_PROXIMITY_ENTERING,
- !expectedEnterProximity);
- assertEquals("proximity alert not set to expected enter proximity value",
- expectedEnterProximity, proximityTest);
- }
-
- /**
- * Synchronous variant of sendLocation
- */
- private void synchronousSendLocation(final double latitude,
- final double longitude)
- throws InterruptedException {
- sendLocation(latitude, longitude, this);
- // wait for location to be set
- synchronized (this) {
- wait(UPDATE_LOCATION_WAIT_TIME);
- }
- }
-
- /**
- * Asynchronously update the mock location provider without notification
- */
- private void sendLocation(final double latitude, final double longitude) {
- sendLocation(latitude, longitude, null);
- }
-
- /**
- * Asynchronously update the mock location provider with given latitude and
- * longitude
- *
- * @param latitude - update location
- * @param longitude - update location
- * @param observer - optionally, object to notify when update is sent.If
- * null, no update will be sent
- */
- private void sendLocation(final double latitude, final double longitude,
- final Object observer) {
- Thread locationUpdater = new Thread() {
- @Override
- public void run() {
- Location loc = new Location(PROVIDER_NAME);
- loc.setLatitude(latitude);
- loc.setLongitude(longitude);
-
- loc.setTime(java.lang.System.currentTimeMillis());
- Log.d(LOG_TAG, "Sending update for " + PROVIDER_NAME);
- mLocationManager.setTestProviderLocation(PROVIDER_NAME, loc);
- if (observer != null) {
- synchronized (observer) {
- observer.notify();
- }
- }
- }
- };
- locationUpdater.start();
-
- }
-
- /**
- * Helper class that receives a proximity intent and notifies the main class
- * when received
- */
- private static class TestIntentReceiver extends BroadcastReceiver {
-
- private String mExpectedAction;
- private Intent mLastReceivedIntent;
-
- public TestIntentReceiver(String expectedAction) {
- mExpectedAction = expectedAction;
- mLastReceivedIntent = null;
- }
-
- public IntentFilter getFilter() {
- IntentFilter filter = new IntentFilter(mExpectedAction);
- return filter;
- }
-
- @Override
- public void onReceive(Context context, Intent intent) {
- if (intent != null && mExpectedAction.equals(intent.getAction())) {
- Log.d(LOG_TAG, "Intent Received: " + intent.toString());
- mLastReceivedIntent = intent;
- synchronized (this) {
- notify();
- }
- }
- }
-
- public Intent getLastReceivedIntent() {
- return mLastReceivedIntent;
- }
-
- public void clearReceivedIntents() {
- mLastReceivedIntent = null;
- }
- }
-}
diff --git a/tests/CoreTests/com/android/internal/telephony/TelephonyTests.java b/tests/CoreTests/com/android/internal/telephony/TelephonyTests.java
deleted file mode 100644
index fdfafe1..0000000
--- a/tests/CoreTests/com/android/internal/telephony/TelephonyTests.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-package com.android.internal.telephony;
-
-import com.android.internal.telephony.AdnRecordTest;
-import com.android.internal.telephony.gsm.GSMPhoneTest;
-import com.android.internal.telephony.GsmAlphabetTest;
-import com.android.internal.telephony.SMSDispatcherTest;
-import com.android.internal.telephony.SimPhoneBookTest;
-import com.android.internal.telephony.SimSmsTest;
-import com.android.internal.telephony.SimUtilsTest;
-
-import junit.framework.TestSuite;
-
-/**
- * To run these tests:
- * $ mmm java/tests && adb sync
- * $ adb shell am instrument -w \
- * -e class com.android.internal.telephony.TelephonyTests \
- * android.core/android.test.InstrumentationTestRunner
- */
-public class TelephonyTests {
- public static TestSuite suite() {
- TestSuite suite = new TestSuite(TelephonyTests.class.getName());
-
- suite.addTestSuite(PhoneNumberWatcherTest.class);
- suite.addTestSuite(ATResponseParserTest.class);
- suite.addTestSuite(PhoneNumberUtilsTest.class);
- suite.addTestSuite(SMSDispatcherTest.class);
- //suite.addTestSuite(GSMPhoneTest.class);
- suite.addTestSuite(AdnRecordTest.class);
- suite.addTestSuite(GsmAlphabetTest.class);
- suite.addTestSuite(SimUtilsTest.class);
- suite.addTestSuite(SimPhoneBookTest.class);
- suite.addTestSuite(SimSmsTest.class);
- suite.addTestSuite(TelephonyUtilsTest.class);
-
- return suite;
- }
-}
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/AllTests.java b/tests/FrameworkTest/tests/src/com/android/frameworktest/AllTests.java
deleted file mode 100644
index e43ebb8..0000000
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/AllTests.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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 com.android.frameworktest;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import android.test.suitebuilder.TestSuiteBuilder;
-
-public class AllTests extends TestSuite {
-
- public static Test suite() {
- return new TestSuiteBuilder(AllTests.class)
- .includeAllPackagesUnderHere()
- .includePackages("android.content")
- .includePackages("android.widget")
- .build();
- }
-
-}
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index c530dd4..d53c472 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -1854,10 +1854,16 @@
writeProguardForLayouts(ProguardKeepSet* keep, const sp<AaptAssets>& assets)
{
status_t err;
- sp<AaptDir> layout = assets->resDir(String8("layout"));
+ const Vector<sp<AaptDir> >& dirs = assets->resDirs();
+ const size_t K = dirs.size();
+ for (size_t k=0; k<K; k++) {
+ const sp<AaptDir>& d = dirs.itemAt(k);
+ const String8& dirName = d->getLeaf();
+ if ((dirName != String8("layout")) && (strncmp(dirName.string(), "layout-", 7) != 0)) {
+ continue;
+ }
- if (layout != NULL) {
- const KeyedVector<String8,sp<AaptGroup> > groups = layout->getFiles();
+ const KeyedVector<String8,sp<AaptGroup> > groups = d->getFiles();
const size_t N = groups.size();
for (size_t i=0; i<N; i++) {
const sp<AaptGroup>& group = groups.valueAt(i);