diff options
| -rw-r--r-- | Android.mk | 2 | ||||
| -rw-r--r-- | api/current.xml | 6 | ||||
| -rw-r--r-- | core/java/android/app/SearchDialog.java | 15 | ||||
| -rw-r--r-- | core/java/android/content/Context.java | 3 | ||||
| -rw-r--r-- | core/java/android/content/SyncStorageEngine.java | 4 | ||||
| -rw-r--r-- | core/java/android/view/ViewRoot.java | 20 | ||||
| -rw-r--r-- | core/java/android/widget/AbsListView.java | 4 | ||||
| -rw-r--r-- | core/res/res/values/attrs_manifest.xml | 3 | ||||
| -rw-r--r-- | core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java | 15 | ||||
| -rw-r--r-- | docs/html/guide/samples/index.jd | 4 | ||||
| -rw-r--r-- | docs/html/guide/topics/manifest/activity-element.jd | 54 | ||||
| -rw-r--r-- | docs/html/resources/resources_toc.cs | 3 | ||||
| -rw-r--r-- | docs/html/resources/samples/index.jd | 4 | ||||
| -rw-r--r-- | media/java/android/media/MediaScannerConnection.java | 60 | ||||
| -rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 7 | ||||
| -rw-r--r-- | media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMimeTest.java | 2 |
16 files changed, 124 insertions, 82 deletions
diff --git a/Android.mk b/Android.mk index 5a4c547345b6..cecc26a447de 100644 --- a/Android.mk +++ b/Android.mk @@ -381,6 +381,8 @@ web_docs_sample_code_flags := \ -hdf android.hasSamples 1 \ -samplecode $(sample_dir)/ApiDemos \ resources/samples/ApiDemos "API Demos" \ + -samplecode $(sample_dir)/BackupRestore \ + resources/samples/BackupRestore "Backup and Restore" \ -samplecode $(sample_dir)/BluetoothChat \ resources/samples/BluetoothChat "Bluetooth Chat" \ -samplecode $(sample_dir)/BusinessCard \ diff --git a/api/current.xml b/api/current.xml index 692cb161ba59..e231528f42d7 100644 --- a/api/current.xml +++ b/api/current.xml @@ -85230,7 +85230,7 @@ </parameter> <parameter name="mimeTypes" type="java.lang.String[]"> </parameter> -<parameter name="callback" type="android.media.MediaScannerConnection.ScanResultListener"> +<parameter name="callback" type="android.media.MediaScannerConnection.OnScanCompletedListener"> </parameter> </method> </class> @@ -85241,7 +85241,7 @@ deprecated="not deprecated" visibility="public" > -<implements name="android.media.MediaScannerConnection.ScanResultListener"> +<implements name="android.media.MediaScannerConnection.OnScanCompletedListener"> </implements> <method name="onMediaScannerConnected" return="void" @@ -85270,7 +85270,7 @@ </parameter> </method> </interface> -<interface name="MediaScannerConnection.ScanResultListener" +<interface name="MediaScannerConnection.OnScanCompletedListener" abstract="true" static="true" final="false" diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index 9d217ec19946..7625c04d61e2 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -123,6 +123,9 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // that modifies the contents of the text field. But if the user then edits // the suggestion, the resulting string is saved. private String mUserQuery; + // The query passed in when opening the SearchDialog. Used in the browser + // case to determine whether the user has edited the query. + private String mInitialQuery; // A weak map of drawables we've gotten from other packages, so we don't load them // more than once. @@ -253,6 +256,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS return false; } + mInitialQuery = initialQuery == null ? "" : initialQuery; // finally, load the user's initial text (which may trigger suggestions) setUserQuery(initialQuery); if (selectInitialQuery) { @@ -329,6 +333,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS mAppSearchData = null; mSearchable = null; mUserQuery = null; + mInitialQuery = null; } /** @@ -687,13 +692,16 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS if (mSearchable == null) { return; } - updateWidgetState(); if (!mSearchAutoComplete.isPerformingCompletion()) { // The user changed the query, remember it. mUserQuery = s == null ? "" : s.toString(); } + updateWidgetState(); // Always want to show the microphone if the context is voice. + // Also show the microphone if this is a browser search and the + // query matches the initial query. updateVoiceButton(mSearchAutoComplete.isEmpty() + || (isBrowserSearch() && mInitialQuery.equals(mUserQuery)) || (mAppSearchData != null && mAppSearchData.getBoolean( SearchManager.CONTEXT_IS_VOICE))); } @@ -724,8 +732,9 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // enable the button if we have one or more non-space characters boolean enabled = !mSearchAutoComplete.isEmpty(); if (isBrowserSearch()) { - // In the browser, we hide the search button when there is no text - if (enabled) { + // In the browser, we hide the search button when there is no text, + // or if the text matches the initial query. + if (enabled && !mInitialQuery.equals(mUserQuery)) { mSearchAutoComplete.setBackgroundResource( com.android.internal.R.drawable.textfield_search); mGoButton.setVisibility(View.VISIBLE); diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index ee872903e443..3a2aa552a026 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -25,7 +25,6 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; -import android.media.MediaScannerConnection.ScanResultListener; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -444,7 +443,7 @@ public abstract class Context { * are not automatically scanned by the media scanner, you can explicitly * add them to the media database with * {@link android.media.MediaScannerConnection#scanFile(Context, String[], String[], - * ScanResultListener) MediaScannerConnection.scanFile}. + * OnScanCompletedListener) MediaScannerConnection.scanFile}. * Note that this is not the same as * {@link android.os.Environment#getExternalStoragePublicDirectory * Environment.getExternalStoragePublicDirectory()}, which provides diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java index 984c070b8265..98a499303e26 100644 --- a/core/java/android/content/SyncStorageEngine.java +++ b/core/java/android/content/SyncStorageEngine.java @@ -330,11 +330,11 @@ public class SyncStorageEngine extends Handler { @Override public void handleMessage(Message msg) { if (msg.what == MSG_WRITE_STATUS) { - synchronized (mAccounts) { + synchronized (mAuthorities) { writeStatusLocked(); } } else if (msg.what == MSG_WRITE_STATISTICS) { - synchronized (mAccounts) { + synchronized (mAuthorities) { writeStatisticsLocked(); } } diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java index bf94707d7839..e56a6fe141f3 100644 --- a/core/java/android/view/ViewRoot.java +++ b/core/java/android/view/ViewRoot.java @@ -766,7 +766,7 @@ public final class ViewRoot extends Handler implements ViewParent, // make sure touch mode code executes by setting cached value // to opposite of the added touch mode. mAttachInfo.mInTouchMode = !mAddedTouchMode; - ensureTouchModeLocally(mAddedTouchMode); + ensureTouchModeLocally(mAddedTouchMode, false); } else { if (!mAttachInfo.mContentInsets.equals(mPendingContentInsets)) { mAttachInfo.mContentInsets.set(mPendingContentInsets); @@ -983,7 +983,7 @@ public final class ViewRoot extends Handler implements ViewParent, } boolean focusChangedDueToTouchMode = ensureTouchModeLocally( - (relayoutResult&WindowManagerImpl.RELAYOUT_IN_TOUCH_MODE) != 0); + (relayoutResult&WindowManagerImpl.RELAYOUT_IN_TOUCH_MODE) != 0, true); if (focusChangedDueToTouchMode || mWidth != host.mMeasuredWidth || mHeight != host.mMeasuredHeight || contentInsetsChanged) { childWidthMeasureSpec = getRootMeasureSpec(mWidth, lp.width); @@ -1043,6 +1043,13 @@ public final class ViewRoot extends Handler implements ViewParent, startTime = SystemClock.elapsedRealtime(); } host.layout(0, 0, host.mMeasuredWidth, host.mMeasuredHeight); + if (mFirst) { + if (mAddedTouchMode) { + enterTouchMode(); + } else { + leaveTouchMode(); + } + } if (Config.DEBUG && ViewDebug.consistencyCheckEnabled) { if (!host.dispatchConsistencyCheck(ViewDebug.CONSISTENCY_LAYOUT)) { @@ -1892,7 +1899,7 @@ public final class ViewRoot extends Handler implements ViewParent, mAttachInfo.mHasWindowFocus = hasWindowFocus; if (hasWindowFocus) { boolean inTouchMode = msg.arg2 != 0; - ensureTouchModeLocally(inTouchMode); + ensureTouchModeLocally(inTouchMode, true); if (mGlWanted) { checkEglErrors(); @@ -2002,16 +2009,17 @@ public final class ViewRoot extends Handler implements ViewParent, } // handle the change - return ensureTouchModeLocally(inTouchMode); + return ensureTouchModeLocally(inTouchMode, true); } /** * Ensure that the touch mode for this window is set, and if it is changing, * take the appropriate action. * @param inTouchMode Whether we want to be in touch mode. + * @param dispatchFocus * @return True if the touch mode changed and focus changed was changed as a result */ - private boolean ensureTouchModeLocally(boolean inTouchMode) { + private boolean ensureTouchModeLocally(boolean inTouchMode, boolean dispatchFocus) { if (DBG) Log.d("touchmode", "ensureTouchModeLocally(" + inTouchMode + "), current " + "touch mode is " + mAttachInfo.mInTouchMode); @@ -2020,7 +2028,7 @@ public final class ViewRoot extends Handler implements ViewParent, mAttachInfo.mInTouchMode = inTouchMode; mAttachInfo.mTreeObserver.dispatchOnTouchModeChanged(inTouchMode); - return (inTouchMode) ? enterTouchMode() : leaveTouchMode(); + return dispatchFocus && (inTouchMode) ? enterTouchMode() : leaveTouchMode(); } private boolean enterTouchMode() { diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 4aae05e7ef76..48e7f79d38e4 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -2856,13 +2856,13 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final int firstPosition = mFirstPosition; - if (firstPosition == 0 && firstTop >= listPadding.top && deltaY > 0) { + if (firstPosition == 0 && firstTop >= listPadding.top && deltaY >= 0) { // Don't need to move views down if the top of the first position // is already visible return true; } - if (firstPosition + childCount == mItemCount && lastBottom <= end && deltaY < 0) { + if (firstPosition + childCount == mItemCount && lastBottom <= end && deltaY <= 0) { // Don't need to move views up if the bottom of the last position // is already visible return true; diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 959a9db488e9..3585bf14bb42 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -527,6 +527,9 @@ <!-- The screen layout has changed. This might be caused by a different display being activated. --> <flag name="screenLayout" value="0x0100" /> + <!-- The global user interface mode has changed. For example, + going in or out of car mode, night mode changing, etc. --> + <flag name="uiMode" value="0x0200" /> <!-- The font scaling factor has changed, that is the user has selected a new global font size. --> <flag name="fontScale" value="0x40000000" /> diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java index 7641afe42e62..ae3daad6dd43 100644 --- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java +++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java @@ -470,10 +470,7 @@ public class ConnectivityManagerMobileTest } // Prepare for state validation - NetworkInfo networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); - cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_MOBILE, - networkInfo.getState(),NetworkState.DO_NOTHING,State.DISCONNECTED); - networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_WIFI); + NetworkInfo networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_WIFI); assertEquals(State.DISCONNECTED, networkInfo.getState()); cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_WIFI, networkInfo.getState(), NetworkState.TO_CONNECTION, State.CONNECTED); @@ -482,7 +479,9 @@ public class ConnectivityManagerMobileTest cmActivity.setAirplaneMode(getInstrumentation().getContext(), false); waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED, - STATE_TRANSITION_LONG_TIMEOUT); + STATE_TRANSITION_LONG_TIMEOUT); + waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.DISCONNECTED, + STATE_TRANSITION_LONG_TIMEOUT); // validate the state transition if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_WIFI)) { @@ -491,12 +490,6 @@ public class ConnectivityManagerMobileTest cmActivity.getTransitionFailureReason(ConnectivityManager.TYPE_WIFI)); assertTrue(false); } - if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_MOBILE)) { - Log.v(LOG_TAG, "Mobile state transition validation failed."); - Log.v(LOG_TAG, "reason: " + - cmActivity.getTransitionFailureReason(ConnectivityManager.TYPE_MOBILE)); - assertTrue(false); - } } // Test case 8: test wifi state change while connecting/disconnecting to/from an AP diff --git a/docs/html/guide/samples/index.jd b/docs/html/guide/samples/index.jd index 79235320e2db..2f3ac5ebb6bc 100644 --- a/docs/html/guide/samples/index.jd +++ b/docs/html/guide/samples/index.jd @@ -41,6 +41,10 @@ platforms) and allow you to view the source files in your browser. </p> <dd>A variety of small applications that demonstrate an extensive collection of framework topics.</dd> + <dt><a href="{@docRoot}resources/samples/BackupRestore/index.html">Backup and Restore</a></dt> + <dd>An simple example that illustrates a few different ways for an application to + implement support for the Android data backup and restore mechanism.</dd> + <dt><a href="{@docRoot}resources/samples/BluetoothChat/index.html">Bluetooth Chat</a></dt> <dd>An application for two-way text messaging over Bluetooth.</dd> diff --git a/docs/html/guide/topics/manifest/activity-element.jd b/docs/html/guide/topics/manifest/activity-element.jd index 41c27c64f265..de8ca6d8950b 100644 --- a/docs/html/guide/topics/manifest/activity-element.jd +++ b/docs/html/guide/topics/manifest/activity-element.jd @@ -8,7 +8,8 @@ page.title=<activity> android:<a href="#clear">clearTaskOnLaunch</a>=["true" | "false"] android:<a href="#config">configChanges</a>=["mcc", "mnc", "locale", "touchscreen", "keyboard", "keyboardHidden", - "navigation", "orientation", "fontScale"] + "navigation", "orientation", "screenLayout", + "fontScale", "uiMode"] android:<a href="#enabled">enabled</a>=["true" | "false"] android:<a href="#exclude">excludeFromRecents</a>=["true" | "false"] android:<a href="#exported">exported</a>=["true" | "false"] @@ -152,13 +153,19 @@ as described above. </p></dd> <dt><a name="config"></a>{@code android:configChanges}</dt> -<dd>Lists configuration changes that the activity will handle itself. When -changes that are not listed occur, the activity is shut down and restarted. -When a listed change occurs, the activity remains running and its <code>{@link android.app.Activity#onConfigurationChanged onConfigurationChanged()}</code> -method is called. +<dd>Lists configuration changes that the activity will handle itself. When a configuration +change occurs at runtime, the activity is shut down and restarted by default, but declaring a +configuration with this attribute will prevent the activity from being restarted. Instead, the +activity remains running and its <code>{@link android.app.Activity#onConfigurationChanged +onConfigurationChanged()}</code> method is called. + +<p class="note"><strong>Note:</strong> Using this attribute should be +avoided and used only as a last-resort. Please read <a +href="{@docRoot}guide/topics/resources/runtime-changes.html">Handling Runtime Changes</a> for more +information about how to properly handle a restart due to a configuration change.</p> <p> -Any or all of the following strings can be used to set this attribute. Values are +Any or all of the following strings are valid values for this attribute. Multiple values are separated by '{@code |}' — for example, "{@code locale|navigation|orientation}". </p> @@ -168,39 +175,48 @@ separated by '{@code |}' — for example, "{@code locale|navigation|orientat <th>Description</th> </tr><tr> <td>"{@code mcc}"</td> - <td>The IMSI mobile country code (MCC) has changed — - that is, a SIM has been detected and updated the MCC.</td> + <td>The IMSI mobile country code (MCC) has changed — + a SIM has been detected and updated the MCC.</td> </tr><tr> <td>"{@code mnc}"</td> - <td>The IMSI mobile network code (MNC) has changed — - that is, a SIM has been detected and updated the MNC.</td> + <td>The IMSI mobile network code (MNC) has changed — + a SIM has been detected and updated the MNC.</td> </tr><tr> <td>"{@code locale}"</td> - <td>The locale has changed — for example, the user has selected a new + <td>The locale has changed — the user has selected a new language that text should be displayed in.</td> </tr><tr> <td>"{@code touchscreen}"</td> <td>The touchscreen has changed. (This should never normally happen.)</td> </tr><tr> <td>"{@code keyboard}"</td> - <td>The keyboard type has changed — for example, the user has + <td>The keyboard type has changed — for example, the user has plugged in an external keyboard.</td> </tr><tr> <td>"{@code keyboardHidden}"</td> - <td>The keyboard accessibility has changed — for example, the - user has slid the keyboard out to expose it.</td> + <td>The keyboard accessibility has changed — for example, the + user has revealed the hardware keyboard.</td> </tr><tr> <td>"{@code navigation}"</td> - <td>The navigation type has changed. (This should never normally happen.)</td> + <td>The navigation type (trackball/dpad) has changed. (This should never normally happen.)</td> </tr><tr> - <td>"{@code orientation}"</td> - <td>The screen orientation has changed — that is, the user has rotated + <td>"{@code orientation}"</td> + <td>The screen orientation has changed — the user has rotated the device.</td> </tr><tr> + <td>"{@code screenLayout}"</td> + <td>The screen layout has changed — this might be caused by a + different display being activated.</td> + </tr><tr> <td>"{@code fontScale}"</td> - <td>The font scaling factor has changed — that is, the user has selected + <td>The font scaling factor has changed — the user has selected a new global font size.</td> -</tr> + </tr><tr> + <td>"{@code uiMode}"</td> + <td>The user interface mode has changed — this can be caused when the user places the +device into a desk/car dock or when the the night mode changes. See {@link +android.app.UiModeManager}. <em>Introduced in API Level 8</em>.</td> + </tr> </table> <p> diff --git a/docs/html/resources/resources_toc.cs b/docs/html/resources/resources_toc.cs index 5958f7157ba6..43ab5628288f 100644 --- a/docs/html/resources/resources_toc.cs +++ b/docs/html/resources/resources_toc.cs @@ -188,6 +188,9 @@ <li><a href="<?cs var:toroot ?>resources/samples/ApiDemos/index.html"> <span class="en">API Demos</span> </a></li> + <li><a href="<?cs var:toroot ?>resources/samples/BackupRestore/index.html"> + <span class="en">Backup and Restore</span> + </a> <span class="new">new!</span></li> <li><a href="<?cs var:toroot ?>resources/samples/BluetoothChat/index.html"> <span class="en">Bluetooth Chat</span> </a></li> diff --git a/docs/html/resources/samples/index.jd b/docs/html/resources/samples/index.jd index 044c69de474f..2718d0c0fd57 100644 --- a/docs/html/resources/samples/index.jd +++ b/docs/html/resources/samples/index.jd @@ -22,6 +22,10 @@ href="{@docRoot}resources/samples/get.html">Getting the Samples</a>.</p> <dd>A variety of small applications that demonstrate an extensive collection of framework topics.</dd> + <dt><a href="BackupRestore/index.html">Backup and Restore</a></dt> + <dd>An simple example that illustrates a few different ways for an application to + implement support for the Android data backup and restore mechanism.</dd> + <dt><a href="BluetoothChat/index.html">Bluetooth Chat</a></dt> <dd>An application for two-way text messaging over Bluetooth.</dd> diff --git a/media/java/android/media/MediaScannerConnection.java b/media/java/android/media/MediaScannerConnection.java index 65b67a1eed02..503b5f401b29 100644 --- a/media/java/android/media/MediaScannerConnection.java +++ b/media/java/android/media/MediaScannerConnection.java @@ -30,11 +30,11 @@ import android.util.Log; /** - * MediaScannerConnection provides a way for applications to pass a + * MediaScannerConnection provides a way for applications to pass a * newly created or downloaded media file to the media scanner service. - * The media scanner service will read metadata from the file and add + * The media scanner service will read metadata from the file and add * the file to the media content provider. - * The MediaScannerConnectionClient provides an interface for the + * The MediaScannerConnectionClient provides an interface for the * media scanner service to return the Uri for a newly scanned file * to the client of the MediaScannerConnection class. */ @@ -46,7 +46,7 @@ public class MediaScannerConnection implements ServiceConnection { private MediaScannerConnectionClient mClient; private IMediaScannerService mService; private boolean mConnected; // true if connect() has been called since last disconnect() - + private IMediaScannerListener.Stub mListener = new IMediaScannerListener.Stub() { public void scanCompleted(String path, Uri uri) { MediaScannerConnectionClient client = mClient; @@ -60,36 +60,36 @@ public class MediaScannerConnection implements ServiceConnection { * Interface for notifying clients of the result of scanning a * requested media file. */ - public interface ScanResultListener { + public interface OnScanCompletedListener { /** * Called to notify the client when the media scanner has finished * scanning a file. * @param path the path to the file that has been scanned. - * @param uri the Uri for the file if the scanning operation succeeded - * and the file was added to the media database, or null if scanning failed. - */ + * @param uri the Uri for the file if the scanning operation succeeded + * and the file was added to the media database, or null if scanning failed. + */ public void onScanCompleted(String path, Uri uri); } - + /** * An interface for notifying clients of MediaScannerConnection * when a connection to the MediaScanner service has been established * and when the scanning of a file has completed. */ - public interface MediaScannerConnectionClient extends ScanResultListener { + public interface MediaScannerConnectionClient extends OnScanCompletedListener { /** - * Called to notify the client when a connection to the + * Called to notify the client when a connection to the * MediaScanner service has been established. - */ + */ public void onMediaScannerConnected(); - + /** * Called to notify the client when the media scanner has finished * scanning a file. * @param path the path to the file that has been scanned. - * @param uri the Uri for the file if the scanning operation succeeded - * and the file was added to the media database, or null if scanning failed. - */ + * @param uri the Uri for the file if the scanning operation succeeded + * and the file was added to the media database, or null if scanning failed. + */ public void onScanCompleted(String path, Uri uri); } @@ -140,7 +140,7 @@ public class MediaScannerConnection implements ServiceConnection { } } } - + /** * Returns whether we are connected to the media scanner service * @return true if we are connected, false otherwise @@ -151,9 +151,9 @@ public class MediaScannerConnection implements ServiceConnection { /** * Requests the media scanner to scan a file. - * Success or failure of the scanning operation cannot be determined until + * Success or failure of the scanning operation cannot be determined until * {@link MediaScannerConnectionClient#onScanCompleted(String, Uri)} is called. - * + * * @param path the path to the file to be scanned. * @param mimeType an optional mimeType for the file. * If mimeType is null, then the mimeType will be inferred from the file extension. @@ -175,31 +175,31 @@ public class MediaScannerConnection implements ServiceConnection { } } } - + static class ClientProxy implements MediaScannerConnectionClient { final String[] mPaths; final String[] mMimeTypes; - final ScanResultListener mClient; + final OnScanCompletedListener mClient; MediaScannerConnection mConnection; int mNextPath; - - ClientProxy(String[] paths, String[] mimeTypes, ScanResultListener client) { + + ClientProxy(String[] paths, String[] mimeTypes, OnScanCompletedListener client) { mPaths = paths; mMimeTypes = mimeTypes; mClient = client; } - + public void onMediaScannerConnected() { scanNextPath(); } - + public void onScanCompleted(String path, Uri uri) { if (mClient != null) { mClient.onScanCompleted(path, uri); } scanNextPath(); } - + void scanNextPath() { if (mNextPath >= mPaths.length) { mConnection.disconnect(); @@ -210,7 +210,7 @@ public class MediaScannerConnection implements ServiceConnection { mNextPath++; } } - + /** * Convenience for constructing a {@link MediaScannerConnection}, calling * {@link #connect} on it, and calling {@link #scanFile} with the given @@ -218,7 +218,7 @@ public class MediaScannerConnection implements ServiceConnection { * established. * @param context The caller's Context, required for establishing a connection to * the media scanner service. - * Success or failure of the scanning operation cannot be determined until + * Success or failure of the scanning operation cannot be determined until * {@link MediaScannerConnectionClient#onScanCompleted(String, Uri)} is called. * @param paths Array of paths to be scanned. * @param mimeTypes Optional array of MIME types for each path. @@ -229,13 +229,13 @@ public class MediaScannerConnection implements ServiceConnection { * @see scanFile(String, String) */ public static void scanFile(Context context, String[] paths, String[] mimeTypes, - ScanResultListener callback) { + OnScanCompletedListener callback) { ClientProxy client = new ClientProxy(paths, mimeTypes, callback); MediaScannerConnection connection = new MediaScannerConnection(context, client); client.mConnection = connection; connection.connect(); } - + /** * Part of the ServiceConnection interface. Do not call. */ diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 27add0a62ae7..e7022f4b3ade 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -668,7 +668,9 @@ status_t AwesomePlayer::getDuration(int64_t *durationUs) { } status_t AwesomePlayer::getPosition(int64_t *positionUs) { - if (mVideoSource != NULL) { + if (mSeeking) { + *positionUs = mSeekTimeUs; + } else if (mVideoSource != NULL) { Mutex::Autolock autoLock(mMiscStateLock); *positionUs = mVideoTimeUs; } else if (mAudioPlayer != NULL) { @@ -710,7 +712,6 @@ void AwesomePlayer::seekAudioIfNecessary_l() { mWatchForAudioSeekComplete = true; mWatchForAudioEOS = true; - mSeeking = false; mSeekNotificationSent = false; } } @@ -1001,6 +1002,8 @@ void AwesomePlayer::onCheckAudioStatus() { notifyListener_l(MEDIA_SEEK_COMPLETE); mSeekNotificationSent = true; } + + mSeeking = false; } status_t finalStatus; diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMimeTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMimeTest.java index 8489a67052f7..728e68dd8dd6 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMimeTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMimeTest.java @@ -49,7 +49,6 @@ public class MediaMimeTest extends ActivityInstrumentationTestCase2<MediaFramewo private final String TAG = "MediaMimeTest"; private Context mContext; private final String MP3_FILE = "/sdcard/media_api/music/SHORTMP3.mp3"; - private final String MEDIA_PLAYBACK_NAME = "com.android.music.MediaPlaybackActivityStarter"; public MediaMimeTest() { super("com.android.mediaframeworktest", MediaFrameworkTest.class); @@ -129,7 +128,6 @@ public class MediaMimeTest extends ActivityInstrumentationTestCase2<MediaFramewo ResolveInfo ri = resolveMime(mime); assertNotNull(ri); - assertEquals(MEDIA_PLAYBACK_NAME, ri.activityInfo.name.toString()); } // Helper method to check that NO activity handles the given mime type. |