Skip to content
Permalink
Browse files

Merge pull request #18201 from etiennesegonzac/instacallscreen

Bug 990003 - Introducing a dedicated callscreen app for better performance r=rik, alive, 21
  • Loading branch information
etiennesegonzac committed Apr 15, 2014
2 parents 5576f45 + e693c37 commit 7afce8a6e965a45f38988227828ccdfb315394f3
Showing with 867 additions and 690 deletions.
  1. +22 −18 apps/{communications/dialer/oncall.html → callscreen/index.html}
  2. 0 apps/{communications/dialer → callscreen}/js/bluetooth_helper.js
  3. +21 −11 apps/{communications/dialer → callscreen}/js/call_screen.js
  4. +12 −58 apps/{communications/dialer → callscreen}/js/calls_handler.js
  5. 0 apps/{communications/dialer → callscreen}/js/conference_group_handler.js
  6. +39 −0 apps/callscreen/js/fake-oncall-desktop.js
  7. 0 apps/{communications/dialer → callscreen}/js/handled_call.js
  8. +10 −0 apps/callscreen/js/index.js
  9. +14 −0 apps/callscreen/locales/locales.ini
  10. +35 −0 apps/callscreen/manifest.webapp
  11. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_audiosourcemenu.png
  12. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_audiosourcemenu@1.5x.png
  13. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_audiosourcemenu@2x.png
  14. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_dialpad.png
  15. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_dialpad@1.5x.png
  16. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_dialpad@2x.png
  17. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_hangup.png
  18. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_hold.png
  19. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_hold@1.5x.png
  20. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_hold@2x.png
  21. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_mute.png
  22. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_mute@1.5x.png
  23. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_mute@2x.png
  24. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_pickup.png
  25. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_placenewcall.png
  26. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_placenewcall@1.5x.png
  27. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_placenewcall@2x.png
  28. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_speaker.png
  29. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_speaker@1.5x.png
  30. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_speaker@2x.png
  31. BIN apps/{communications/dialer → callscreen}/style/images/ActionIcon_40x40_switchlines.png
  32. BIN apps/{communications/dialer → callscreen}/style/images/DialerIcon_35x35_paused.png
  33. BIN apps/{communications/dialer → callscreen}/style/images/DialerIcon_35x35_paused@1.5x.png
  34. BIN apps/{communications/dialer → callscreen}/style/images/DialerIcon_35x35_paused@2x.png
  35. BIN apps/{communications/dialer → callscreen}/style/images/Shadow_SwitchBg.png
  36. BIN apps/{communications/dialer → callscreen}/style/images/btn_hang_up.png
  37. BIN apps/{communications/dialer → callscreen}/style/images/btn_pick_up.png
  38. BIN apps/{communications/dialer → callscreen}/style/images/btn_resume.png
  39. BIN apps/{communications/dialer → callscreen}/style/images/btn_switchlines.png
  40. BIN apps/{communications/dialer → callscreen}/style/images/btn_switchlines_press.png
  41. BIN apps/{communications/dialer → callscreen}/style/images/green-noise-bg.png
  42. BIN apps/{communications/dialer → callscreen}/style/images/hangup_icon.png
  43. BIN apps/{communications/dialer → callscreen}/style/images/hangup_icon@1.5x.png
  44. BIN apps/{communications/dialer → callscreen}/style/images/hangup_icon@2x.png
  45. BIN apps/{communications/dialer → callscreen}/style/images/hangup_icon_pressed.png
  46. BIN apps/{communications/dialer → callscreen}/style/images/hangup_icon_pressed@1.5x.png
  47. BIN apps/{communications/dialer → callscreen}/style/images/hangup_icon_pressed@2x.png
  48. BIN apps/{communications/dialer → callscreen}/style/images/hold_icon.png
  49. BIN apps/{communications/dialer → callscreen}/style/images/hold_icon@1.5x.png
  50. BIN apps/{communications/dialer → callscreen}/style/images/hold_icon@2x.png
  51. BIN apps/{communications/dialer → callscreen}/style/images/icon_mergecall.png
  52. BIN apps/{communications/dialer → callscreen}/style/images/icon_mergecall@1.5x.png
  53. BIN apps/{communications/dialer → callscreen}/style/images/icon_mergecall@2x.png
  54. BIN apps/{communications/dialer → callscreen}/style/images/incoming-call.png
  55. BIN apps/{communications/dialer → callscreen}/style/images/incoming-call@1.5x.png
  56. BIN apps/{communications/dialer → callscreen}/style/images/incoming-call@2x.png
  57. BIN apps/{communications/dialer → callscreen}/style/images/incoming_icon.png
  58. BIN apps/{communications/dialer → callscreen}/style/images/incoming_icon@1.5x.png
  59. BIN apps/{communications/dialer → callscreen}/style/images/incoming_icon@2x.png
  60. BIN apps/{communications/dialer → callscreen}/style/images/larrow.png
  61. BIN apps/{communications/dialer → callscreen}/style/images/larrow@1.5x.png
  62. BIN apps/{communications/dialer → callscreen}/style/images/mask.png
  63. BIN apps/{communications/dialer → callscreen}/style/images/outgoing-call.png
  64. BIN apps/{communications/dialer → callscreen}/style/images/outgoing-call@1.5x.png
  65. BIN apps/{communications/dialer → callscreen}/style/images/outgoing-call@2x.png
  66. BIN apps/{communications/dialer → callscreen}/style/images/outgoing_icon.png
  67. BIN apps/{communications/dialer → callscreen}/style/images/outgoing_icon@1.5x.png
  68. BIN apps/{communications/dialer → callscreen}/style/images/outgoing_icon@2x.png
  69. BIN apps/{communications/dialer → callscreen}/style/images/pickup_icon.png
  70. BIN apps/{communications/dialer → callscreen}/style/images/pickup_icon@1.5x.png
  71. BIN apps/{communications/dialer → callscreen}/style/images/pickup_icon@2x.png
  72. BIN apps/{communications/dialer → callscreen}/style/images/pickup_icon_pressed.png
  73. BIN apps/{communications/dialer → callscreen}/style/images/pickup_icon_pressed@1.5x.png
  74. BIN apps/{communications/dialer → callscreen}/style/images/pickup_icon_pressed@2x.png
  75. BIN apps/{communications/dialer → callscreen}/style/images/picture_emergency.png
  76. BIN apps/{communications/dialer → callscreen}/style/images/picture_emergency@1.5x.png
  77. BIN apps/{communications/dialer → callscreen}/style/images/picture_emergency@2x.png
  78. BIN apps/{communications/dialer → callscreen}/style/images/proceed.png
  79. BIN apps/{communications/dialer → callscreen}/style/images/proceed@1.5x.png
  80. BIN apps/{communications/dialer → callscreen}/style/images/proceed@2x.png
  81. BIN apps/{communications/dialer → callscreen}/style/images/rarrow.png
  82. BIN apps/{communications/dialer → callscreen}/style/images/status_bar/hold_icon.png
  83. BIN apps/{communications/dialer → callscreen}/style/images/status_bar/hold_icon@1.5x.png
  84. BIN apps/{communications/dialer → callscreen}/style/images/status_bar/hold_icon@2x.png
  85. BIN apps/{communications/dialer → callscreen}/style/images/status_bar/incoming_icon.png
  86. BIN apps/{communications/dialer → callscreen}/style/images/status_bar/incoming_icon@1.5x.png
  87. BIN apps/{communications/dialer → callscreen}/style/images/status_bar/incoming_icon@2x.png
  88. BIN apps/{communications/dialer → callscreen}/style/images/status_bar/muted_icon.png
  89. BIN apps/{communications/dialer → callscreen}/style/images/status_bar/muted_icon@1.5x.png
  90. BIN apps/{communications/dialer → callscreen}/style/images/status_bar/muted_icon@2x.png
  91. BIN apps/{communications/dialer → callscreen}/style/images/status_bar/outgoing_icon.png
  92. BIN apps/{communications/dialer → callscreen}/style/images/status_bar/outgoing_icon@1.5x.png
  93. BIN apps/{communications/dialer → callscreen}/style/images/status_bar/outgoing_icon@2x.png
  94. +1 −1 apps/{communications/dialer → callscreen}/style/oncall.css
  95. 0 apps/{communications/dialer → callscreen}/style/oncall_status_bar.css
  96. 0 apps/{communications/dialer → callscreen}/style/status.css
  97. 0 apps/{communications/dialer → callscreen}/style/swiper.css
  98. +17 −0 apps/callscreen/test/unit/.jshintrc
  99. +2 −2 apps/{communications/dialer → callscreen}/test/unit/bluetooth_helper_test.js
  100. +5 −6 apps/{communications/dialer → callscreen}/test/unit/call_screen_test.js
  101. +146 −17 apps/{communications/dialer → callscreen}/test/unit/calls_handler_test.js
  102. +6 −6 apps/{communications/dialer → callscreen}/test/unit/conference_group_handler_test.js
  103. +11 −12 apps/{communications/dialer → callscreen}/test/unit/handled_call_test.js
  104. 0 apps/{communications/dialer → callscreen}/test/unit/mock_bluetooth_helper.js
  105. 0 apps/{communications/dialer → callscreen}/test/unit/mock_call_screen.js
  106. 0 apps/{communications/dialer → callscreen}/test/unit/mock_mozbluetooth.js
  107. 0 apps/{communications/dialer → callscreen}/test/unit/mock_simple_phone_matcher.js
  108. +5 −0 apps/callscreen/test/unit/setup.js
  109. +12 −6 apps/communications/dialer/index.html
  110. +1 −1 apps/communications/dialer/js/call_log.js
  111. +2 −2 apps/communications/dialer/js/call_log_db.js
  112. +46 −191 apps/communications/dialer/js/dialer.js
  113. +0 −48 apps/communications/dialer/js/fake-oncall-desktop.js
  114. +0 −17 apps/communications/dialer/js/oncall.js
  115. +1 −1 apps/communications/dialer/js/suggestion_bar.js
  116. +3 −2 apps/communications/dialer/test/unit/call_log_db_test.js
  117. +3 −2 apps/communications/dialer/test/unit/call_log_test.js
  118. +40 −4 apps/communications/dialer/test/unit/dialer_test.js
  119. +7 −7 apps/communications/dialer/test/unit/keypad_test.js
  120. +1 −1 apps/communications/dialer/test/unit/mmi_test.js
  121. +0 −49 apps/communications/dialer/test/unit/mock_dialer_oncall.html
  122. +0 −9 apps/communications/dialer/test/unit/mock_dialer_oncall.html.js
  123. +1 −1 apps/communications/dialer/test/unit/multi_sim_action_button_test.js
  124. +1 −1 apps/communications/dialer/test/unit/phone_action_menu_test.js
  125. +1 −1 apps/communications/dialer/test/unit/sim_picker_test.js
  126. +3 −3 apps/communications/dialer/test/unit/suggestion_bar_test.js
  127. +3 −3 apps/communications/dialer/test/unit/telephony_helper_test.js
  128. +2 −2 apps/communications/dialer/test/unit/utils_test.js
  129. +3 −3 apps/communications/dialer/test/unit/voicemail_test.js
  130. +0 −3 apps/communications/manifest.webapp
  131. +1 −1 apps/system/index.html
  132. +34 −10 apps/system/js/attention_screen.js
  133. +1 −1 apps/system/js/bootstrap.js
  134. +70 −18 apps/system/js/{dialer_ringer.js → dialer_agent.js}
  135. +9 −2 apps/system/style/attention_screen.css
  136. +3 −3 apps/system/test/unit/bootstrap_test.js
  137. +158 −27 apps/system/test/unit/{dialer_ringer_test.js → dialer_agent_test.js}
  138. +2 −0 apps/system/test/unit/mock_attention_screen.js
  139. +7 −0 apps/system/test/unit/mock_dialer_agent.js
  140. +0 −7 apps/system/test/unit/mock_dialer_ringer.js
  141. +2 −2 build/csslint/xfail.list
  142. +27 −64 build/jshint/xfail.list
  143. +8 −2 build/webapp-zip.js
  144. 0 {apps/communications/dialer/js → shared/js/dialer}/contacts.js
  145. +5 −1 {apps/communications/dialer/js → shared/js/dialer}/keypad.js
  146. +12 −12 {apps/communications/dialer/js → shared/js/dialer}/tone_player.js
  147. 0 {apps/communications/dialer/js → shared/js/dialer}/utils.js
  148. 0 {apps/communications/dialer/js → shared/js/dialer}/voicemail.js
  149. BIN {apps/communications/dialer/resources → shared/resources/media}/tones/tone_0.opus
  150. BIN {apps/communications/dialer/resources → shared/resources/media}/tones/tone_1.opus
  151. BIN {apps/communications/dialer/resources → shared/resources/media}/tones/tone_2.opus
  152. BIN {apps/communications/dialer/resources → shared/resources/media}/tones/tone_3.opus
  153. BIN {apps/communications/dialer/resources → shared/resources/media}/tones/tone_4.opus
  154. BIN {apps/communications/dialer/resources → shared/resources/media}/tones/tone_5.opus
  155. BIN {apps/communications/dialer/resources → shared/resources/media}/tones/tone_6.opus
  156. BIN {apps/communications/dialer/resources → shared/resources/media}/tones/tone_7.opus
  157. BIN {apps/communications/dialer/resources → shared/resources/media}/tones/tone_8.opus
  158. BIN {apps/communications/dialer/resources → shared/resources/media}/tones/tone_9.opus
  159. BIN {apps/communications/dialer/resources → shared/resources/media}/tones/tone_hash.opus
  160. BIN {apps/communications/dialer/resources → shared/resources/media}/tones/tone_star.opus
  161. +15 −15 {apps/communications/dialer/style → shared/style/dialer}/keypad.css
  162. BIN .../communications/dialer/style → shared/style/dialer/keypad}/images/ActionIcon_40x40_addcontact.png
  163. BIN ...unications/dialer/style → shared/style/dialer/keypad}/images/ActionIcon_40x40_addcontact@1.5x.png
  164. BIN ...mmunications/dialer/style → shared/style/dialer/keypad}/images/ActionIcon_40x40_addcontact@2x.png
  165. BIN shared/style/dialer/keypad/images/ActionIcon_40x40_hangup.png
  166. BIN ...communications/dialer/style → shared/style/dialer/keypad}/images/ActionIcon_40x40_hangup@1.5x.png
  167. BIN ...s/communications/dialer/style → shared/style/dialer/keypad}/images/ActionIcon_40x40_hangup@2x.png
  168. BIN shared/style/dialer/keypad/images/ActionIcon_40x40_pickup.png
  169. BIN ...communications/dialer/style → shared/style/dialer/keypad}/images/ActionIcon_40x40_pickup@1.5x.png
  170. BIN ...s/communications/dialer/style → shared/style/dialer/keypad}/images/ActionIcon_40x40_pickup@2x.png
  171. BIN ...ons/dialer/style → shared/style/dialer/keypad}/images/ActionIcons_30x30_dismiss_keyboard@1.5x.png
  172. BIN ...tions/dialer/style → shared/style/dialer/keypad}/images/ActionIcons_30x30_dismiss_keyboard@2x.png
  173. BIN ...ications/dialer/style → shared/style/dialer/keypad}/images/ActionIcons_40x40_dismiss_keyboard.png
  174. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/asterisk.png
  175. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/asterisk@1.5x.png
  176. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/asterisk@2x.png
  177. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/btn_generic.png
  178. BIN shared/style/dialer/keypad/images/btn_hang_up.png
  179. BIN shared/style/dialer/keypad/images/btn_pick_up.png
  180. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/dialer_icon_delete.png
  181. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/dialer_icon_delete@1.5x.png
  182. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/dialer_icon_delete@2x.png
  183. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/icon_arrow_white.png
  184. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/sharp.png
  185. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/sharp@1.5x.png
  186. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/sharp@2x.png
  187. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/voicemail.png
  188. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/voicemail@1.5x.png
  189. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/voicemail@2x.png
  190. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/voicemail_.png
  191. BIN {apps/communications/dialer/style → shared/style/dialer/keypad}/images/voicemail_@1.5x.png
  192. 0 {apps/communications/dialer/style → shared/style/dialer}/overlay.css
  193. 0 {apps/communications/dialer/test/unit → shared/test/unit/mocks/dialer}/mock_call.js
  194. 0 {apps/communications/dialer/test/unit → shared/test/unit/mocks/dialer}/mock_calls_handler.js
  195. 0 {apps/communications/dialer/test/unit → shared/test/unit/mocks/dialer}/mock_contacts.js
  196. +34 −0 {apps/communications/dialer/test/unit → shared/test/unit/mocks/dialer}/mock_handled_call.js
  197. 0 {apps/communications/dialer/test/unit → shared/test/unit/mocks/dialer}/mock_keypad.js
  198. 0 apps/communications/dialer/test/unit/mock_l10n.js → shared/test/unit/mocks/dialer/mock_lazy_l10n.js
  199. +1 −0 {apps/communications/dialer/test/unit → shared/test/unit/mocks/dialer}/mock_tone_player.js
  200. 0 {apps/communications/dialer/test/unit → shared/test/unit/mocks/dialer}/mock_utils.js
  201. +0 −35 shared/test/unit/mocks/mock_navigator_moz_telephony.js
  202. +2 −2 tests/python/gaia-ui-tests/gaiatest/apps/phone/regions/call_screen.py
