private DisplayRecord.Body getPlaintextBody(Cursor cursor) { try { long type = cursor.getLong(cursor.getColumnIndexOrThrow(ThreadDatabase.SNIPPET_TYPE)); String body = cursor.getString(cursor.getColumnIndexOrThrow(SNIPPET)); if (!TextUtils.isEmpty(body) && masterCipher != null && MmsSmsColumns.Types.isSymmetricEncryption(type)) { return new DisplayRecord.Body(masterCipher.decryptBody(body), true); } else if (!TextUtils.isEmpty(body) && masterCipher == null && MmsSmsColumns.Types.isSymmetricEncryption(type)) { return new DisplayRecord.Body(body, false); } else { return new DisplayRecord.Body(body, true); } } catch (InvalidMessageException e) { Log.w("ThreadDatabase", e); return new DisplayRecord.Body( context.getString(R.string.ThreadDatabase_error_decrypting_message), true); } }