Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 427e43eb authored by Hall Liu's avatar Hall Liu
Browse files

Add additional logging for EMBMS edge cases

Add logging when failing to delete temp files or write download
tokens.

Test: logging only
Change-Id: Id7836f3660d37d8cd94580d221c95b2c15c2cb68
parent 1844f1cb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -814,11 +814,11 @@ public class MbmsDownloadSession implements AutoCloseable {
        try {
            if (!token.createNewFile()) {
                throw new RuntimeException("Failed to create download token for request "
                        + request);
                        + request + ". Token location is " + token.getPath());
            }
        } catch (IOException e) {
            throw new RuntimeException("Failed to create download token for request " + request
                    + " due to IOException " + e);
                    + " due to IOException " + e + ". Attempted to write to " + token.getPath());
        }
    }

+5 −1
Original line number Diff line number Diff line
@@ -297,7 +297,9 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {
        for (Uri tempFileUri : tempFiles) {
            if (verifyTempFilePath(context, request.getFileServiceId(), tempFileUri)) {
                File tempFile = new File(tempFileUri.getSchemeSpecificPart());
                tempFile.delete();
                if (!tempFile.delete()) {
                    Log.w(LOG_TAG, "Failed to delete temp file at " + tempFile.getPath());
                }
            }
        }
    }
@@ -474,6 +476,8 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {

        if (!MbmsUtils.isContainedIn(
                MbmsUtils.getEmbmsTempFileDirForService(context, serviceId), tempFile)) {
            Log.w(LOG_TAG, "File at " + path + " is not contained in the temp file root," +
                    " which is " + MbmsUtils.getEmbmsTempFileDirForService(context, serviceId));
            return false;
        }