@@ -4,41 +4,45 @@
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
<meta charset="utf-8">
<title>Dialer</title>
<link rel="stylesheet" type="text/css" href="/dialer/style/oncall.css">
<link rel="stylesheet" type="text/css" href="/dialer/style/oncall_status_bar.css">
<link rel="stylesheet" type="text/css" href="/dialer/style/keypad.css">
<link rel="stylesheet" type="text/css" href="/dialer/style/status.css">
<link rel="stylesheet" type="text/css" href="/dialer/style/overlay.css">
<link rel="stylesheet" type="text/css" href="/style/oncall.css">
<link rel="stylesheet" type="text/css" href="/style/oncall_status_bar.css">
<link rel="stylesheet" type="text/css" href="/style/status.css">

<link rel="stylesheet" type="text/css" href="/shared/style/dialer/keypad.css">
<link rel="stylesheet" type="text/css" href="/shared/style/dialer/overlay.css">

<link rel="stylesheet" type="text/css" href="/shared/style/status.css">
<link rel="stylesheet" type="text/css" href="/shared/style/action_menu.css">

<!-- Localization -->
<script defer type="text/javascript" src="/shared/js/lazy_loader.js"></script>
<script defer type="application/javascript" src="/shared/js/lazy_l10n.js"></script>
<link rel="resource" type="application/l10n" href="/dialer/locales/locales.ini">
<link rel="resource" type="application/l10n" href="/locales/locales.ini">
<link rel="resource" type="application/l10n" href="/shared/locales/date.ini">
<!-- Making sure the shared resources will be copy into the zip
<script type="application/javascript" src="/shared/js/l10n.js"></script>
<script type="application/javascript" src="/shared/js/l10n_date.js"></script>
<link rel="resource" type="application/json" href="shared/resources/media/tones/"/>
-->

