am b263500a: am 42da57f1: am d4c2499c: Merge "Allow empty strings in playFromSearch" into lmp-dev

* commit 'b263500a1368bf1865106c437b0cd2add94d65ae':
  Allow empty strings in playFromSearch
This commit is contained in:
RoboErik
2014-09-03 13:49:36 +00:00
committed by Android Git Automerger
2 changed files with 12 additions and 5 deletions

View File

@@ -625,14 +625,18 @@ public final class MediaController {
/**
* Request that the player start playback for a specific search query.
* An empty or null query should be treated as a request to play any
* music.
*
* @param query The search query.
* @param extras Optional extras that can include extra information about the query.
* @param extras Optional extras that can include extra information
* about the query.
*/
public void playFromSearch(String query, Bundle extras) {
if (TextUtils.isEmpty(query)) {
throw new IllegalArgumentException(
"You must specify a non-empty search query for playFromSearch.");
if (query == null) {
// This is to remain compatible with
// INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH
query = "";
}
try {
mSessionBinder.playFromSearch(query, extras);

View File

@@ -789,7 +789,10 @@ public final class MediaSession {
}
/**
* Override to handle requests to begin playback from a search query.
* Override to handle requests to begin playback from a search query. An
* empty query indicates that the app may play any music. The
* implementation should attempt to make a smart choice about what to
* play.
*/
public void onPlayFromSearch(String query, Bundle extras) {
}