Set HAS_CONTENT field from the app after writing audio content.

In change-id I93e4b467acdefe339fa70dd751ea05f195c32e71 content voicemail
content provider was modified to no more automatically set the
has_content field. The app now needs to set this field itself after
writing the content.

bug: 5147190
Change-Id: If3c66a86803f7587677c2ec09965b89f31f6268e
This commit is contained in:
Debashish Chatterjee
2011-08-11 12:13:52 +01:00
parent f9e27297b0
commit b01f5d5251
3 changed files with 59 additions and 20 deletions

View File

@@ -206,13 +206,10 @@ public class AddVoicemailActivity extends Activity {
Uri newVoicemailUri = mVoicemailProviderHelper.insert(voicemail);
logger.i("Inserted new voicemail URI: " + newVoicemailUri);
if (inputAudioStream != null) {
OutputStream outputStream = null;
try {
outputStream = mVoicemailProviderHelper.setVoicemailContent(
newVoicemailUri, getContentResolver().getType(recordingUri));
copyStreamData(inputAudioStream, outputStream);
mVoicemailProviderHelper.setVoicemailContent(newVoicemailUri, inputAudioStream,
getContentResolver().getType(recordingUri));
} finally {
CloseUtils.closeQuietly(outputStream);
CloseUtils.closeQuietly(inputAudioStream);
}
}
@@ -228,13 +225,5 @@ public class AddVoicemailActivity extends Activity {
}
}
private void copyStreamData(InputStream in, OutputStream out) throws IOException {
// Copy 8K chunk at a time.
byte[] data = new byte[8 * 1024];
int numBytes;
while ((numBytes = in.read(data)) > 0) {
out.write(data, 0, numBytes);
}
}
}
}