<script defer type="application/javascript" src="/dialer/js/oncall.js"></script>
<script defer type="application/javascript" src="/js/index.js"></script>
<script defer type="application/javascript" src="/shared/js/settings_listener.js"></script>
<script defer type="application/javascript" src="/shared/js/settings_url.js"></script>
<script defer type="application/javascript" src="/shared/js/async_storage.js"></script>
<script defer type="application/javascript" src="/shared/js/contact_photo_helper.js"></script>

<script defer type="application/javascript" src="/shared/js/simple_phone_matcher.js"></script>
<script defer type="application/javascript" src="/dialer/js/contacts.js"></script>
<script defer type="application/javascript" src="/dialer/js/tone_player.js"></script>
<script defer type="application/javascript" src="/dialer/js/keypad.js"></script>
<script defer type="application/javascript" src="/dialer/js/utils.js"></script>
<script defer type="application/javascript" src="/dialer/js/call_screen.js"></script>
<script defer type="application/javascript" src="/dialer/js/bluetooth_helper.js"></script>
<script defer type="application/javascript" src="/dialer/js/calls_handler.js"></script>
<script defer type="application/javascript" src="/dialer/js/conference_group_handler.js"></script>
<script defer type="application/javascript" src="/dialer/js/voicemail.js"></script>
<script defer type="application/javascript" src="/dialer/js/handled_call.js"></script>
<script defer type="application/javascript" src="/shared/js/dialer/contacts.js"></script>
<script defer type="application/javascript" src="/shared/js/dialer/tone_player.js"></script>
<script defer type="application/javascript" src="/shared/js/dialer/keypad.js"></script>
<script defer type="application/javascript" src="/shared/js/dialer/utils.js"></script>
<script defer type="application/javascript" src="/shared/js/dialer/voicemail.js"></script>

