summaryrefslogtreecommitdiff
path: root/java/com/android/voicemail/impl/utils
diff options
context:
space:
mode:
authormdooley <mdooley@google.com>2017-11-29 08:53:31 -0800
committerCopybara-Service <copybara-piper@google.com>2017-11-29 11:50:44 -0800
commitb9ca335dbbc3325643549f6fbf2dac06a5502d26 (patch)
tree0145604277fbcf00e8bf48b835a5a9d7fb922e40 /java/com/android/voicemail/impl/utils
parent00d18e0efe89d7bbd4c69de6988ef6f9a62df782 (diff)
Delete voicemails when disabling visual voicemail
For privacy reasons we now delete all voicemails and transcriptions when the user disables visual voicemail, (after confirming that they want to do this via a dialog). Note: we only delete voicemails whose source package is the google dialer. Note: the voicemails will be re-downloaded and re-transcribed if the user re-enables visual voicemail Bug: 69323147 Test: manual and unit test PiperOrigin-RevId: 177315139 Change-Id: Ie04496dc5960b485794733fbf74f7f704e806023
Diffstat (limited to 'java/com/android/voicemail/impl/utils')
-rw-r--r--java/com/android/voicemail/impl/utils/VoicemailDatabaseUtil.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/java/com/android/voicemail/impl/utils/VoicemailDatabaseUtil.java b/java/com/android/voicemail/impl/utils/VoicemailDatabaseUtil.java
index 711d6a8a4..ef5447d32 100644
--- a/java/com/android/voicemail/impl/utils/VoicemailDatabaseUtil.java
+++ b/java/com/android/voicemail/impl/utils/VoicemailDatabaseUtil.java
@@ -57,6 +57,16 @@ public class VoicemailDatabaseUtil {
return voicemails.size();
}
+ /**
+ * Delete all the voicemails whose source_package field matches this package
+ *
+ * @return the number of voicemails deleted
+ */
+ public static int deleteAll(Context context) {
+ ContentResolver contentResolver = context.getContentResolver();
+ return contentResolver.delete(Voicemails.buildSourceUri(context.getPackageName()), null, null);
+ }
+
/** Maps structured {@link Voicemail} to {@link ContentValues} in content provider. */
private static ContentValues getContentValues(Voicemail voicemail) {
ContentValues contentValues = new ContentValues();