public void connect() {
if (this.mState != 0) {
throw new IllegalStateException("connect() called while not disconnected (state=" + getStateLabel(this.mState) + SocializeConstants.OP_CLOSE_PAREN);
} else if (this.mServiceBinderWrapper != null) {
throw new RuntimeException("mServiceBinderWrapper should be null. Instead it is " + this.mServiceBinderWrapper);
} else if (this.mCallbacksMessenger != null) {
throw new RuntimeException("mCallbacksMessenger should be null. Instead it is " + this.mCallbacksMessenger);
} else {
this.mState = 1;
Intent intent = new Intent(MediaBrowserServiceCompat.SERVICE_INTERFACE);
intent.setComponent(this.mServiceComponent);
final ServiceConnection thisConnection = new MediaServiceConnection();
this.mServiceConnection = thisConnection;
boolean bound = false;
try {
bound = this.mContext.bindService(intent, this.mServiceConnection, 1);
} catch (Exception e) {
Log.e(MediaBrowserCompat.TAG, "Failed binding to service " + this.mServiceComponent);
}
if (!bound) {
this.mHandler.post(new Runnable() {
public void run() {
if (thisConnection == MediaBrowserServiceImplBase.this.mServiceConnection) {
MediaBrowserServiceImplBase.this.forceCloseConnection();
MediaBrowserServiceImplBase.this.mCallback.onConnectionFailed();
}
}
});
}
}
}
MediaBrowserCompat.java 文件源码
java
阅读 40
收藏 0
点赞 0
评论 0
项目:boohee_v5.6
作者:
评论列表
文章目录