<script defer type="application/javascript" src="/js/call_screen.js"></script>
<script defer type="application/javascript" src="/js/bluetooth_helper.js"></script>
<script defer type="application/javascript" src="/js/calls_handler.js"></script>
<script defer type="application/javascript" src="/js/conference_group_handler.js"></script>
<script defer type="application/javascript" src="/js/handled_call.js"></script>

<!-- Lazy load these:
<script defer type="application/javascript" src="/shared/js/fb/fb_request.js"></script>
@@ -47,7 +51,7 @@
-->

<!-- incoming call / swiper on locked screen-->
<link rel="stylesheet" type="text/css" href="/dialer/style/swiper.css">
<link rel="stylesheet" type="text/css" href="/style/swiper.css">
<script defer src="/shared/js/lockscreen_slide.js"></script>
<script defer src="/shared/js/screen_layout.js"></script>
</head>
File renamed without changes.
@@ -137,24 +137,23 @@ var CallScreen = {

this.calls.addEventListener('click', CallsHandler.toggleCalls.bind(this));

if (window.location.hash === '#locked') {
this.showClock(new Date());
this.initLockScreenSlide();

if (!this.screen.dataset.layout) {
this.render('incoming-locked');
}
}

this.setWallpaper();

// Handle resize events
window.addEventListener('resize', this.resizeHandler.bind(this));
window.addEventListener('hashchange', this.hashchangeHandler.bind(this));
this.hashchangeHandler();

this.syncSpeakerEnabled();
},

