summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CleanSpec.mk2
-rw-r--r--core/java/android/accounts/AccountManager.java9
-rw-r--r--core/java/android/app/SearchDialog.java17
-rwxr-xr-xcore/java/android/speech/tts/ITts.aidl2
-rwxr-xr-xcore/java/android/speech/tts/TextToSpeech.java80
-rw-r--r--core/java/android/webkit/CookieManager.java12
-rw-r--r--core/java/com/android/internal/app/ShutdownThread.java13
-rw-r--r--core/java/com/android/internal/widget/LockPatternView.java52
-rw-r--r--core/res/res/layout/keyguard_screen_unlock_portrait.xml1
-rw-r--r--core/res/res/values-port-mdpi/donottranslate.xml23
-rw-r--r--core/res/res/values/attrs.xml13
-rw-r--r--core/res/res/values/donottranslate.xml2
-rw-r--r--core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java16
-rw-r--r--core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java58
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java3
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioManagerTest.java70
-rwxr-xr-xpackages/TtsService/src/android/tts/TtsService.java32
-rw-r--r--tests/FrameworkTest/Android.mk15
-rw-r--r--tests/FrameworkTest/AndroidManifest.xml54
-rw-r--r--tests/FrameworkTest/README8
-rw-r--r--tests/FrameworkTest/res/values/styles.xml22
-rw-r--r--tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java35
-rw-r--r--tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java65
-rw-r--r--tests/FrameworkTest/src/com/android/frameworktest/settings/RingtonePickerActivityLauncher.java79
-rw-r--r--tests/FrameworkTest/tests/Android.mk17
-rw-r--r--tests/FrameworkTest/tests/AndroidManifest.xml34
-rw-r--r--tests/FrameworkTest/tests/src/com/android/frameworktest/settings/RingtonePickerActivityTest.java227
27 files changed, 344 insertions, 617 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 417f764..707404b 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -50,6 +50,8 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framew
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/backup)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/app)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/FrameworkTest_intermediates/)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 15c8856..b0adaec 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -539,14 +539,15 @@ public class AccountManager {
* {@link android.Manifest.permission#MANAGE_ACCOUNTS} or
* {@link android.Manifest.permission#USE_CREDENTIALS}
*
- * @param accountType The account type of the auth token to invalidate
- * @param authToken The auth token to invalidate
+ * @param accountType The account type of the auth token to invalidate, must not be null
+ * @param authToken The auth token to invalidate, may be null
*/
public void invalidateAuthToken(final String accountType, final String authToken) {
if (accountType == null) throw new IllegalArgumentException("accountType is null");
- if (authToken == null) throw new IllegalArgumentException("authToken is null");
try {
- mService.invalidateAuthToken(accountType, authToken);
+ if (authToken != null) {
+ mService.invalidateAuthToken(accountType, authToken);
+ }
} catch (RemoteException e) {
// won't ever happen
throw new RuntimeException(e);
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 0ebe3ac..9d217ec 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -795,7 +795,9 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
SearchableInfo searchable = mSearchable;
try {
if (searchable.getVoiceSearchLaunchWebSearch()) {
- getContext().startActivity(mVoiceWebSearchIntent);
+ Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
+ searchable);
+ getContext().startActivity(webSearchIntent);
} else if (searchable.getVoiceSearchLaunchRecognizer()) {
Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
searchable);
@@ -811,6 +813,17 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
};
/**
+ * Create and return an Intent that can launch the voice search activity for web search.
+ */
+ private Intent createVoiceWebSearchIntent(Intent baseIntent, SearchableInfo searchable) {
+ Intent voiceIntent = new Intent(baseIntent);
+ ComponentName searchActivity = searchable.getSearchActivity();
+ voiceIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
+ searchActivity == null ? null : searchActivity.flattenToShortString());
+ return voiceIntent;
+ }
+
+ /**
* Create and return an Intent that can launch the voice search activity, perform a specific
* voice transcription, and forward the results to the searchable activity.
*
@@ -865,7 +878,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, language);
voiceIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, maxResults);
voiceIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
- searchActivity == null ? null : searchActivity.toShortString());
+ searchActivity == null ? null : searchActivity.flattenToShortString());
// Add the values that configure forwarding the results
voiceIntent.putExtra(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT, pending);
diff --git a/core/java/android/speech/tts/ITts.aidl b/core/java/android/speech/tts/ITts.aidl
index 2fd3672..c1051c4 100755
--- a/core/java/android/speech/tts/ITts.aidl
+++ b/core/java/android/speech/tts/ITts.aidl
@@ -43,7 +43,7 @@ interface ITts {
String[] getLanguage();
- int isLanguageAvailable(in String language, in String country, in String variant);
+ int isLanguageAvailable(in String language, in String country, in String variant, in String[] params);
int setLanguage(in String callingApp, in String language, in String country, in String variant);
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java
index eeb42c42..e7c6432 100755
--- a/core/java/android/speech/tts/TextToSpeech.java
+++ b/core/java/android/speech/tts/TextToSpeech.java
@@ -315,6 +315,10 @@ public class TextToSpeech {
*/
public static final String KEY_PARAM_ENGINE = "engine";
/**
+ * {@hide}
+ */
+ public static final String KEY_PARAM_PITCH = "pitch";
+ /**
* Parameter key to specify the audio stream type to be used when speaking text
* or playing back a file.
* @see TextToSpeech#speak(String, int, HashMap)
@@ -365,7 +369,12 @@ public class TextToSpeech {
/**
* {@hide}
*/
- protected static final int NB_CACHED_PARAMS = 7;
+ protected static final int PARAM_POSITION_PITCH = 14;
+
+ /**
+ * {@hide}
+ */
+ protected static final int NB_CACHED_PARAMS = 8;
}
/**
@@ -409,9 +418,10 @@ public class TextToSpeech {
mCachedParams[Engine.PARAM_POSITION_STREAM] = Engine.KEY_PARAM_STREAM;
mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID] = Engine.KEY_PARAM_UTTERANCE_ID;
mCachedParams[Engine.PARAM_POSITION_ENGINE] = Engine.KEY_PARAM_ENGINE;
+ mCachedParams[Engine.PARAM_POSITION_PITCH] = Engine.KEY_PARAM_PITCH;
- // Leave all defaults that are shown in Settings uninitialized so that
- // the values set in Settings will take effect if the application does
+ // Leave all defaults that are shown in Settings uninitialized/at the default
+ // so that the values set in Settings will take effect if the application does
// not try to change these settings itself.
mCachedParams[Engine.PARAM_POSITION_RATE + 1] = "";
mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1] = "";
@@ -421,6 +431,7 @@ public class TextToSpeech {
String.valueOf(Engine.DEFAULT_STREAM);
mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID + 1] = "";
mCachedParams[Engine.PARAM_POSITION_ENGINE + 1] = "";
+ mCachedParams[Engine.PARAM_POSITION_PITCH + 1] = "100";
initTts();
}
@@ -435,6 +446,9 @@ public class TextToSpeech {
synchronized(mStartLock) {
mITts = ITts.Stub.asInterface(service);
mStarted = true;
+ // Cache the default engine and current language
+ setEngineByPackageName(getDefaultEngine());
+ setLanguage(getLanguage());
if (mInitListener != null) {
// TODO manage failures and missing resources
mInitListener.onInit(SUCCESS);
@@ -1008,15 +1022,13 @@ public class TextToSpeech {
return result;
}
try {
+ // the pitch is not set here, instead it is cached so it will be associated
+ // with all upcoming utterances.
if (pitch > 0) {
- result = mITts.setPitch(mPackageName, (int)(pitch*100));
+ int p = (int)(pitch*100);
+ mCachedParams[Engine.PARAM_POSITION_PITCH + 1] = String.valueOf(p);
+ result = SUCCESS;
}
- } catch (RemoteException e) {
- // TTS died; restart it.
- Log.e("TextToSpeech.java - setPitch", "RemoteException");
- e.printStackTrace();
- mStarted = false;
- initTts();
} catch (NullPointerException e) {
// TTS died; restart it.
Log.e("TextToSpeech.java - setPitch", "NullPointerException");
@@ -1057,16 +1069,27 @@ public class TextToSpeech {
return result;
}
try {
- mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1] = loc.getISO3Language();
- mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1] = loc.getISO3Country();
- mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] = loc.getVariant();
- // the language is not set here, instead it is cached so it will be associated
- // with all upcoming utterances. But we still need to report the language support,
- // which is achieved by calling isLanguageAvailable()
- result = mITts.isLanguageAvailable(
- mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1],
- mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1],
- mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] );
+ String language = loc.getISO3Language();
+ String country = loc.getISO3Country();
+ String variant = loc.getVariant();
+ // Check if the language, country, variant are available, and cache
+ // the available parts.
+ // Note that the language is not actually set here, instead it is cached so it
+ // will be associated with all upcoming utterances.
+ result = mITts.isLanguageAvailable(language, country, variant, mCachedParams);
+ if (result >= LANG_AVAILABLE){
+ mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1] = language;
+ if (result >= LANG_COUNTRY_AVAILABLE){
+ mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1] = country;
+ } else {
+ mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1] = "";
+ }
+ if (result >= LANG_COUNTRY_VAR_AVAILABLE){
+ mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] = variant;
+ } else {
+ mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] = "";
+ }
+ }
} catch (RemoteException e) {
// TTS died; restart it.
Log.e("TextToSpeech.java - setLanguage", "RemoteException");
@@ -1104,11 +1127,18 @@ public class TextToSpeech {
return null;
}
try {
- String[] locStrings = mITts.getLanguage();
- if ((locStrings != null) && (locStrings.length == 3)) {
- return new Locale(locStrings[0], locStrings[1], locStrings[2]);
+ // Only do a call to the native synth if there is nothing in the cached params
+ if (mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1].length() < 1){
+ String[] locStrings = mITts.getLanguage();
+ if ((locStrings != null) && (locStrings.length == 3)) {
+ return new Locale(locStrings[0], locStrings[1], locStrings[2]);
+ } else {
+ return null;
+ }
} else {
- return null;
+ return new Locale(mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1],
+ mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1],
+ mCachedParams[Engine.PARAM_POSITION_VARIANT + 1]);
}
} catch (RemoteException e) {
// TTS died; restart it.
@@ -1151,7 +1181,7 @@ public class TextToSpeech {
}
try {
result = mITts.isLanguageAvailable(loc.getISO3Language(),
- loc.getISO3Country(), loc.getVariant());
+ loc.getISO3Country(), loc.getVariant(), mCachedParams);
} catch (RemoteException e) {
// TTS died; restart it.
Log.e("TextToSpeech.java - isLanguageAvailable", "RemoteException");
diff --git a/core/java/android/webkit/CookieManager.java b/core/java/android/webkit/CookieManager.java
index 74a648e..758a152 100644
--- a/core/java/android/webkit/CookieManager.java
+++ b/core/java/android/webkit/CookieManager.java
@@ -693,8 +693,17 @@ public final class CookieManager {
*/
private String[] getHostAndPath(WebAddress uri) {
if (uri.mHost != null && uri.mPath != null) {
+
+ /*
+ * The domain (i.e. host) portion of the cookie is supposed to be
+ * case-insensitive. We will consistently return the domain in lower
+ * case, which allows us to do the more efficient equals comparison
+ * instead of equalIgnoreCase.
+ *
+ * See: http://www.ieft.org/rfc/rfc2965.txt (Section 3.3.3)
+ */
String[] ret = new String[2];
- ret[0] = uri.mHost;
+ ret[0] = uri.mHost.toLowerCase();
ret[1] = uri.mPath;
int index = ret[0].indexOf(PERIOD);
@@ -728,6 +737,7 @@ public final class CookieManager {
if (index != -1) {
ret[1] = ret[1].substring(0, index);
}
+
return ret;
} else
return null;
diff --git a/core/java/com/android/internal/app/ShutdownThread.java b/core/java/com/android/internal/app/ShutdownThread.java
index 51cd0f8..83614a8 100644
--- a/core/java/com/android/internal/app/ShutdownThread.java
+++ b/core/java/com/android/internal/app/ShutdownThread.java
@@ -33,6 +33,7 @@ import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
+import android.os.Vibrator;
import android.os.storage.IMountService;
import android.os.storage.IMountShutdownObserver;
@@ -48,6 +49,9 @@ public final class ShutdownThread extends Thread {
// maximum time we wait for the shutdown broadcast before going on.
private static final int MAX_BROADCAST_TIME = 10*1000;
private static final int MAX_SHUTDOWN_WAIT_TIME = 20*1000;
+
+ // length of vibration before shutting down
+ private static final int SHUTDOWN_VIBRATE_MS = 500;
// state tracking
private static Object sIsStartedGuard = new Object();
@@ -324,6 +328,15 @@ public final class ShutdownThread extends Thread {
} catch (Exception e) {
Log.e(TAG, "Reboot failed, will attempt shutdown instead", e);
}
+ } else if (SHUTDOWN_VIBRATE_MS > 0) {
+ // vibrate before shutting down
+ Vibrator vibrator = new Vibrator();
+ vibrator.vibrate(SHUTDOWN_VIBRATE_MS);
+ // vibrator is asynchronous so we need to wait to avoid shutting down too soon.
+ try {
+ Thread.sleep(SHUTDOWN_VIBRATE_MS);
+ } catch (InterruptedException e) {
+ }
}
// Shutdown power
diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java
index 6adce6d..007e7b9 100644
--- a/core/java/com/android/internal/widget/LockPatternView.java
+++ b/core/java/com/android/internal/widget/LockPatternView.java
@@ -21,6 +21,7 @@ import com.android.internal.R;
import android.content.Context;
import android.content.res.Resources;
+import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@@ -50,6 +51,11 @@ import java.util.List;
* "correct" states.
*/
public class LockPatternView extends View {
+ // Aspect to use when rendering this view
+ private static final int ASPECT_SQUARE = 0; // View will be the minimum of width/height
+ private static final int ASPECT_LOCK_WIDTH = 1; // Fixed width; height will be minimum of (w,h)
+ private static final int ASPECT_LOCK_HEIGHT = 2; // Fixed height; width will be minimum of (w,h)
+
// Vibrator pattern for creating a tactile bump
private static final long[] DEFAULT_VIBE_PATTERN = {0, 1, 40, 41};
@@ -116,12 +122,14 @@ public class LockPatternView extends View {
private int mBitmapWidth;
private int mBitmapHeight;
-
+
private Vibrator vibe; // Vibrator for creating tactile feedback
private long[] mVibePattern;
+ private int mAspect;
+
/**
* Represents a cell in the 3 X 3 matrix of the unlock pattern view.
*/
@@ -237,6 +245,20 @@ public class LockPatternView extends View {
super(context, attrs);
vibe = new Vibrator();
+ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LockPatternView);
+
+ final String aspect = a.getString(R.styleable.LockPatternView_aspect);
+
+ if ("square".equals(aspect)) {
+ mAspect = ASPECT_SQUARE;
+ } else if ("lock_width".equals(aspect)) {
+ mAspect = ASPECT_LOCK_WIDTH;
+ } else if ("lock_height".equals(aspect)) {
+ mAspect = ASPECT_LOCK_HEIGHT;
+ } else {
+ mAspect = ASPECT_SQUARE;
+ }
+
setClickable(true);
mPathPaint.setAntiAlias(true);
@@ -425,8 +447,22 @@ public class LockPatternView extends View {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int width = MeasureSpec.getSize(widthMeasureSpec);
final int height = MeasureSpec.getSize(heightMeasureSpec);
- final int squareSide = Math.min(width, height);
- setMeasuredDimension(squareSide, squareSide);
+ int viewWidth = width;
+ int viewHeight = height;
+ switch (mAspect) {
+ case ASPECT_SQUARE:
+ viewWidth = viewHeight = Math.min(width, height);
+ break;
+ case ASPECT_LOCK_WIDTH:
+ viewWidth = width;
+ viewHeight = Math.min(width, height);
+ break;
+ case ASPECT_LOCK_HEIGHT:
+ viewWidth = Math.min(width, height);
+ viewHeight = height;
+ break;
+ }
+ setMeasuredDimension(viewWidth, viewHeight);
}
/**
@@ -890,17 +926,17 @@ public class LockPatternView extends View {
Matrix matrix = new Matrix();
final int cellWidth = mBitmapCircleDefault.getWidth();
final int cellHeight = mBitmapCircleDefault.getHeight();
-
+
// the up arrow bitmap is at 12:00, so find the rotation from x axis and add 90 degrees.
final float theta = (float) Math.atan2(
(double) (endRow - startRow), (double) (endColumn - startColumn));
- final float angle = (float) Math.toDegrees(theta) + 90.0f;
-
+ final float angle = (float) Math.toDegrees(theta) + 90.0f;
+
// compose matrix
matrix.setTranslate(leftX + offsetX, topY + offsetY); // transform to cell position
matrix.preRotate(angle, cellWidth / 2.0f, cellHeight / 2.0f); // rotate about cell center
matrix.preTranslate((cellWidth - arrow.getWidth()) / 2.0f, 0.0f); // translate to 12:00 pos
- canvas.drawBitmap(arrow, matrix, mPaint);
+ canvas.drawBitmap(arrow, matrix, mPaint);
}
/**
@@ -1004,7 +1040,7 @@ public class LockPatternView extends View {
mInStealthMode = (Boolean) in.readValue(null);
mTactileFeedbackEnabled = (Boolean) in.readValue(null);
}
-
+
public String getSerializedPattern() {
return mSerializedPattern;
}
diff --git a/core/res/res/layout/keyguard_screen_unlock_portrait.xml b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
index 97c4ae9..8dacfaf 100644
--- a/core/res/res/layout/keyguard_screen_unlock_portrait.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
@@ -154,6 +154,7 @@
android:layout_height="0dip"
android:layout_weight="1"
android:layout_marginTop="2dip"
+ android:aspect="@string/lock_pattern_view_aspect"
/>
<!-- footer -->
diff --git a/core/res/res/values-port-mdpi/donottranslate.xml b/core/res/res/values-port-mdpi/donottranslate.xml
new file mode 100644
index 0000000..b4581fe
--- /dev/null
+++ b/core/res/res/values-port-mdpi/donottranslate.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 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.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- @hide DO NOT TRANSLATE. There isn't enough room on mdpi devices, allow height to vary -->
+ <string name="lock_pattern_view_aspect">lock_width</string>
+</resources>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 16b241b..6d6c47f 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -3623,7 +3623,18 @@
<!-- Use "horizontal" for a row, "vertical" for a column. The default is horizontal. -->
<attr name="orientation" />
</declare-styleable>
-
+
+ <!-- =============================== -->
+ <!-- LockPatternView class attributes -->
+ <!-- =============================== -->
+ <eat-comment />
+
+ <declare-styleable name="LockPatternView">
+ <!-- Aspect to use when drawing LockPatternView. Choices are "square"(default), "lock_width"
+ or "lock_height" -->
+ <attr name="aspect" format="string" />
+ </declare-styleable>
+
<!-- Use <code>recognition-service</code> as the root tag of the XML resource that
describes a {@link android.speech.RecognitionService}, which is reference from
its {@link android.speech.RecognitionService#SERVICE_META_DATA} meta-data entry.
diff --git a/core/res/res/values/donottranslate.xml b/core/res/res/values/donottranslate.xml
index 78d4d36..d6d5dbb 100644
--- a/core/res/res/values/donottranslate.xml
+++ b/core/res/res/values/donottranslate.xml
@@ -22,4 +22,6 @@
<string name="default_text_encoding">Latin-1</string>
<!-- @hide DO NOT TRANSLATE. Workaround for resource race condition in lockscreen. -->
<bool name="lockscreen_isPortrait">true</bool>
+ <!-- @hide DO NOT TRANSLATE. Control aspect ratio of lock pattern -->
+ <string name="lock_pattern_view_aspect">square</string>
</resources>
diff --git a/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java
index ad99ee8..dfb10fb 100644
--- a/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java
+++ b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java
@@ -28,11 +28,11 @@ import android.widget.ExpandableListView;
import junit.framework.Assert;
public class ExpandableListTester {
- private ExpandableListView mExpandableListView;
- private ExpandableListAdapter mAdapter;
- private ListUtil mListUtil;
+ private final ExpandableListView mExpandableListView;
+ private final ExpandableListAdapter mAdapter;
+ private final ListUtil mListUtil;
- private ActivityInstrumentationTestCase2<? extends ExpandableListScenario>
+ private final ActivityInstrumentationTestCase2<? extends ExpandableListScenario>
mActivityInstrumentation;
Instrumentation mInstrumentation;
@@ -76,6 +76,8 @@ public class ExpandableListTester {
View headerChild = mExpandableListView.getChildAt(index
- mExpandableListView.getFirstVisiblePosition());
mExpandableListView.showContextMenuForChild(headerChild);
+ mInstrumentation.waitForIdleSync();
+ Assert.assertNull(menuListener.getErrorMessage(), menuListener.getErrorMessage());
index++;
}
@@ -92,6 +94,8 @@ public class ExpandableListTester {
View groupChild = mExpandableListView.getChildAt(index
- mExpandableListView.getFirstVisiblePosition());
mExpandableListView.showContextMenuForChild(groupChild);
+ mInstrumentation.waitForIdleSync();
+ Assert.assertNull(menuListener.getErrorMessage(), menuListener.getErrorMessage());
index++;
final int childrenCount = mAdapter.getChildrenCount(groupIndex);
@@ -102,6 +106,8 @@ public class ExpandableListTester {
View child = mExpandableListView.getChildAt(index
- mExpandableListView.getFirstVisiblePosition());
mExpandableListView.showContextMenuForChild(child);
+ mInstrumentation.waitForIdleSync();
+ Assert.assertNull(menuListener.getErrorMessage(), menuListener.getErrorMessage());
index++;
}
}
@@ -115,6 +121,8 @@ public class ExpandableListTester {
View footerChild = mExpandableListView.getChildAt(index
- mExpandableListView.getFirstVisiblePosition());
mExpandableListView.showContextMenuForChild(footerChild);
+ mInstrumentation.waitForIdleSync();
+ Assert.assertNull(menuListener.getErrorMessage(), menuListener.getErrorMessage());
index++;
}
diff --git a/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java b/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java
index b482005..2dbdff8 100644
--- a/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java
+++ b/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java
@@ -23,8 +23,6 @@ import android.view.View.OnCreateContextMenuListener;
import android.widget.ExpandableListView;
import android.widget.AdapterView.AdapterContextMenuInfo;
-import junit.framework.Assert;
-
public class PositionTesterContextMenuListener implements OnCreateContextMenuListener {
private int groupPosition, childPosition;
@@ -33,6 +31,9 @@ public class PositionTesterContextMenuListener implements OnCreateContextMenuLis
private static final int ADAPTER_TYPE = -1;
private int testType; // as returned by getPackedPositionType
+ // Will be set to null by each call to onCreateContextMenu, unless an error occurred.
+ private String errorMessage;
+
public void expectGroupContextMenu(int groupPosition) {
this.groupPosition = groupPosition;
testType = ExpandableListView.PACKED_POSITION_TYPE_GROUP;
@@ -50,30 +51,61 @@ public class PositionTesterContextMenuListener implements OnCreateContextMenuLis
}
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
+ errorMessage = null;
if (testType == ADAPTER_TYPE) {
- Assert.assertTrue("MenuInfo is not an AdapterContextMenuInfo",
- menuInfo instanceof AdapterContextMenuInfo);
+ if (!isTrue("MenuInfo is not an AdapterContextMenuInfo",
+ menuInfo instanceof AdapterContextMenuInfo)) {
+ return;
+ }
AdapterContextMenuInfo adapterContextMenuInfo = (AdapterContextMenuInfo) menuInfo;
- Assert.assertEquals("Wrong flat position",
- groupPosition,
- adapterContextMenuInfo.position);
+ if (!areEqual("Wrong flat position", groupPosition, adapterContextMenuInfo.position)) {
+ return;
+ }
} else {
- Assert.assertTrue("MenuInfo is not an ExpandableListContextMenuInfo",
- menuInfo instanceof ExpandableListView.ExpandableListContextMenuInfo);
+ if (!isTrue("MenuInfo is not an ExpandableListContextMenuInfo",
+ menuInfo instanceof ExpandableListView.ExpandableListContextMenuInfo)) {
+ return;
+ }
ExpandableListView.ExpandableListContextMenuInfo elvMenuInfo =
(ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
long packedPosition = elvMenuInfo.packedPosition;
int packedPositionType = ExpandableListView.getPackedPositionType(packedPosition);
- Assert.assertEquals("Wrong packed position type", testType, packedPositionType);
+ if (!areEqual("Wrong packed position type", testType, packedPositionType)) {
+ return;
+ }
int packedPositionGroup = ExpandableListView.getPackedPositionGroup(packedPosition);
- Assert.assertEquals("Wrong group position", groupPosition, packedPositionGroup);
+ if (!areEqual("Wrong group position", groupPosition, packedPositionGroup)) {
+ return;
+ }
if (testType == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
- int packedPosChild = ExpandableListView.getPackedPositionChild(packedPosition);
- Assert.assertEquals("Wrong child position", childPosition, packedPosChild);
+ int packedPositionChild = ExpandableListView.getPackedPositionChild(packedPosition);
+ if (!areEqual("Wrong child position", childPosition, packedPositionChild)) {
+ return;
+ }
}
}
}
+
+ private boolean areEqual(String message, int expected, int actual) {
+ if (expected != actual) {
+ errorMessage = String.format(message + " (%d vs %d", expected, actual);
+ return false;
+ }
+ return true;
+ }
+
+ private boolean isTrue(String message, boolean value) {
+ if (!value) {
+ errorMessage = message;
+ return false;
+ }
+ return true;
+ }
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
index 2a4e9a0..3e33951 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
@@ -24,7 +24,7 @@ import com.android.mediaframeworktest.functional.MediaPlayerApiTest;
import com.android.mediaframeworktest.functional.MediaRecorderTest;
import com.android.mediaframeworktest.functional.SimTonesTest;
import com.android.mediaframeworktest.functional.MediaPlayerInvokeTest;
-
+import com.android.mediaframeworktest.functional.MediaAudioManagerTest;
import junit.framework.TestSuite;
import android.test.InstrumentationTestRunner;
@@ -54,6 +54,7 @@ public class MediaFrameworkTestRunner extends InstrumentationTestRunner {
suite.addTestSuite(MediaAudioTrackTest.class);
suite.addTestSuite(MediaMimeTest.class);
suite.addTestSuite(MediaPlayerInvokeTest.class);
+ suite.addTestSuite(MediaAudioManagerTest.class);
return suite;
}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioManagerTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioManagerTest.java
new file mode 100644
index 0000000..644444a
--- /dev/null
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioManagerTest.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.mediaframeworktest.functional;
+
+import com.android.mediaframeworktest.MediaFrameworkTest;
+import android.content.Context;
+import android.media.AudioManager;
+import android.test.ActivityInstrumentationTestCase2;
+import android.test.suitebuilder.annotation.MediumTest;
+
+/**
+ * Junit / Instrumentation test case for the media AudioManager api
+ */
+
+public class MediaAudioManagerTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
+
+ private String TAG = "MediaAudioManagerTest";
+ private AudioManager mAudioManager;
+ private int[] ringtoneMode = {AudioManager.RINGER_MODE_NORMAL,
+ AudioManager.RINGER_MODE_SILENT, AudioManager.RINGER_MODE_VIBRATE};
+
+ public MediaAudioManagerTest() {
+ super("com.android.mediaframeworktest", MediaFrameworkTest.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mAudioManager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public boolean validateSetRingTone(int i) {
+ int getRingtone = mAudioManager.getRingerMode();
+ if (i != getRingtone)
+ return false;
+ else
+ return true;
+ }
+
+ // Test case 1: Simple test case to validate the set ringtone mode
+ @MediumTest
+ public void testSetRingtoneMode() throws Exception {
+ boolean result = false;
+
+ for (int i = 0; i < ringtoneMode.length; i++) {
+ mAudioManager.setRingerMode(ringtoneMode[i]);
+ result = validateSetRingTone(ringtoneMode[i]);
+ assertTrue("SetRingtoneMode : " + ringtoneMode[i], result);
+ }
+ }
+ } \ No newline at end of file
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java
index 530ca57..c977ba3 100755
--- a/packages/TtsService/src/android/tts/TtsService.java
+++ b/packages/TtsService/src/android/tts/TtsService.java
@@ -321,6 +321,10 @@ public class TtsService extends Service implements OnCompletionListener {
TextToSpeech.Engine.DEFAULT_RATE);
}
+ private int getDefaultPitch() {
+ // Pitch is not user settable; the default pitch is always 100.
+ return 100;
+ }
private String getDefaultLanguage() {
String defaultLang = android.provider.Settings.Secure.getString(mResolver,
@@ -786,6 +790,7 @@ public class TtsService extends Service implements OnCompletionListener {
String variant = "";
String speechRate = "";
String engine = "";
+ String pitch = "";
if (speechItem.mParams != null){
for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){
String param = speechItem.mParams.get(i);
@@ -809,6 +814,8 @@ public class TtsService extends Service implements OnCompletionListener {
}
} else if (param.equals(TextToSpeech.Engine.KEY_PARAM_ENGINE)) {
engine = speechItem.mParams.get(i + 1);
+ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_PITCH)) {
+ pitch = speechItem.mParams.get(i + 1);
}
}
}
@@ -831,6 +838,11 @@ public class TtsService extends Service implements OnCompletionListener {
} else {
setSpeechRate("", getDefaultRate());
}
+ if (pitch.length() > 0){
+ setPitch("", Integer.parseInt(pitch));
+ } else {
+ setPitch("", getDefaultPitch());
+ }
try {
sNativeSynth.speak(speechItem.mText, streamType);
} catch (NullPointerException e) {
@@ -885,6 +897,7 @@ public class TtsService extends Service implements OnCompletionListener {
String variant = "";
String speechRate = "";
String engine = "";
+ String pitch = "";
if (speechItem.mParams != null){
for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){
String param = speechItem.mParams.get(i);
@@ -901,6 +914,8 @@ public class TtsService extends Service implements OnCompletionListener {
utteranceId = speechItem.mParams.get(i+1);
} else if (param.equals(TextToSpeech.Engine.KEY_PARAM_ENGINE)) {
engine = speechItem.mParams.get(i + 1);
+ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_PITCH)) {
+ pitch = speechItem.mParams.get(i + 1);
}
}
}
@@ -923,6 +938,11 @@ public class TtsService extends Service implements OnCompletionListener {
} else {
setSpeechRate("", getDefaultRate());
}
+ if (pitch.length() > 0){
+ setPitch("", Integer.parseInt(pitch));
+ } else {
+ setPitch("", getDefaultPitch());
+ }
try {
sNativeSynth.synthesizeToFile(speechItem.mText, speechItem.mFilename);
} catch (NullPointerException e) {
@@ -1377,7 +1397,17 @@ public class TtsService extends Service implements OnCompletionListener {
* TTS_LANG_COUNTRY_AVAILABLE, TTS_LANG_COUNTRY_VAR_AVAILABLE as defined in
* android.speech.tts.TextToSpeech.
*/
- public int isLanguageAvailable(String lang, String country, String variant) {
+ public int isLanguageAvailable(String lang, String country, String variant,
+ String[] params) {
+ for (int i = 0; i < params.length - 1; i = i + 2){
+ String param = params[i];
+ if (param != null) {
+ if (param.equals(TextToSpeech.Engine.KEY_PARAM_ENGINE)) {
+ mSelf.setEngine(params[i + 1]);
+ break;
+ }
+ }
+ }
return mSelf.isLanguageAvailable(lang, country, variant);
}
diff --git a/tests/FrameworkTest/Android.mk b/tests/FrameworkTest/Android.mk
deleted file mode 100644
index 61cdbfa..0000000
--- a/tests/FrameworkTest/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
-LOCAL_PACKAGE_NAME := FrameworkTest
-
-include $(BUILD_PACKAGE)
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/FrameworkTest/AndroidManifest.xml b/tests/FrameworkTest/AndroidManifest.xml
deleted file mode 100644
index 4db8952..0000000
--- a/tests/FrameworkTest/AndroidManifest.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?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.frameworktest">
-
- <uses-permission android:name="android.permission.READ_CONTACTS" />
- <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=".FrameworkTestApplication" android:label="FrameworkTestApplication">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
-
- <activity android:name=".performance.InvalidateCycle" android:label="InvalidateCycle">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
- <activity android:name=".settings.RingtonePickerActivityLauncher" android:label="RingtonePickerActivityLauncher">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-
-
- </application>
-
-</manifest>
diff --git a/tests/FrameworkTest/README b/tests/FrameworkTest/README
deleted file mode 100644
index d6d0042..0000000
--- a/tests/FrameworkTest/README
+++ /dev/null
@@ -1,8 +0,0 @@
-FrameworkTestApplication should hold snippets of functionality that are
-helpful for testing the UI framework code, but not appropriate for
-sample code. For instance, a layout contrived to exercise an edge case
-of scrolling behavior.
-
-InstrumentationTestCases should be added under tests and added to the
-list of tests in FrameworkInstrumentationTestRunner.
-
diff --git a/tests/FrameworkTest/res/values/styles.xml b/tests/FrameworkTest/res/values/styles.xml
deleted file mode 100644
index 7a90197..0000000
--- a/tests/FrameworkTest/res/values/styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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/FrameworkTestApplication.java b/tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java
deleted file mode 100644
index c57b997..0000000
--- a/tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.frameworktest;
-
-import android.app.LauncherActivity;
-import android.content.Intent;
-
-/**
- * Holds little snippets of functionality used as code under test for
- * instrumentation tests of framework code.
- */
-public class FrameworkTestApplication extends LauncherActivity {
-
- protected Intent getTargetIntent() {
- // TODO: partition into categories by label like the sample code app
- Intent targetIntent = new Intent(Intent.ACTION_MAIN, null);
- targetIntent.addCategory(Intent.CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST);
- targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- return targetIntent;
- }
-}
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java b/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java
deleted file mode 100644
index 22bb46f..0000000
--- a/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.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 com.android.frameworktest.performance;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.os.Debug;
-import android.os.Handler;
-import android.view.View;
-import android.view.ViewGroup;
-import android.content.Context;
-import android.graphics.Canvas;
-
-public class InvalidateCycle extends Activity {
- private boolean mStartProfiling;
- private InvalidateCycle.AutoInvalidateView mView;
-
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- mView = new AutoInvalidateView(this);
- mView.setLayoutParams(new ViewGroup.LayoutParams(16, 16));
- setContentView(mView);
-
- new Handler().postDelayed(new Runnable() {
- public void run() {
- mStartProfiling = true;
- android.util.Log.d("Performance", "Profiling started");
- Debug.startMethodTracing("invalidateCycle");
- mView.invalidate();
- }
- }, 15000);
- }
-
- private class AutoInvalidateView extends View {
- private boolean mFirstDraw;
-
- public AutoInvalidateView(Context context) {
- super(context);
- }
-
- protected void onDraw(Canvas canvas) {
- if (mStartProfiling && !mFirstDraw) {
- Debug.stopMethodTracing();
- android.util.Log.d("Performance", "Profiling ended");
- mFirstDraw = true;
- }
- canvas.drawColor(0xFFFF0000);
- }
- }
-}
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/settings/RingtonePickerActivityLauncher.java b/tests/FrameworkTest/src/com/android/frameworktest/settings/RingtonePickerActivityLauncher.java
deleted file mode 100644
index 19113da..0000000
--- a/tests/FrameworkTest/src/com/android/frameworktest/settings/RingtonePickerActivityLauncher.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.frameworktest.settings;
-
-import com.android.internal.app.RingtonePickerActivity;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.os.Bundle;
-
-/**
- * Activity that will launch the RingtonePickerActivity as a subactivity, and
- * waits for its result.
- */
-public class RingtonePickerActivityLauncher extends Activity {
-
- private static final String TAG = "RingtonePickerActivityLauncher";
-
- public boolean resultReceived = false;
-
- public int resultCode;
- public Intent result;
-
- public Uri pickedUri;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setContentView(android.R.layout.simple_list_item_1);
- }
-
- /**
- * Launches the {@link RingtonePickerActivity} and blocks until it returns.
- *
- * @param showDefault {@link RingtonePickerActivity#EXTRA_SHOW_DEFAULT}
- * @param existingUri {@link RingtonePickerActivity#EXTRA_EXISTING_URI}
- * @param filterColumns {@link RingtonePickerActivity#EXTRA_RINGTONE_COLUMNS}
- */
- public void launchRingtonePickerActivity(boolean showDefault, Uri existingUri,
- int types) {
- Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
- intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, showDefault);
- intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, existingUri);
- intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, types);
- startActivityForResult(intent, 0);
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
-
- resultReceived = true;
-
- this.resultCode = resultCode;
- this.result = data;
-
- if (data != null) {
- this.pickedUri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
- }
- }
-
-}
diff --git a/tests/FrameworkTest/tests/Android.mk b/tests/FrameworkTest/tests/Android.mk
deleted file mode 100644
index 5c54684..0000000
--- a/tests/FrameworkTest/tests/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-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-subdir-java-files)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
-LOCAL_PACKAGE_NAME := FrameworkTestTests
-
-LOCAL_INSTRUMENTATION_FOR := FrameworkTest
-
-include $(BUILD_PACKAGE)
-
diff --git a/tests/FrameworkTest/tests/AndroidManifest.xml b/tests/FrameworkTest/tests/AndroidManifest.xml
deleted file mode 100644
index 65aaebb..0000000
--- a/tests/FrameworkTest/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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 name must be unique so suffix with "tests" so package loader doesn't ignore us -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.frameworktest.tests">
-
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <!--
- This declares that this app uses the instrumentation test runner targeting
- the package of com.android.frameworktest. To run the tests use the command:
- "adb shell am instrument -w com.android.frameworktest.tests/android.test.InstrumentationTestRunner"
- -->
- <instrumentation android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="com.android.frameworktest"
- android:label="framework tests"/>
-
-</manifest>
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/settings/RingtonePickerActivityTest.java b/tests/FrameworkTest/tests/src/com/android/frameworktest/settings/RingtonePickerActivityTest.java
deleted file mode 100644
index 42888ff..0000000
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/settings/RingtonePickerActivityTest.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.frameworktest.settings;
-
-import com.android.frameworktest.settings.RingtonePickerActivityLauncher;
-
-import android.app.Instrumentation;
-import android.database.Cursor;
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.provider.MediaStore;
-import android.test.ActivityInstrumentationTestCase;
-import android.test.suitebuilder.annotation.Suppress;
-import android.view.KeyEvent;
-
-/**
- * Tests the RingtonePickerActivity.
- * <p>
- * There is a launcher for launching the RingtonePickerActivity (RPA) since the RPA needs
- * to be a subactivity. We don't have a reference to the actual RPA.
- * <p>
- * This relies heavily on keypresses getting to the right widget. It depends on:
- * <li> Less than NUM_RINGTONES_AND_SOME ringtones on the system
- * <li> Pressing arrow-down a ton will eventually end up on the 'Cancel' button
- * <li> From the 'Cancel' button, pressing arrow-left will end up on 'OK' button
- */
-@Suppress
-public class RingtonePickerActivityTest extends ActivityInstrumentationTestCase<RingtonePickerActivityLauncher> {
-
- private static final int NUM_RINGTONES_AND_SOME = 20;
- private RingtonePickerActivityLauncher mActivity;
- private Instrumentation mInstrumentation;
-
- public RingtonePickerActivityTest() {
- super("com.android.frameworktest", RingtonePickerActivityLauncher.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- mActivity = getActivity();
- mInstrumentation = getInstrumentation();
- assertNotNull(mActivity);
- assertFalse(mActivity.resultReceived);
- assertNotNull(mInstrumentation);
- }
-
- public void testDefault() {
- mActivity.launchRingtonePickerActivity(true, null, RingtoneManager.TYPE_ALL);
- mInstrumentation.waitForIdleSync();
-
- // Go to top
- goTo(true);
- // Select default ringtone
- sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
- // Go to bottom/cancel button
- goTo(false);
- // Select OK button
- sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER);
-
- mInstrumentation.waitForIdleSync();
-
- assertTrue(mActivity.resultReceived);
- assertNotNull(mActivity.result);
- assertTrue(RingtoneManager.isDefault(mActivity.pickedUri));
- }
-
- public void testFirst() {
- mActivity.launchRingtonePickerActivity(true, null, RingtoneManager.TYPE_ALL);
- mInstrumentation.waitForIdleSync();
-
- // Go to top
- goTo(true);
- // Select first (non-default) ringtone
- sendKeys(KeyEvent.KEYCODE_DPAD_DOWN, KeyEvent.KEYCODE_DPAD_CENTER);
- // Go to bottom/cancel button
- goTo(false);
- // Select OK button
- sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER);
-
- mInstrumentation.waitForIdleSync();
-
- assertTrue(mActivity.resultReceived);
- assertNotNull(mActivity.result);
- assertNotNull(mActivity.pickedUri);
- assertFalse(RingtoneManager.isDefault(mActivity.pickedUri));
- }
-
- public void testExisting() {
- // We need to get an existing ringtone first, so launch it, pick first,
- // and keep that URI
- testFirst();
- Uri firstUri = mActivity.pickedUri;
-
- mActivity.launchRingtonePickerActivity(true, firstUri, RingtoneManager.TYPE_ALL);
- mInstrumentation.waitForIdleSync();
-
- //// Hit cancel:
-
- // Go to bottom
- goTo(false);
- // Select Cancel button
- sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
-
- mInstrumentation.waitForIdleSync();
-
- assertTrue(mActivity.resultReceived);
- assertEquals(mActivity.pickedUri, firstUri);
- }
-
- public void testExistingButDifferent() {
- // We need to get an existing ringtone first, so launch it, pick first,
- // and keep that URI
- testFirst();
- Uri firstUri = mActivity.pickedUri;
-
- mActivity.launchRingtonePickerActivity(true, firstUri, RingtoneManager.TYPE_ALL);
- mInstrumentation.waitForIdleSync();
-
- //// Pick second:
-
- // Go to top
- goTo(true);
- // Select second (non-default) ringtone
- sendKeys(KeyEvent.KEYCODE_DPAD_DOWN, KeyEvent.KEYCODE_DPAD_DOWN,
- KeyEvent.KEYCODE_DPAD_CENTER);
- // Go to bottom/cancel button
- goTo(false);
- // Select OK button
- sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER);
-
- mInstrumentation.waitForIdleSync();
-
- assertTrue(mActivity.resultReceived);
- assertNotNull(mActivity.result);
- assertTrue(!firstUri.equals(mActivity.pickedUri));
- }
-
- public void testCancel() {
- mActivity.launchRingtonePickerActivity(true, null, RingtoneManager.TYPE_ALL);
- mInstrumentation.waitForIdleSync();
-
- // Go to bottom
- goTo(false);
- // Select Cancel button
- sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
-
- mInstrumentation.waitForIdleSync();
-
- assertTrue(mActivity.resultReceived);
- assertNull(mActivity.result);
- }
-
- public void testNoDefault() {
- mActivity.launchRingtonePickerActivity(false, null, RingtoneManager.TYPE_ALL);
- mInstrumentation.waitForIdleSync();
-
- // Go to top
- goTo(true);
- // Select first (non-default) ringtone
- sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
- // Go to bottom/cancel button
- goTo(false);
- // Select OK button
- sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER);
-
- mInstrumentation.waitForIdleSync();
-
- assertTrue(mActivity.resultReceived);
- assertNotNull(mActivity.result);
- assertNotNull(mActivity.pickedUri);
- assertFalse(RingtoneManager.isDefault(mActivity.pickedUri));
- }
-
- public void testNotifications() {
- mActivity.launchRingtonePickerActivity(false, null, RingtoneManager.TYPE_NOTIFICATION);
- mInstrumentation.waitForIdleSync();
-
- // Move to top of list
- goTo(true);
- // Select first ringtone in list
- sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
- // Move all the way down (will focus 'Cancel')
- goTo(false);
- // Move left and click (will click 'Ok')
- sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER);
-
- // Wait until main thread is idle
- mInstrumentation.waitForIdleSync();
-
- assertTrue(mActivity.resultReceived);
- assertNotNull(mActivity.result);
- assertNotNull(mActivity.pickedUri);
-
- // Get the path of the picked ringtone
- Uri uri = mActivity.pickedUri;
- Cursor c = mActivity.getContentResolver().query(uri, new String[] { "_data" },
- null, null, null);
- assertTrue("Query for selected ringtone URI does not have a result", c.moveToFirst());
- String path = c.getString(0);
- // Quick check to see if the ringtone is a notification
- assertTrue("The path of the selected ringtone did not contain \"notification\"",
- path.contains("notifications"));
- }
-
- private void goTo(boolean top) {
- // Get to the buttons at the bottom (top == false), or the top (top == true)
- for (int i = 0; i < NUM_RINGTONES_AND_SOME; i++) {
- sendKeys(top ? KeyEvent.KEYCODE_DPAD_UP : KeyEvent.KEYCODE_DPAD_DOWN);
- }
- }
-}