Merge "Keyguard sound needs to hold wake lock."
This commit is contained in:
committed by
Android (Google) Code Review
commit
dda868cd33
@ -204,6 +204,21 @@ public class Ringtone {
|
|||||||
openMediaPlayer();
|
openMediaPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void setWakeMode(Context context, int mode) {
|
||||||
|
if (mAudio == null) {
|
||||||
|
try {
|
||||||
|
openMediaPlayer();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Log.e(TAG, "setWakeMode() caught ", ex);
|
||||||
|
mAudio = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mAudio != null) {
|
||||||
|
mAudio.setWakeMode(context, mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays the ringtone.
|
* Plays the ringtone.
|
||||||
*/
|
*/
|
||||||
|
@ -1054,6 +1054,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
|
|||||||
final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
|
final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
|
||||||
if (sfx != null) {
|
if (sfx != null) {
|
||||||
sfx.setStreamType(AudioManager.STREAM_SYSTEM);
|
sfx.setStreamType(AudioManager.STREAM_SYSTEM);
|
||||||
|
sfx.setWakeMode(mContext, PowerManager.PARTIAL_WAKE_LOCK);
|
||||||
sfx.play();
|
sfx.play();
|
||||||
} else {
|
} else {
|
||||||
if (DEBUG) Log.d(TAG, "playSounds: failed to load ringtone from uri: "
|
if (DEBUG) Log.d(TAG, "playSounds: failed to load ringtone from uri: "
|
||||||
|
Reference in New Issue
Block a user