_slideInitialized: false,
initLockScreenSlide: function cs_initLockScreenSlide() {
if (this._slideInitialized) {
return;
}
this._slideInitialized = true;

// Setup incoming call screen slider
this.hangUpIcon = document.getElementById('lockscreen-area-hangup');
this.pickUpIcon = document.getElementById('lockscreen-area-pickup');
@@ -183,8 +182,8 @@ var CallScreen = {
},

resources: {
larrow: '/dialer/style/images/larrow.png',
rarrow: '/dialer/style/images/rarrow.png'
larrow: '/style/images/larrow.png',
rarrow: '/style/images/rarrow.png'
},
handle: {
autoExpand: {
@@ -330,6 +329,17 @@ var CallScreen = {
}
},

hashchangeHandler: function cs_hashchangeHandler() {
if (window.location.hash.startsWith('#locked')) {
this.showClock(new Date());
this.initLockScreenSlide();

if (!this.screen.dataset.layout) {
this.render('incoming-locked');
}
}
},

toggleMute: function cs_toggleMute() {
this.muteButton.classList.toggle('active-state');
this.calls.classList.toggle('muted');
@@ -1,9 +1,6 @@
'use strict';

var CallsHandler = (function callsHandler() {
var COMMS_APP_ORIGIN = document.location.protocol + '//' +
document.location.host;

// Changing this will probably require markup changes
var CALLS_LIMIT = 2;

@@ -66,13 +63,8 @@ var CallsHandler = (function callsHandler() {
}
};

postToMainWindow('ready');
}

function postToMainWindow(data) {
if (window.opener) {
window.opener.postMessage(data, COMMS_APP_ORIGIN);
}
navigator.mozSetMessageHandler('headset-button', handleHSCommand);
navigator.mozSetMessageHandler('bluetooth-dialer-command', handleBTCommand);
}

/* === Handled calls === */
@@ -181,7 +173,7 @@ var CallsHandler = (function callsHandler() {
hc.show();
}
} else {
if (window.location.hash === '#locked' &&
if (window.location.hash.startsWith('#locked') &&
(call.state == 'incoming')) {
CallScreen.render('incoming-locked');
} else {
@@ -306,8 +298,6 @@ var CallsHandler = (function callsHandler() {

closing = true;

postToMainWindow('closing');

// If the screen is not displayed yet we close the window directly
if (animate && displayed) {
toggleScreen();
@@ -318,6 +308,7 @@ var CallsHandler = (function callsHandler() {

function closeWindow() {
closing = false;
TonePlayer.setChannel('normal');
window.close();
}

@@ -328,42 +319,19 @@ var CallsHandler = (function callsHandler() {
}
window.addEventListener('resize', updateAllPhoneNumberDisplays);

/* Handle commands send to the callscreen via postmessage */
function handleCommand(evt) {
if (evt.origin !== COMMS_APP_ORIGIN) {
return;
}
var message = evt.data;
if (!message) {
return;
}

// Currently managing three kinds of commands:
// BT: bluetooth
// HS: headset
// * : general cases, not specific to hardware control
switch (message.type) {
case 'BT':
handleBTCommand(message.command);
break;
case 'HS':
handleHSCommand(message.command);
break;
case '*':
handleGeneralCommand(message.command);
break;
}
}

/* === Bluetooth Headset support ===*/
function handleBTCommand(message) {
switch (message) {
var command = message['command'];
switch (command) {
case 'CHUP':
end();
break;
case 'ATA':
answer();
break;
case 'CHLD=0':
hangupWaitingCalls();
break;
case 'CHLD=1':
// End the active call and answer the other one
if ((handledCalls.length === 1) && !cdmaCallWaiting()) {
@@ -394,18 +362,16 @@ var CallsHandler = (function callsHandler() {
}
console.warn('Cannot join conference call.');
break;
case 'CHLD=0':
hangupWaitingCalls();
break;
default:
var partialCommand = message.substring(0, 3);
var partialCommand = command.substring(0, 3);
if (partialCommand === 'VTS') {
KeypadManager.press(message.substring(4));
KeypadManager.press(command.substring(4));
}
break;
}
}

/* Headset command support */
var lastHeadsetPress = 0;

function handleHSCommand(message) {
@@ -437,18 +403,6 @@ var CallsHandler = (function callsHandler() {
}
}

function handleGeneralCommand(message) {
// Calls might be ended before callscreen is completely loaded or we
// register 'callschanged' event. To avoid leaving callscreen stuck open,
// we use a simple postMessage protocol to know when the call screen is
// supposed to be closed, in addition to 'callschanged' event.
if (message == 'exitCallScreen') {
exitCallScreen(false);
}
}

window.addEventListener('message', handleCommand);

/* === User Actions === */
function answer() {
// We should always have only 1 call here
@@ -0,0 +1,39 @@
'use strict';

console.error('This file is not to be shipped.');
console.error('It just helps to fake a call.');

(function() {
// Don't execute on the phone
if (navigator.mozTelephony.conferenceGroup) {
return;
}

// To use it, you need to include at the end of the <head>
// <script defer src="/js/fake-oncall-desktop.js"></script>
// in index.html
// Then access http://callscreen.gaiamobile.org:8080

var handledCall = document.getElementById('handled-call-template');
handledCall.id = '';
handledCall.hidden = false;
handledCall.classList.add('additionalInfo');
handledCall.classList.add('additionalContactInfo');
handledCall.classList.add('incoming');
handledCall.classList.add('handled-call');

handledCall.querySelector('.number').innerHTML = 'Joe Smith';
handledCall.querySelector('.additionalContactInfo').textContent =
'work, 12345';

var duration = handledCall.querySelector('.duration');
var time = duration.querySelector('span');
duration.classList.add('isTimer');
time.textContent = '9:42';

CallScreen.updateCallsDisplay();
CallScreen.render('connected'); // Change this for various states
CallScreen.screen.classList.add('displayed');
CallScreen.calls.classList.add('muted');
CallScreen.groupCalls.classList.add('held');
})();
File renamed without changes.
@@ -0,0 +1,10 @@
'use strict';

window.addEventListener('load', function callSetup(evt) {
window.removeEventListener('load', callSetup);

CallsHandler.setup();
CallScreen.init();
KeypadManager.init(true);
});

@@ -0,0 +1,14 @@
@import url(../../communications/dialer/locales/dialer.en-US.properties)
@import url(../../communications/dialer/locales/shared.en-US.properties)

[ar]
@import url(../../communications/dialer/locales/dialer.ar.properties)
@import url(../../communications/dialer/locales/shared.ar.properties)

[fr]
@import url(../../communications/dialer/locales/dialer.fr.properties)
@import url(../../communications/dialer/locales/shared.fr.properties)

[zh-TW]
@import url(../../communications/dialer/locales/dialer.zh-TW.properties)
@import url(../../communications/dialer/locales/shared.zh-TW.properties)
@@ -0,0 +1,35 @@
{
"name": "Callscreen",
"description": "Gaia Callscreen",
"type": "certified",
"role": "system",
"launch_path": "/index.html",
"developer": {
"name": "The Gaia Team",
"url": "https://github.com/mozilla-b2g/gaia"
},
"permissions": {
"telephony":{},
"bluetooth":{},
"voicemail":{},
"contacts":{ "access": "readonly" },
"mobileconnection":{},
"attention":{},
"settings":{ "access": "readonly" },
"time": {},
"audio-channel-telephony":{},
"idle":{},
"storage": {},
"device-storage:sdcard": { "access": "readonly" },
"phonenumberservice": {}
},
"messages": [
{ "bluetooth-dialer-command": "/index.html" },
{ "headset-button": "/index.html" }
],
"orientation": "default",
"icons": {
"30": "/style/icons/communication_30.png",
"45": "/style/icons/communication_45.png"
}
}