Loading telephony/java/android/telephony/MbmsDownloadSession.java +63 −50 Original line number Diff line number Diff line Loading @@ -243,6 +243,7 @@ public class MbmsDownloadSession implements AutoCloseable { }; private AtomicReference<IMbmsDownloadService> mService = new AtomicReference<>(null); private ServiceConnection mServiceConnection; private final InternalDownloadSessionCallback mInternalCallback; private final Map<DownloadStatusListener, InternalDownloadStatusListener> mInternalDownloadStatusListeners = new HashMap<>(); Loading Loading @@ -318,8 +319,7 @@ public class MbmsDownloadSession implements AutoCloseable { } private int bindAndInitialize() { return MbmsUtils.startBinding(mContext, MBMS_DOWNLOAD_SERVICE_ACTION, new ServiceConnection() { mServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { IMbmsDownloadService downloadService = Loading Loading @@ -367,7 +367,18 @@ public class MbmsDownloadSession implements AutoCloseable { sIsInitialized.set(false); mService.set(null); } }); @Override public void onNullBinding(ComponentName name) { Log.w(LOG_TAG, "bindAndInitialize: Remote service returned null"); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, "Middleware service binding returned null"); sIsInitialized.set(false); mService.set(null); mContext.unbindService(this); } }; return MbmsUtils.startBinding(mContext, MBMS_DOWNLOAD_SERVICE_ACTION, mServiceConnection); } /** Loading Loading @@ -965,17 +976,19 @@ public class MbmsDownloadSession implements AutoCloseable { public void close() { try { IMbmsDownloadService downloadService = mService.get(); if (downloadService == null) { if (downloadService == null || mServiceConnection == null) { Log.i(LOG_TAG, "Service already dead"); return; } downloadService.dispose(mSubscriptionId); mContext.unbindService(mServiceConnection); } catch (RemoteException e) { // Ignore Log.i(LOG_TAG, "Remote exception while disposing of service"); } finally { mService.set(null); sIsInitialized.set(false); mServiceConnection = null; mInternalCallback.stop(); } } Loading telephony/java/android/telephony/MbmsGroupCallSession.java +67 −54 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ public class MbmsGroupCallSession implements AutoCloseable { }; private InternalGroupCallSessionCallback mInternalCallback; private ServiceConnection mServiceConnection; private Set<GroupCall> mKnownActiveGroupCalls = new ArraySet<>(); private final Context mContext; Loading Loading @@ -163,7 +164,7 @@ public class MbmsGroupCallSession implements AutoCloseable { public void close() { try { IMbmsGroupCallService groupCallService = mService.get(); if (groupCallService == null) { if (groupCallService == null || mServiceConnection == null) { // Ignore and return, assume already disposed. return; } Loading @@ -172,11 +173,13 @@ public class MbmsGroupCallSession implements AutoCloseable { s.getCallback().stop(); } mKnownActiveGroupCalls.clear(); mContext.unbindService(mServiceConnection); } catch (RemoteException e) { // Ignore for now } finally { mService.set(null); sIsInitialized.set(false); mServiceConnection = null; mInternalCallback.stop(); } } Loading Loading @@ -244,8 +247,7 @@ public class MbmsGroupCallSession implements AutoCloseable { } private int bindAndInitialize() { return MbmsUtils.startBinding(mContext, MBMS_GROUP_CALL_SERVICE_ACTION, new ServiceConnection() { mServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { IMbmsGroupCallService groupCallService = Loading Loading @@ -297,6 +299,17 @@ public class MbmsGroupCallSession implements AutoCloseable { sIsInitialized.set(false); mService.set(null); } }); @Override public void onNullBinding(ComponentName name) { Log.w(LOG_TAG, "bindAndInitialize: Remote service returned null"); mInternalCallback.onError(MbmsErrors.ERROR_MIDDLEWARE_LOST, "Middleware service binding returned null"); sIsInitialized.set(false); mService.set(null); mContext.unbindService(this); } }; return MbmsUtils.startBinding(mContext, MBMS_GROUP_CALL_SERVICE_ACTION, mServiceConnection); } } telephony/java/android/telephony/MbmsStreamingSession.java +66 −53 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ public class MbmsStreamingSession implements AutoCloseable { }; private InternalStreamingSessionCallback mInternalCallback; private ServiceConnection mServiceConnection; private Set<StreamingService> mKnownActiveStreamingServices = new ArraySet<>(); private final Context mContext; Loading Loading @@ -168,7 +169,7 @@ public class MbmsStreamingSession implements AutoCloseable { public void close() { try { IMbmsStreamingService streamingService = mService.get(); if (streamingService == null) { if (streamingService == null || mServiceConnection == null) { // Ignore and return, assume already disposed. return; } Loading @@ -177,11 +178,13 @@ public class MbmsStreamingSession implements AutoCloseable { s.getCallback().stop(); } mKnownActiveStreamingServices.clear(); mContext.unbindService(mServiceConnection); } catch (RemoteException e) { // Ignore for now } finally { mService.set(null); sIsInitialized.set(false); mServiceConnection = null; mInternalCallback.stop(); } } Loading Loading @@ -286,8 +289,7 @@ public class MbmsStreamingSession implements AutoCloseable { } private int bindAndInitialize() { return MbmsUtils.startBinding(mContext, MBMS_STREAMING_SERVICE_ACTION, new ServiceConnection() { mServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { IMbmsStreamingService streamingService = Loading Loading @@ -338,7 +340,18 @@ public class MbmsStreamingSession implements AutoCloseable { sIsInitialized.set(false); mService.set(null); } }); @Override public void onNullBinding(ComponentName name) { Log.w(LOG_TAG, "bindAndInitialize: Remote service returned null"); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, "Middleware service binding returned null"); sIsInitialized.set(false); mService.set(null); mContext.unbindService(this); } }; return MbmsUtils.startBinding(mContext, MBMS_STREAMING_SERVICE_ACTION, mServiceConnection); } private void sendErrorToApp(int errorCode, String message) { Loading Loading
telephony/java/android/telephony/MbmsDownloadSession.java +63 −50 Original line number Diff line number Diff line Loading @@ -243,6 +243,7 @@ public class MbmsDownloadSession implements AutoCloseable { }; private AtomicReference<IMbmsDownloadService> mService = new AtomicReference<>(null); private ServiceConnection mServiceConnection; private final InternalDownloadSessionCallback mInternalCallback; private final Map<DownloadStatusListener, InternalDownloadStatusListener> mInternalDownloadStatusListeners = new HashMap<>(); Loading Loading @@ -318,8 +319,7 @@ public class MbmsDownloadSession implements AutoCloseable { } private int bindAndInitialize() { return MbmsUtils.startBinding(mContext, MBMS_DOWNLOAD_SERVICE_ACTION, new ServiceConnection() { mServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { IMbmsDownloadService downloadService = Loading Loading @@ -367,7 +367,18 @@ public class MbmsDownloadSession implements AutoCloseable { sIsInitialized.set(false); mService.set(null); } }); @Override public void onNullBinding(ComponentName name) { Log.w(LOG_TAG, "bindAndInitialize: Remote service returned null"); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, "Middleware service binding returned null"); sIsInitialized.set(false); mService.set(null); mContext.unbindService(this); } }; return MbmsUtils.startBinding(mContext, MBMS_DOWNLOAD_SERVICE_ACTION, mServiceConnection); } /** Loading Loading @@ -965,17 +976,19 @@ public class MbmsDownloadSession implements AutoCloseable { public void close() { try { IMbmsDownloadService downloadService = mService.get(); if (downloadService == null) { if (downloadService == null || mServiceConnection == null) { Log.i(LOG_TAG, "Service already dead"); return; } downloadService.dispose(mSubscriptionId); mContext.unbindService(mServiceConnection); } catch (RemoteException e) { // Ignore Log.i(LOG_TAG, "Remote exception while disposing of service"); } finally { mService.set(null); sIsInitialized.set(false); mServiceConnection = null; mInternalCallback.stop(); } } Loading
telephony/java/android/telephony/MbmsGroupCallSession.java +67 −54 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ public class MbmsGroupCallSession implements AutoCloseable { }; private InternalGroupCallSessionCallback mInternalCallback; private ServiceConnection mServiceConnection; private Set<GroupCall> mKnownActiveGroupCalls = new ArraySet<>(); private final Context mContext; Loading Loading @@ -163,7 +164,7 @@ public class MbmsGroupCallSession implements AutoCloseable { public void close() { try { IMbmsGroupCallService groupCallService = mService.get(); if (groupCallService == null) { if (groupCallService == null || mServiceConnection == null) { // Ignore and return, assume already disposed. return; } Loading @@ -172,11 +173,13 @@ public class MbmsGroupCallSession implements AutoCloseable { s.getCallback().stop(); } mKnownActiveGroupCalls.clear(); mContext.unbindService(mServiceConnection); } catch (RemoteException e) { // Ignore for now } finally { mService.set(null); sIsInitialized.set(false); mServiceConnection = null; mInternalCallback.stop(); } } Loading Loading @@ -244,8 +247,7 @@ public class MbmsGroupCallSession implements AutoCloseable { } private int bindAndInitialize() { return MbmsUtils.startBinding(mContext, MBMS_GROUP_CALL_SERVICE_ACTION, new ServiceConnection() { mServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { IMbmsGroupCallService groupCallService = Loading Loading @@ -297,6 +299,17 @@ public class MbmsGroupCallSession implements AutoCloseable { sIsInitialized.set(false); mService.set(null); } }); @Override public void onNullBinding(ComponentName name) { Log.w(LOG_TAG, "bindAndInitialize: Remote service returned null"); mInternalCallback.onError(MbmsErrors.ERROR_MIDDLEWARE_LOST, "Middleware service binding returned null"); sIsInitialized.set(false); mService.set(null); mContext.unbindService(this); } }; return MbmsUtils.startBinding(mContext, MBMS_GROUP_CALL_SERVICE_ACTION, mServiceConnection); } }
telephony/java/android/telephony/MbmsStreamingSession.java +66 −53 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ public class MbmsStreamingSession implements AutoCloseable { }; private InternalStreamingSessionCallback mInternalCallback; private ServiceConnection mServiceConnection; private Set<StreamingService> mKnownActiveStreamingServices = new ArraySet<>(); private final Context mContext; Loading Loading @@ -168,7 +169,7 @@ public class MbmsStreamingSession implements AutoCloseable { public void close() { try { IMbmsStreamingService streamingService = mService.get(); if (streamingService == null) { if (streamingService == null || mServiceConnection == null) { // Ignore and return, assume already disposed. return; } Loading @@ -177,11 +178,13 @@ public class MbmsStreamingSession implements AutoCloseable { s.getCallback().stop(); } mKnownActiveStreamingServices.clear(); mContext.unbindService(mServiceConnection); } catch (RemoteException e) { // Ignore for now } finally { mService.set(null); sIsInitialized.set(false); mServiceConnection = null; mInternalCallback.stop(); } } Loading Loading @@ -286,8 +289,7 @@ public class MbmsStreamingSession implements AutoCloseable { } private int bindAndInitialize() { return MbmsUtils.startBinding(mContext, MBMS_STREAMING_SERVICE_ACTION, new ServiceConnection() { mServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { IMbmsStreamingService streamingService = Loading Loading @@ -338,7 +340,18 @@ public class MbmsStreamingSession implements AutoCloseable { sIsInitialized.set(false); mService.set(null); } }); @Override public void onNullBinding(ComponentName name) { Log.w(LOG_TAG, "bindAndInitialize: Remote service returned null"); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, "Middleware service binding returned null"); sIsInitialized.set(false); mService.set(null); mContext.unbindService(this); } }; return MbmsUtils.startBinding(mContext, MBMS_STREAMING_SERVICE_ACTION, mServiceConnection); } private void sendErrorToApp(int errorCode, String message) { Loading