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();
|
||||
}
|
||||
|
||||
/** @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.
|
||||
*/
|
||||
|
@ -1054,6 +1054,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
|
||||
final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
|
||||
if (sfx != null) {
|
||||
sfx.setStreamType(AudioManager.STREAM_SYSTEM);
|
||||
sfx.setWakeMode(mContext, PowerManager.PARTIAL_WAKE_LOCK);
|
||||
sfx.play();
|
||||
} else {
|
||||
if (DEBUG) Log.d(TAG, "playSounds: failed to load ringtone from uri: "
|
||||
|
Reference in New Issue
Block a user