Settings: Phone ringtone setting for Multi SIM device [2/3]
Support displaying phone ringtone setting for each slot as follows: "Phone ringtone - SIM 1" "Phone ringtone - SIM 2" The purpose is to distinguish incoming call from each slot by ringtone. Depends-On: I9c6ccff938122332d222853d469ad9a623c7d193 Bug: 118735436 Test: Manual Change-Id: I06c59016e9b6da51ed8a4678a66674fc48c20e40 Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
This commit is contained in:
@@ -40,6 +40,7 @@ import androidx.preference.PreferenceManager;
|
||||
* <p>
|
||||
* If the user chooses the "Default" item, the saved string will be one of
|
||||
* {@link System#DEFAULT_RINGTONE_URI},
|
||||
* {@link System#DEFAULT_RINGTONE2_URI},
|
||||
* {@link System#DEFAULT_NOTIFICATION_URI}, or
|
||||
* {@link System#DEFAULT_ALARM_ALERT_URI}. If the user chooses the "Silent"
|
||||
* item, the saved string will be an empty string.
|
||||
@@ -56,6 +57,9 @@ public class RingtonePreference extends Preference {
|
||||
private static final String TAG = "RingtonePreference";
|
||||
private static final String GOOGLE_SP_PKG_NAME = "com.google.android.soundpicker";
|
||||
|
||||
// Default is slot0
|
||||
private int mSlotId = 0;
|
||||
|
||||
private int mRingtoneType;
|
||||
private boolean mShowDefault;
|
||||
private boolean mShowSilent;
|
||||
@@ -97,6 +101,25 @@ public class RingtonePreference extends Preference {
|
||||
return mUserId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the slot id that this preference belongs to.
|
||||
*
|
||||
* @param slotId The slot id that this preference belongs to.
|
||||
*/
|
||||
public void setSlotId(int slotId) {
|
||||
mSlotId = slotId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the slot id that this preference belongs to.
|
||||
*
|
||||
* @return The slot id that this preference belongs to.
|
||||
* @see #setSlotId(int)
|
||||
*/
|
||||
public int getSlotId() {
|
||||
return mSlotId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound type(s) that are shown in the picker.
|
||||
*
|
||||
@@ -175,7 +198,7 @@ public class RingtonePreference extends Preference {
|
||||
ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, mShowDefault);
|
||||
if (mShowDefault) {
|
||||
ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
|
||||
RingtoneManager.getDefaultUri(getRingtoneType()));
|
||||
RingtoneManager.getDefaultUriBySlot(getRingtoneType(), getSlotId()));
|
||||
}
|
||||
|
||||
ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, mShowSilent);
|
||||
|
||||
Reference in New Issue
Block a user