Loading media/java/android/media/browse/MediaBrowser.java +17 −17 Original line number Diff line number Diff line Loading @@ -455,8 +455,8 @@ public final class MediaBrowser { private void subscribeInternal(String parentId, Bundle options, SubscriptionCallback callback) { // Check arguments. if (parentId == null) { throw new IllegalArgumentException("parentId is null"); if (TextUtils.isEmpty(parentId)) { throw new IllegalArgumentException("parentId is empty."); } if (callback == null) { throw new IllegalArgumentException("callback is null"); Loading media/java/android/service/media/MediaBrowserService.java +21 −13 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.service.media; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SdkConstant; Loading @@ -41,6 +42,8 @@ import android.util.Log; import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.HashMap; import java.util.List; Loading Loading @@ -86,6 +89,11 @@ public abstract class MediaBrowserService extends Service { private static final int RESULT_FLAG_OPTION_NOT_HANDLED = 0x00000001; /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag=true, value = { RESULT_FLAG_OPTION_NOT_HANDLED }) private @interface ResultFlags { } private final ArrayMap<IBinder, ConnectionRecord> mConnections = new ArrayMap<>(); private final Handler mHandler = new Handler(); private ServiceBinder mBinder; Loading Loading @@ -119,7 +127,7 @@ public abstract class MediaBrowserService extends Service { private Object mDebug; private boolean mDetachCalled; private boolean mSendResultCalled; private int mFlag; private int mFlags; Result(Object debug) { mDebug = debug; Loading @@ -133,7 +141,7 @@ public abstract class MediaBrowserService extends Service { throw new IllegalStateException("sendResult() called twice for: " + mDebug); } mSendResultCalled = true; onResultSent(result, mFlag); onResultSent(result, mFlags); } /** Loading @@ -156,15 +164,15 @@ public abstract class MediaBrowserService extends Service { return mDetachCalled || mSendResultCalled; } void setFlag(int flag) { mFlag = flag; void setFlags(@ResultFlags int flags) { mFlags = flags; } /** * Called when the result is sent, after assertions about not being called twice * have happened. */ void onResultSent(T result, int flag) { void onResultSent(T result, @ResultFlags int flags) { } } Loading Loading @@ -388,7 +396,7 @@ public abstract class MediaBrowserService extends Service { // To support backward compatibility, when the implementation of MediaBrowserService doesn't // override onLoadChildren() with options, onLoadChildren() without options will be used // instead, and the options will be applied in the implementation of result.onResultSent(). result.setFlag(RESULT_FLAG_OPTION_NOT_HANDLED); result.setFlags(RESULT_FLAG_OPTION_NOT_HANDLED); onLoadChildren(parentId, result); } Loading Loading @@ -574,7 +582,7 @@ public abstract class MediaBrowserService extends Service { final Result<List<MediaBrowser.MediaItem>> result = new Result<List<MediaBrowser.MediaItem>>(parentId) { @Override void onResultSent(List<MediaBrowser.MediaItem> list, int flag) { void onResultSent(List<MediaBrowser.MediaItem> list, @ResultFlags int flag) { if (mConnections.get(connection.callbacks.asBinder()) != connection) { if (DBG) { Log.d(TAG, "Not sending onLoadChildren result for connection that has" Loading Loading @@ -639,7 +647,7 @@ public abstract class MediaBrowserService extends Service { final Result<MediaBrowser.MediaItem> result = new Result<MediaBrowser.MediaItem>(itemId) { @Override void onResultSent(MediaBrowser.MediaItem item, int flag) { void onResultSent(MediaBrowser.MediaItem item, @ResultFlags int flag) { Bundle bundle = new Bundle(); bundle.putParcelable(KEY_MEDIA_ITEM, item); receiver.send(0, bundle); Loading Loading
media/java/android/media/browse/MediaBrowser.java +17 −17 Original line number Diff line number Diff line Loading @@ -455,8 +455,8 @@ public final class MediaBrowser { private void subscribeInternal(String parentId, Bundle options, SubscriptionCallback callback) { // Check arguments. if (parentId == null) { throw new IllegalArgumentException("parentId is null"); if (TextUtils.isEmpty(parentId)) { throw new IllegalArgumentException("parentId is empty."); } if (callback == null) { throw new IllegalArgumentException("callback is null"); Loading
media/java/android/service/media/MediaBrowserService.java +21 −13 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.service.media; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SdkConstant; Loading @@ -41,6 +42,8 @@ import android.util.Log; import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.HashMap; import java.util.List; Loading Loading @@ -86,6 +89,11 @@ public abstract class MediaBrowserService extends Service { private static final int RESULT_FLAG_OPTION_NOT_HANDLED = 0x00000001; /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag=true, value = { RESULT_FLAG_OPTION_NOT_HANDLED }) private @interface ResultFlags { } private final ArrayMap<IBinder, ConnectionRecord> mConnections = new ArrayMap<>(); private final Handler mHandler = new Handler(); private ServiceBinder mBinder; Loading Loading @@ -119,7 +127,7 @@ public abstract class MediaBrowserService extends Service { private Object mDebug; private boolean mDetachCalled; private boolean mSendResultCalled; private int mFlag; private int mFlags; Result(Object debug) { mDebug = debug; Loading @@ -133,7 +141,7 @@ public abstract class MediaBrowserService extends Service { throw new IllegalStateException("sendResult() called twice for: " + mDebug); } mSendResultCalled = true; onResultSent(result, mFlag); onResultSent(result, mFlags); } /** Loading @@ -156,15 +164,15 @@ public abstract class MediaBrowserService extends Service { return mDetachCalled || mSendResultCalled; } void setFlag(int flag) { mFlag = flag; void setFlags(@ResultFlags int flags) { mFlags = flags; } /** * Called when the result is sent, after assertions about not being called twice * have happened. */ void onResultSent(T result, int flag) { void onResultSent(T result, @ResultFlags int flags) { } } Loading Loading @@ -388,7 +396,7 @@ public abstract class MediaBrowserService extends Service { // To support backward compatibility, when the implementation of MediaBrowserService doesn't // override onLoadChildren() with options, onLoadChildren() without options will be used // instead, and the options will be applied in the implementation of result.onResultSent(). result.setFlag(RESULT_FLAG_OPTION_NOT_HANDLED); result.setFlags(RESULT_FLAG_OPTION_NOT_HANDLED); onLoadChildren(parentId, result); } Loading Loading @@ -574,7 +582,7 @@ public abstract class MediaBrowserService extends Service { final Result<List<MediaBrowser.MediaItem>> result = new Result<List<MediaBrowser.MediaItem>>(parentId) { @Override void onResultSent(List<MediaBrowser.MediaItem> list, int flag) { void onResultSent(List<MediaBrowser.MediaItem> list, @ResultFlags int flag) { if (mConnections.get(connection.callbacks.asBinder()) != connection) { if (DBG) { Log.d(TAG, "Not sending onLoadChildren result for connection that has" Loading Loading @@ -639,7 +647,7 @@ public abstract class MediaBrowserService extends Service { final Result<MediaBrowser.MediaItem> result = new Result<MediaBrowser.MediaItem>(itemId) { @Override void onResultSent(MediaBrowser.MediaItem item, int flag) { void onResultSent(MediaBrowser.MediaItem item, @ResultFlags int flag) { Bundle bundle = new Bundle(); bundle.putParcelable(KEY_MEDIA_ITEM, item); receiver.send(0, bundle); Loading