Merge "Set sIsInitialized to false and add logging"

This commit is contained in:
Hall Liu
2017-12-02 01:35:15 +00:00
committed by Gerrit Code Review

View File

@@ -347,6 +347,7 @@ public class MbmsDownloadSession implements AutoCloseable {
@Override @Override
public void onServiceDisconnected(ComponentName name) { public void onServiceDisconnected(ComponentName name) {
Log.w(LOG_TAG, "bindAndInitialize: Remote service disconnected");
sIsInitialized.set(false); sIsInitialized.set(false);
mService.set(null); mService.set(null);
} }
@@ -385,6 +386,7 @@ public class MbmsDownloadSession implements AutoCloseable {
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(LOG_TAG, "Remote process died"); Log.w(LOG_TAG, "Remote process died");
mService.set(null); mService.set(null);
sIsInitialized.set(false);
sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null);
} }
} }
@@ -438,6 +440,7 @@ public class MbmsDownloadSession implements AutoCloseable {
} }
} catch (RemoteException e) { } catch (RemoteException e) {
mService.set(null); mService.set(null);
sIsInitialized.set(false);
sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null);
return; return;
} }
@@ -521,6 +524,7 @@ public class MbmsDownloadSession implements AutoCloseable {
downloadService.download(request); downloadService.download(request);
} catch (RemoteException e) { } catch (RemoteException e) {
mService.set(null); mService.set(null);
sIsInitialized.set(false);
sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null);
} }
} }
@@ -542,6 +546,7 @@ public class MbmsDownloadSession implements AutoCloseable {
return downloadService.listPendingDownloads(mSubscriptionId); return downloadService.listPendingDownloads(mSubscriptionId);
} catch (RemoteException e) { } catch (RemoteException e) {
mService.set(null); mService.set(null);
sIsInitialized.set(false);
sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null);
return Collections.emptyList(); return Collections.emptyList();
} }
@@ -583,6 +588,7 @@ public class MbmsDownloadSession implements AutoCloseable {
} }
} catch (RemoteException e) { } catch (RemoteException e) {
mService.set(null); mService.set(null);
sIsInitialized.set(false);
sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null);
return; return;
} }
@@ -622,6 +628,7 @@ public class MbmsDownloadSession implements AutoCloseable {
} }
} catch (RemoteException e) { } catch (RemoteException e) {
mService.set(null); mService.set(null);
sIsInitialized.set(false);
sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null);
} }
} finally { } finally {
@@ -658,6 +665,7 @@ public class MbmsDownloadSession implements AutoCloseable {
} }
} catch (RemoteException e) { } catch (RemoteException e) {
mService.set(null); mService.set(null);
sIsInitialized.set(false);
sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null);
return; return;
} }
@@ -686,6 +694,7 @@ public class MbmsDownloadSession implements AutoCloseable {
return downloadService.getDownloadStatus(downloadRequest, fileInfo); return downloadService.getDownloadStatus(downloadRequest, fileInfo);
} catch (RemoteException e) { } catch (RemoteException e) {
mService.set(null); mService.set(null);
sIsInitialized.set(false);
sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null);
return STATUS_UNKNOWN; return STATUS_UNKNOWN;
} }
@@ -727,6 +736,7 @@ public class MbmsDownloadSession implements AutoCloseable {
} }
} catch (RemoteException e) { } catch (RemoteException e) {
mService.set(null); mService.set(null);
sIsInitialized.set(false);
sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null);
} }
} }