+ if (mOperationsServiceBinder != null) {
+ mOperationsServiceBinder.addOperationListener(FileActivity.this, mHandler);
+ }
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ if (mOperationsServiceBinder != null) {
+ doOnResumeAndBound();
+ }
+
+ }
+
+ @Override
+ protected void onPause() {
+ if (mOperationsServiceBinder != null) {
+ mOperationsServiceBinder.removeOperationListener(this);
+ }
+
+ super.onPause();
+ }
+
+ @Override
+ protected void onStop() {
+
+ if (mOperationsServiceBinder != null) {
+ mOperationsServiceBinder.removeOperationListener(this);
+ }
+
+ super.onStop();
+ }
+
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ if (mOperationsServiceConnection != null) {
+ unbindService(mOperationsServiceConnection);
+ mOperationsServiceBinder = null;
+ }
+ if (mDownloadServiceConnection != null) {
+ unbindService(mDownloadServiceConnection);
+ mDownloadServiceConnection = null;
+ }
+ if (mUploadServiceConnection != null) {
+ unbindService(mUploadServiceConnection);
+ mUploadServiceConnection = null;
+ }