mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 830425 - Phone takes too long to wake up for incoming phone calls (acquire and release wake locks in RadioInterfaceLayer.js). r=philikon a=tef+
This commit is contained in:
parent
4dfec8f0a4
commit
8c1e40b864
@ -61,6 +61,8 @@ const DOM_SMS_DELIVERY_SENDING = "sending";
|
|||||||
const DOM_SMS_DELIVERY_SENT = "sent";
|
const DOM_SMS_DELIVERY_SENT = "sent";
|
||||||
const DOM_SMS_DELIVERY_ERROR = "error";
|
const DOM_SMS_DELIVERY_ERROR = "error";
|
||||||
|
|
||||||
|
const CALL_WAKELOCK_TIMEOUT = 5000;
|
||||||
|
|
||||||
const RIL_IPC_TELEPHONY_MSG_NAMES = [
|
const RIL_IPC_TELEPHONY_MSG_NAMES = [
|
||||||
"RIL:EnumerateCalls",
|
"RIL:EnumerateCalls",
|
||||||
"RIL:GetMicrophoneMuted",
|
"RIL:GetMicrophoneMuted",
|
||||||
@ -107,6 +109,10 @@ const RIL_IPC_CELLBROADCAST_MSG_NAMES = [
|
|||||||
"RIL:RegisterCellBroadcastMsg"
|
"RIL:RegisterCellBroadcastMsg"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyServiceGetter(this, "gPowerManagerService",
|
||||||
|
"@mozilla.org/power/powermanagerservice;1",
|
||||||
|
"nsIPowerManagerService");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "gSmsService",
|
XPCOMUtils.defineLazyServiceGetter(this, "gSmsService",
|
||||||
"@mozilla.org/sms/smsservice;1",
|
"@mozilla.org/sms/smsservice;1",
|
||||||
"nsISmsService");
|
"nsISmsService");
|
||||||
@ -1237,6 +1243,18 @@ RadioInterfaceLayer.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_callRingWakeLock: null,
|
||||||
|
_callRingWakeLockTimer: null,
|
||||||
|
_cancelCallRingWakeLockTimer: function _cancelCallRingWakeLockTimer() {
|
||||||
|
if (this._callRingWakeLockTimer) {
|
||||||
|
this._callRingWakeLockTimer.cancel();
|
||||||
|
}
|
||||||
|
if (this._callRingWakeLock) {
|
||||||
|
this._callRingWakeLock.unlock();
|
||||||
|
this._callRingWakeLock = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle an incoming call.
|
* Handle an incoming call.
|
||||||
*
|
*
|
||||||
@ -1244,6 +1262,17 @@ RadioInterfaceLayer.prototype = {
|
|||||||
* to start bringing up the Phone app already.
|
* to start bringing up the Phone app already.
|
||||||
*/
|
*/
|
||||||
handleCallRing: function handleCallRing() {
|
handleCallRing: function handleCallRing() {
|
||||||
|
if (!this._callRingWakeLock) {
|
||||||
|
this._callRingWakeLock = gPowerManagerService.newWakeLock("cpu");
|
||||||
|
}
|
||||||
|
if (!this._callRingWakeLockTimer) {
|
||||||
|
this._callRingWakeLockTimer =
|
||||||
|
Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||||
|
}
|
||||||
|
this._callRingWakeLockTimer
|
||||||
|
.initWithCallback(this._cancelCallRingWakeLockTimer.bind(this),
|
||||||
|
CALL_WAKELOCK_TIMEOUT, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||||
|
|
||||||
gSystemMessenger.broadcastMessage("telephony-new-call", {});
|
gSystemMessenger.broadcastMessage("telephony-new-call", {});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1724,6 +1753,8 @@ RadioInterfaceLayer.prototype = {
|
|||||||
for (let msgname of RIL_IPC_CELLBROADCAST_MSG_NAMES) {
|
for (let msgname of RIL_IPC_CELLBROADCAST_MSG_NAMES) {
|
||||||
ppmm.removeMessageListener(msgname, this);
|
ppmm.removeMessageListener(msgname, this);
|
||||||
}
|
}
|
||||||
|
// Cancel the timer for the call-ring wake lock.
|
||||||
|
this._cancelCallRingWakeLockTimer();
|
||||||
// Shutdown all RIL network interfaces
|
// Shutdown all RIL network interfaces
|
||||||
this.dataNetworkInterface.shutdown();
|
this.dataNetworkInterface.shutdown();
|
||||||
this.mmsNetworkInterface.shutdown();
|
this.mmsNetworkInterface.shutdown();
|
||||||
|
Loading…
Reference in New Issue
Block a user