File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
andlinker/src/main/java/com/codezjx/andlinker Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ public void unbind() {
104104 return ;
105105 }
106106 mContext .unbindService (mServiceConnection );
107- handleUnBind ();
107+ handleUnBind (true );
108108 }
109109
110110 /**
@@ -166,21 +166,24 @@ public void onServiceConnected(ComponentName name, IBinder service) {
166166 @ Override
167167 public void onServiceDisconnected (ComponentName name ) {
168168 Logger .d (TAG , "onServiceDisconnected:" + name );
169- handleUnBind ();
169+ handleUnBind (false );
170170 }
171171 };
172172 }
173173
174- private void handleUnBind () {
174+ private void handleUnBind (boolean unRegister ) {
175+ Logger .d (TAG , "handleUnBind:" + unRegister );
175176 if (mTransferService == null ) {
176177 Logger .e (TAG , "Error occur, TransferService was null when service disconnected." );
177178 fireOnUnBind ();
178179 return ;
179180 }
180- try {
181- mTransferService .unRegister (mCallback );
182- } catch (RemoteException e ) {
183- e .printStackTrace ();
181+ if (unRegister ) {
182+ try {
183+ mTransferService .unRegister (mCallback );
184+ } catch (RemoteException e ) {
185+ e .printStackTrace ();
186+ }
184187 }
185188 mTransferService = null ;
186189 fireOnUnBind ();
You can’t perform that action at this time.
0 commit comments