summaryrefslogtreecommitdiff
path: root/packages/SoundPicker/src
diff options
context:
space:
mode:
authorwan.li <wan.li@unisoc.com>2020-09-07 12:00:04 +0800
committerbing liang <bing.liang@unisoc.com>2020-09-18 09:30:44 +0000
commit7fc3eab71065b7022547da4bd5f6045634f42ed2 (patch)
tree7c3fa90abc3d9a5ffb85f684da108dad3db55fc2 /packages/SoundPicker/src
parentfc6fbde5dfaf9690251a8a399d627c45ac03f7cd (diff)
Add the return branch when ringtone position is POS_UNKNOWN
When the getCheckItem is POS_UNKNOWN, it is not the case we expected. We return null for this case. Test: manual start RingtonePickerActivity to use EXTRA_RINGTONE_SHOW_DEFAULT false and EXTRA_RINGTONE_SHOW_SILENT false. Check the returned EXTRA_RINGTONE_PICKED_URI, it should be null. Bug: 165892509 Change-Id: Id473dad2e8672a65e5c1b0fee16a7d22e9bcb3e9
Diffstat (limited to 'packages/SoundPicker/src')
-rw-r--r--packages/SoundPicker/src/com/android/soundpicker/RingtonePickerActivity.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/packages/SoundPicker/src/com/android/soundpicker/RingtonePickerActivity.java b/packages/SoundPicker/src/com/android/soundpicker/RingtonePickerActivity.java
index d2f168eb5e3e..285730884a14 100644
--- a/packages/SoundPicker/src/com/android/soundpicker/RingtonePickerActivity.java
+++ b/packages/SoundPicker/src/com/android/soundpicker/RingtonePickerActivity.java
@@ -584,15 +584,19 @@ public final class RingtonePickerActivity extends AlertActivity implements
}
private Uri getCurrentlySelectedRingtoneUri() {
- if (getCheckedItem() == mDefaultRingtonePos) {
- // Use the default Uri that they originally gave us.
- return mUriForDefaultItem;
- } else if (getCheckedItem() == mSilentPos) {
- // Use a null Uri for the 'Silent' item.
- return null;
- } else {
- return mRingtoneManager.getRingtoneUri(getRingtoneManagerPosition(getCheckedItem()));
- }
+ if (getCheckedItem() == POS_UNKNOWN) {
+ // When the getCheckItem is POS_UNKNOWN, it is not the case we expected.
+ // We return null for this case.
+ return null;
+ } else if (getCheckedItem() == mDefaultRingtonePos) {
+ // Use the default Uri that they originally gave us.
+ return mUriForDefaultItem;
+ } else if (getCheckedItem() == mSilentPos) {
+ // Use a null Uri for the 'Silent' item.
+ return null;
+ } else {
+ return mRingtoneManager.getRingtoneUri(getRingtoneManagerPosition(getCheckedItem()));
+ }
}
private void saveAnyPlayingRingtone() {