From 5e9727f5dfbe5d5a3d2d514ed7d0f72720a6c0cf Mon Sep 17 00:00:00 2001 From: Hall Liu Date: Fri, 1 Dec 2017 14:01:15 -0800 Subject: [PATCH] Set sIsInitialized to false and add logging When the service goes away due to a remote exception, set sIsInitialized to false as well as setting the service to null. Also log the serviceconnection disconnect. Bug: 70032958 Test: cts Change-Id: I34c1ea804537c62bd4348ba3aeeca7ba2c0becb6 --- .../java/android/telephony/MbmsDownloadSession.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/telephony/java/android/telephony/MbmsDownloadSession.java b/telephony/java/android/telephony/MbmsDownloadSession.java index f392570ecb29b..a554c693ccdd9 100644 --- a/telephony/java/android/telephony/MbmsDownloadSession.java +++ b/telephony/java/android/telephony/MbmsDownloadSession.java @@ -347,6 +347,7 @@ public class MbmsDownloadSession implements AutoCloseable { @Override public void onServiceDisconnected(ComponentName name) { + Log.w(LOG_TAG, "bindAndInitialize: Remote service disconnected"); sIsInitialized.set(false); mService.set(null); } @@ -385,6 +386,7 @@ public class MbmsDownloadSession implements AutoCloseable { } catch (RemoteException e) { Log.w(LOG_TAG, "Remote process died"); mService.set(null); + sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); } } @@ -438,6 +440,7 @@ public class MbmsDownloadSession implements AutoCloseable { } } catch (RemoteException e) { mService.set(null); + sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); return; } @@ -521,6 +524,7 @@ public class MbmsDownloadSession implements AutoCloseable { downloadService.download(request); } catch (RemoteException e) { mService.set(null); + sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); } } @@ -542,6 +546,7 @@ public class MbmsDownloadSession implements AutoCloseable { return downloadService.listPendingDownloads(mSubscriptionId); } catch (RemoteException e) { mService.set(null); + sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); return Collections.emptyList(); } @@ -583,6 +588,7 @@ public class MbmsDownloadSession implements AutoCloseable { } } catch (RemoteException e) { mService.set(null); + sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); return; } @@ -622,6 +628,7 @@ public class MbmsDownloadSession implements AutoCloseable { } } catch (RemoteException e) { mService.set(null); + sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); } } finally { @@ -658,6 +665,7 @@ public class MbmsDownloadSession implements AutoCloseable { } } catch (RemoteException e) { mService.set(null); + sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); return; } @@ -686,6 +694,7 @@ public class MbmsDownloadSession implements AutoCloseable { return downloadService.getDownloadStatus(downloadRequest, fileInfo); } catch (RemoteException e) { mService.set(null); + sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); return STATUS_UNKNOWN; } @@ -727,6 +736,7 @@ public class MbmsDownloadSession implements AutoCloseable { } } catch (RemoteException e) { mService.set(null); + sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); } }