diff options
| author | 2023-02-21 17:39:59 +0800 | |
|---|---|---|
| committer | 2023-02-21 17:54:57 +0800 | |
| commit | 111ad9578841c63fe9328c8017886d3ca8441b4b (patch) | |
| tree | 4889c741cb45ec28ec9d1512d64411c2e4c7e3a2 | |
| parent | e2f4f71ca221c1b062399b0725981e9289d8639e (diff) | |
RingtoneManager#setActualDefaultRingtone() open OutputStream of cacheUri with "wt" mode
the default mode is "w",if the cache file is not deleted successfully before openOutputStream and the size of new ringtone is smaller than old rongtone,the cache file will be a mixture of old and new ringtone.
Bug: 263074833
Change-Id: Ib7a0bf5e2a9f695aa4701c91c0b79c6bce2d76f1
| -rw-r--r-- | media/java/android/media/RingtoneManager.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/media/java/android/media/RingtoneManager.java b/media/java/android/media/RingtoneManager.java index 27db41cb9f4e..171349a26569 100644 --- a/media/java/android/media/RingtoneManager.java +++ b/media/java/android/media/RingtoneManager.java @@ -841,7 +841,7 @@ public class RingtoneManager { if (ringtoneUri != null) { final Uri cacheUri = getCacheForType(type, context.getUserId()); try (InputStream in = openRingtone(context, ringtoneUri); - OutputStream out = resolver.openOutputStream(cacheUri)) { + OutputStream out = resolver.openOutputStream(cacheUri, "wt")) { FileUtils.copy(in, out); } catch (IOException e) { Log.w(TAG, "Failed to cache ringtone: " + e); |