Merge branch 'froyo' into froyo-release
This commit is contained in:
@@ -3332,6 +3332,14 @@ public final class Settings {
|
||||
*/
|
||||
public static final String THROTTLE_HELP_URI = "throttle_help_uri";
|
||||
|
||||
/**
|
||||
* The length of time in Sec that we allow our notion of NTP time
|
||||
* to be cached before we refresh it
|
||||
* @hide
|
||||
*/
|
||||
public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC =
|
||||
"throttle_max_ntp_cache_age_sec";
|
||||
|
||||
|
||||
/**
|
||||
* @hide
|
||||
|
||||
@@ -2645,7 +2645,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
mScrollDuration);
|
||||
|
||||
mLastSeenPos = lastPos;
|
||||
if (lastPos != mTargetPos) {
|
||||
if (lastPos < mTargetPos) {
|
||||
post(this);
|
||||
}
|
||||
break;
|
||||
@@ -2671,7 +2671,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
final int nextViewHeight = nextView.getHeight();
|
||||
final int nextViewTop = nextView.getTop();
|
||||
final int extraScroll = mExtraScroll;
|
||||
if (nextPos != mBoundPos) {
|
||||
if (nextPos < mBoundPos) {
|
||||
smoothScrollBy(Math.max(0, nextViewHeight + nextViewTop - extraScroll),
|
||||
mScrollDuration);
|
||||
|
||||
@@ -2704,7 +2704,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
|
||||
mLastSeenPos = firstPos;
|
||||
|
||||
if (firstPos != mTargetPos) {
|
||||
if (firstPos > mTargetPos) {
|
||||
post(this);
|
||||
}
|
||||
break;
|
||||
@@ -2728,7 +2728,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
final int lastViewTop = lastView.getTop();
|
||||
final int lastViewPixelsShowing = listHeight - lastViewTop;
|
||||
mLastSeenPos = lastPos;
|
||||
if (lastPos != mBoundPos) {
|
||||
if (lastPos > mBoundPos) {
|
||||
smoothScrollBy(-(lastViewPixelsShowing - mExtraScroll), mScrollDuration);
|
||||
post(this);
|
||||
} else {
|
||||
|
||||
@@ -14,9 +14,8 @@ home=true
|
||||
<img src="{@docRoot}images/home/io-logo.png" alt="Google IO
|
||||
2010" width="200" height="41" style="padding:22px 12px;"/>
|
||||
<div id="announcement" style="width:295px">
|
||||
<p>Google I/O is happening now! To those of you with us, welcome! If you couldn't make it to the
|
||||
event, stay tuned for videos and slides from the Android sessions, which will be posted at the
|
||||
Google I/O web site.</p><p><a
|
||||
<p>Thanks to everyone who visited us at Google I/O in San Francisco! Stay tuned for
|
||||
videos and slides from the Android sessions, which will be posted at the Google I/O web site.</p><p><a
|
||||
href="http://code.google.com/events/io/2010/sessions.html#Android">Learn more »</a></p>
|
||||
</div> <!-- end annoucement -->
|
||||
</div> <!-- end annoucement-block -->
|
||||
|
||||
@@ -299,7 +299,7 @@ programmatically-constructed example:</p>
|
||||
|
||||
<pre><?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@id+/textview"
|
||||
android:id="@+id/textview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:text="@string/hello"/></pre>
|
||||
@@ -410,7 +410,7 @@ the following XML:
|
||||
|
||||
<pre><?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@id+/textview"
|
||||
android:id="@+id/textview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:text="@string/hello"/></pre>
|
||||
|
||||
@@ -95,7 +95,7 @@ padding: .25em 1em;
|
||||
<div class="toggleable opened">
|
||||
<a href="#" onclick="return toggleDiv(this)">
|
||||
<img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-img" height="9px" width="9px" />
|
||||
ADT 0.9.6</a> <em>(March 2010)</em>
|
||||
ADT 0.9.7</a> <em>(May 2010)</em>
|
||||
<div class="toggleme">
|
||||
|
||||
<dl>
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.mediaframeworktest;
|
||||
|
||||
import android.media.MediaRecorder;
|
||||
import android.os.Bundle;
|
||||
import android.test.InstrumentationTestRunner;
|
||||
import android.test.InstrumentationTestSuite;
|
||||
import com.android.mediaframeworktest.stress.MediaRecorderStressTest;
|
||||
@@ -25,6 +27,17 @@ import junit.framework.TestSuite;
|
||||
|
||||
public class MediaRecorderStressTestRunner extends InstrumentationTestRunner {
|
||||
|
||||
// Default recorder settings
|
||||
public static int mIterations = 100;
|
||||
public static int mVideoEncoder = MediaRecorder.VideoEncoder.H263;
|
||||
public static int mAudioEncdoer = MediaRecorder.AudioEncoder.AMR_NB;
|
||||
public static int mFrameRate = 20;
|
||||
public static int mVideoWidth = 352;
|
||||
public static int mVideoHeight = 288;
|
||||
public static int mBitRate = 100;
|
||||
public static boolean mRemoveVideo = true;
|
||||
public static int mDuration = 10000;
|
||||
|
||||
@Override
|
||||
public TestSuite getAllTests() {
|
||||
TestSuite suite = new InstrumentationTestSuite(this);
|
||||
@@ -37,4 +50,50 @@ public class MediaRecorderStressTestRunner extends InstrumentationTestRunner {
|
||||
public ClassLoader getLoader() {
|
||||
return MediaRecorderStressTestRunner.class.getClassLoader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
String iterations = (String) icicle.get("iterations");
|
||||
String video_encoder = (String) icicle.get("video_encoder");
|
||||
String audio_encoder = (String) icicle.get("audio_encoder");
|
||||
String frame_rate = (String) icicle.get("frame_rate");
|
||||
String video_width = (String) icicle.get("video_width");
|
||||
String video_height = (String) icicle.get("video_height");
|
||||
String bit_rate = (String) icicle.get("bit_rate");
|
||||
String record_duration = (String) icicle.get("record_duration");
|
||||
String remove_videos = (String) icicle.get("remove_videos");
|
||||
|
||||
if (iterations != null ) {
|
||||
mIterations = Integer.parseInt(iterations);
|
||||
}
|
||||
if ( video_encoder != null) {
|
||||
mVideoEncoder = Integer.parseInt(video_encoder);
|
||||
}
|
||||
if ( audio_encoder != null) {
|
||||
mAudioEncdoer = Integer.parseInt(audio_encoder);
|
||||
}
|
||||
if (frame_rate != null) {
|
||||
mFrameRate = Integer.parseInt(frame_rate);
|
||||
}
|
||||
if (video_width != null) {
|
||||
mVideoWidth = Integer.parseInt(video_width);
|
||||
}
|
||||
if (video_height != null) {
|
||||
mVideoHeight = Integer.parseInt(video_height);
|
||||
}
|
||||
if (bit_rate != null) {
|
||||
mBitRate = Integer.parseInt(bit_rate);
|
||||
}
|
||||
if (record_duration != null) {
|
||||
mDuration = Integer.parseInt(record_duration);
|
||||
}
|
||||
if (remove_videos != null) {
|
||||
if (remove_videos.compareTo("true") == 0) {
|
||||
mRemoveVideo = true;
|
||||
} else {
|
||||
mRemoveVideo = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,18 +237,20 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase<Medi
|
||||
}
|
||||
|
||||
public void stressCameraPreview() {
|
||||
try {
|
||||
initializeMessageLooper();
|
||||
mCamera.setPreviewCallback(mRawPreviewCallback);
|
||||
mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
|
||||
mCamera.setPreviewDisplay(mSurfaceHolder);
|
||||
mCamera.startPreview();
|
||||
waitForPreviewDone();
|
||||
Thread.sleep(1000);
|
||||
mCamera.stopPreview();
|
||||
terminateMessageLooper();
|
||||
} catch (Exception e) {
|
||||
Log.v(TAG, e.toString());
|
||||
for (int i = 0; i < NUM_PLAYBACk_IN_EACH_LOOP; i++) {
|
||||
try {
|
||||
initializeMessageLooper();
|
||||
mCamera.setPreviewCallback(mRawPreviewCallback);
|
||||
mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
|
||||
mCamera.setPreviewDisplay(mSurfaceHolder);
|
||||
mCamera.startPreview();
|
||||
waitForPreviewDone();
|
||||
Thread.sleep(1000);
|
||||
mCamera.stopPreview();
|
||||
terminateMessageLooper();
|
||||
} catch (Exception e) {
|
||||
Log.v(TAG, e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.test.ActivityInstrumentationTestCase2;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
import com.android.mediaframeworktest.MediaRecorderStressTestRunner;
|
||||
|
||||
/**
|
||||
* Junit / Instrumentation test case for the media player api
|
||||
@@ -310,20 +311,51 @@ public class MediaRecorderStressTest extends ActivityInstrumentationTestCase2<Me
|
||||
output.close();
|
||||
}
|
||||
|
||||
public void validateRecordedVideo(String recorded_file) {
|
||||
try {
|
||||
MediaPlayer mp = new MediaPlayer();
|
||||
mp.setDataSource(recorded_file);
|
||||
mp.prepare();
|
||||
int duration = mp.getDuration();
|
||||
if (duration <= 0){
|
||||
assertTrue("stressRecordAndPlayback", false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
assertTrue("stressRecordAndPlayback", false);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeRecodedVideo(String filename){
|
||||
File video = new File(filename);
|
||||
Log.v(TAG, "remove recorded video " + filename);
|
||||
video.delete();
|
||||
}
|
||||
|
||||
//Stress test case for record a video and play right away.
|
||||
@LargeTest
|
||||
public void testStressRecordVideoAndPlayback() throws Exception {
|
||||
int iterations = MediaRecorderStressTestRunner.mIterations;
|
||||
int video_encoder = MediaRecorderStressTestRunner.mVideoEncoder;
|
||||
int audio_encoder = MediaRecorderStressTestRunner.mAudioEncdoer;
|
||||
int frame_rate = MediaRecorderStressTestRunner.mFrameRate;
|
||||
int video_width = MediaRecorderStressTestRunner.mVideoWidth;
|
||||
int video_height = MediaRecorderStressTestRunner.mVideoHeight;
|
||||
int bit_rate = MediaRecorderStressTestRunner.mBitRate;
|
||||
boolean remove_video = MediaRecorderStressTestRunner.mRemoveVideo;
|
||||
int record_duration = MediaRecorderStressTestRunner.mDuration;
|
||||
|
||||
String filename;
|
||||
SurfaceHolder mSurfaceHolder;
|
||||
mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
|
||||
File stressOutFile = new File(MEDIA_STRESS_OUTPUT);
|
||||
Writer output = new BufferedWriter(new FileWriter(stressOutFile, true));
|
||||
Writer output = new BufferedWriter(
|
||||
new FileWriter(stressOutFile, true));
|
||||
output.write("Video record and play back stress test:\n");
|
||||
output.write("Total number of loops:"
|
||||
+ NUMBER_OF_RECORDERANDPLAY_STRESS_LOOPS + "\n");
|
||||
try {
|
||||
output.write("No of loop: ");
|
||||
for (int i = 0; i < NUMBER_OF_RECORDERANDPLAY_STRESS_LOOPS; i++){
|
||||
for (int i = 0; i < iterations; i++){
|
||||
filename = OUTPUT_FILE + i + OUTPUT_FILE_EXT;
|
||||
Log.v(TAG, filename);
|
||||
synchronized (recorderlock) {
|
||||
@@ -334,20 +366,29 @@ public class MediaRecorderStressTest extends ActivityInstrumentationTestCase2<Me
|
||||
Log.v(TAG, "wait was interrupted.");
|
||||
}
|
||||
}
|
||||
Log.v(TAG, "iterations : " + iterations);
|
||||
Log.v(TAG, "video_encoder : " + video_encoder);
|
||||
Log.v(TAG, "audio_encoder : " + audio_encoder);
|
||||
Log.v(TAG, "frame_rate : " + frame_rate);
|
||||
Log.v(TAG, "video_width : " + video_width);
|
||||
Log.v(TAG, "video_height : " + video_height);
|
||||
Log.v(TAG, "bit rate : " + bit_rate);
|
||||
Log.v(TAG, "record_duration : " + record_duration);
|
||||
|
||||
mRecorder.setOnErrorListener(mRecorderErrorCallback);
|
||||
mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
|
||||
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
|
||||
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
|
||||
mRecorder.setOutputFile(filename);
|
||||
mRecorder.setVideoFrameRate(20);
|
||||
mRecorder.setVideoSize(352,288);
|
||||
mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
|
||||
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
|
||||
mRecorder.setVideoFrameRate(frame_rate);
|
||||
mRecorder.setVideoSize(video_width, video_height);
|
||||
mRecorder.setVideoEncoder(video_encoder);
|
||||
mRecorder.setAudioEncoder(audio_encoder);
|
||||
Log.v(TAG, "mediaRecorder setPreview");
|
||||
mRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
|
||||
mRecorder.prepare();
|
||||
mRecorder.start();
|
||||
Thread.sleep(WAIT_TIME_RECORD);
|
||||
Thread.sleep(record_duration);
|
||||
Log.v(TAG, "Before stop");
|
||||
mRecorder.stop();
|
||||
terminateRecorderMessageLooper();
|
||||
@@ -357,8 +398,12 @@ public class MediaRecorderStressTest extends ActivityInstrumentationTestCase2<Me
|
||||
mp.setDisplay(MediaFrameworkTest.mSurfaceView.getHolder());
|
||||
mp.prepare();
|
||||
mp.start();
|
||||
Thread.sleep(WAIT_TIME_PLAYBACK);
|
||||
Thread.sleep(record_duration);
|
||||
mp.release();
|
||||
validateRecordedVideo(filename);
|
||||
if (remove_video) {
|
||||
removeRecodedVideo(filename);
|
||||
}
|
||||
output.write(", " + i);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -197,6 +197,8 @@ public class ThrottleService extends IThrottleManager.Stub {
|
||||
Settings.Secure.THROTTLE_NOTIFICATION_TYPE), false, this);
|
||||
resolver.registerContentObserver(Settings.Secure.getUriFor(
|
||||
Settings.Secure.THROTTLE_HELP_URI), false, this);
|
||||
resolver.registerContentObserver(Settings.Secure.getUriFor(
|
||||
Settings.Secure.THROTTLE_MAX_NTP_CACHE_AGE_SEC), false, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -432,10 +434,13 @@ public class ThrottleService extends IThrottleManager.Stub {
|
||||
mPolicyNotificationsAllowedMask = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.THROTTLE_NOTIFICATION_TYPE, defaultNotificationType);
|
||||
|
||||
mMaxNtpCacheAgeSec = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.THROTTLE_MAX_NTP_CACHE_AGE_SEC, MAX_NTP_CACHE_AGE_SEC);
|
||||
|
||||
Slog.d(TAG, "onPolicyChanged testing=" + testing +", period=" + mPolicyPollPeriodSec +
|
||||
", threshold=" + mPolicyThreshold + ", value=" + mPolicyThrottleValue +
|
||||
", resetDay=" + mPolicyResetDay + ", noteType=" +
|
||||
mPolicyNotificationsAllowedMask);
|
||||
mPolicyNotificationsAllowedMask + ", maxNtpCacheAge=" + mMaxNtpCacheAgeSec);
|
||||
|
||||
// force updates
|
||||
mThrottleIndex = THROTTLE_INDEX_UNINITIALIZED;
|
||||
@@ -715,8 +720,9 @@ public class ThrottleService extends IThrottleManager.Stub {
|
||||
getBestTime();
|
||||
}
|
||||
|
||||
private static final int MAX_NTP_CACHE_AGE = 30 * 1000;
|
||||
private static final int MAX_NTP_CACHE_AGE_SEC = 60 * 60 * 24; // 1 day
|
||||
private static final int MAX_NTP_FETCH_WAIT = 10 * 1000;
|
||||
private int mMaxNtpCacheAgeSec = MAX_NTP_CACHE_AGE_SEC;
|
||||
private long cachedNtp;
|
||||
private long cachedNtpTimestamp;
|
||||
|
||||
@@ -724,7 +730,7 @@ public class ThrottleService extends IThrottleManager.Stub {
|
||||
if (mNtpServer != null) {
|
||||
if (mNtpActive) {
|
||||
long ntpAge = SystemClock.elapsedRealtime() - cachedNtpTimestamp;
|
||||
if (ntpAge < MAX_NTP_CACHE_AGE) {
|
||||
if (ntpAge < mMaxNtpCacheAgeSec * 1000) {
|
||||
if (VDBG) Slog.v(TAG, "using cached time");
|
||||
return cachedNtp + ntpAge;
|
||||
}
|
||||
@@ -1091,6 +1097,7 @@ public class ThrottleService extends IThrottleManager.Stub {
|
||||
" seconds.");
|
||||
pw.println("Polling every " + mPolicyPollPeriodSec + " seconds");
|
||||
pw.println("Current Throttle Index is " + mThrottleIndex);
|
||||
pw.println("Max NTP Cache Age is " + mMaxNtpCacheAgeSec);
|
||||
|
||||
for (int i = 0; i < mRecorder.getPeriodCount(); i++) {
|
||||
pw.println(" Period[" + i + "] - read:" + mRecorder.getPeriodRx(i) + ", written:" +
|
||||
|
||||
Reference in New Issue
Block a user