diff --git a/apps/system/index.html b/apps/system/index.html
index ab27af68c8da..71f03d482768 100644
--- a/apps/system/index.html
+++ b/apps/system/index.html
@@ -218,6 +218,7 @@
+
diff --git a/apps/system/js/lockscreen_state_keypadshow.js b/apps/system/js/lockscreen_state_keypadshow.js
index 1ab3e6ea5adc..95ce36b066ab 100644
--- a/apps/system/js/lockscreen_state_keypadshow.js
+++ b/apps/system/js/lockscreen_state_keypadshow.js
@@ -36,6 +36,8 @@
// Copy from the original switching method.
this.lockScreen.overlay.classList.add('no-transition');
this.lockScreen.overlay.dataset.panel = 'passcode';
+ // Resetting slider when it get hidden by the passcode keypad
+ this.lockScreen._unlocker.reset();
// XXX: Because when it's 'success', the keyboard would be hidden.
// This should be fixed: we should manage the show/hide with other
// CSS flags.
diff --git a/apps/system/js/lockscreen_state_manager.js b/apps/system/js/lockscreen_state_manager.js
index 22552f152fa8..4cef590c5266 100644
--- a/apps/system/js/lockscreen_state_manager.js
+++ b/apps/system/js/lockscreen_state_manager.js
@@ -15,7 +15,8 @@
*/
/* global SettingsListener, System */
-/* global LockScreenStateSlideShow, LockScreenStateKeypadShow */
+/* global LockScreenStateSlideShow, LockScreenStateSlideHide */
+/* global LockScreenStateKeypadShow */
/* global LockScreenStateKeypadHiding, LockScreenStateKeypadRising */
/* global LockScreenStatePanelHide */
/* global LockScreenStateLogger */
@@ -90,6 +91,7 @@
// these states.
this.states = {
slideShow: (new LockScreenStateSlideShow()).start(this.lockScreen),
+ slideHide: (new LockScreenStateSlideHide()).start(this.lockScreen),
keypadShow: (new LockScreenStateKeypadShow()).start(this.lockScreen),
keypadHiding: (new LockScreenStateKeypadHiding()).start(this.lockScreen),
keypadRising: (new LockScreenStateKeypadRising()).start(this.lockScreen),
@@ -143,10 +145,19 @@
screenOn: true,
unlocking: false
},
- ['panelHide'],
+ ['panelHide', 'slideHide'],
this.states.slideShow,
'Resume from screen off');
+ this.registerRule({
+ passcodeEnabled: false,
+ screenOn: true,
+ unlocking: true
+ },
+ ['slideShow'],
+ this.states.slideHide,
+ 'When it activate to unlock without passcode, unlock and animates.');
+
this.registerRule({
passcodeEnabled: true,
passcodeTimeout: true,
diff --git a/apps/system/js/lockscreen_state_slidehide.js b/apps/system/js/lockscreen_state_slidehide.js
new file mode 100644
index 000000000000..05e0d826b22e
--- /dev/null
+++ b/apps/system/js/lockscreen_state_slidehide.js
@@ -0,0 +1,38 @@
+/**
+ Copyright 2012, Mozilla Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/* global Promise */
+
+'use strict';
+
+/**
+ * This state would guarantee the LockScreen plays the animation.
+ */
+(function(exports) {
+
+ var LockScreenStateSlideHide = function() {};
+ LockScreenStateSlideHide.prototype.start = function lsssh_start(lockScreen) {
+ this.type = 'slideHide';
+ this.lockScreen = lockScreen;
+ return this;
+ };
+
+ LockScreenStateSlideHide.prototype.transferTo =
+ function lsssh_transferTo() {
+ return Promise.resolve();
+ };
+ exports.LockScreenStateSlideHide = LockScreenStateSlideHide;
+})(window);
diff --git a/apps/system/js/lockscreen_state_slideshow.js b/apps/system/js/lockscreen_state_slideshow.js
index f3fc35c52496..56c6fe03cb64 100644
--- a/apps/system/js/lockscreen_state_slideshow.js
+++ b/apps/system/js/lockscreen_state_slideshow.js
@@ -36,6 +36,8 @@
// Clear passcode while the keypad is hiding.
this.lockScreen.passCodeEntered = '';
this.lockScreen.updatePassCodeUI();
+ // Resetting slider before we want to show it again
+ this.lockScreen._unlocker.reset();
// Copy from the original switching method.
this.lockScreen.overlay.classList.add('no-transition');
this.lockScreen.overlay.dataset.panel = 'main';
diff --git a/apps/system/test/unit/lockscreen_state_manager_test.js b/apps/system/test/unit/lockscreen_state_manager_test.js
index 5f5716014f2b..a21e73c255ac 100644
--- a/apps/system/test/unit/lockscreen_state_manager_test.js
+++ b/apps/system/test/unit/lockscreen_state_manager_test.js
@@ -25,6 +25,7 @@ suite('system/LockScreenStateManager', function() {
};
};
window.LockScreenStateSlideShow =
+ window.LockScreenStateSlideHide =
window.LockScreenStatePanelHide =
window.LockScreenStateKeypadShow =
window.LockScreenStateKeypadHiding =
diff --git a/apps/system/test/unit/lockscreen_state_slidehide_test.js b/apps/system/test/unit/lockscreen_state_slidehide_test.js
new file mode 100644
index 000000000000..8c091cdee47a
--- /dev/null
+++ b/apps/system/test/unit/lockscreen_state_slidehide_test.js
@@ -0,0 +1,17 @@
+/* global LockScreenStateSlideHide */
+
+'use strict';
+requireApp('system/js/lockscreen_state_slidehide.js');
+suite('sytem/LockScreenStateSlideHide', function() {
+ var subject;
+ var mockLockScreen;
+ setup(function() {
+ mockLockScreen = {
+ overlay: document.createElement('div')
+ };
+ subject = (new LockScreenStateSlideHide()).start(mockLockScreen);
+ });
+ test('it would resolve as expected', function(done) {
+ subject.transferTo().then(done, done);
+ });
+});
diff --git a/shared/js/lockscreen_slide.js b/shared/js/lockscreen_slide.js
index 577f50332c59..a9fcb63f8faa 100644
--- a/shared/js/lockscreen_slide.js
+++ b/shared/js/lockscreen_slide.js
@@ -230,6 +230,14 @@
this.states.initialized = true;
};
+ LockScreenSlidePrototype.reset = function lss_reset() {
+ this._clearCanvas();
+ this._drawTrack();
+ this._resetHandle();
+ this._resetArrows();
+ this._drawIconBG();
+ };
+
/**
* Overwrite settings recursively.
*
@@ -577,24 +585,12 @@
function lss_onSlideEnd() {
var isLeft = this.states.touch.pageX - this.center.x < 0;
- var bounceEnd = (function _bounceEnd() {
- this._clearCanvas();
- this._drawTrack();
- this._resetHandle();
- this._resetArrows();
- this._drawIconBG();
- }).bind(this);
-
if (false === this.states.slideReachEnd) {
- this._bounceBack(this.states.touch.pageX, bounceEnd);
+ this._bounceBack(this.states.touch.pageX);
} else {
var intention = isLeft ? 'lockscreenslide-activate-left' :
'lockscreenslide-activate-right';
this.publish(intention);
-
- // Restore it only after screen changed.
- var appLaunchDelay = 400;
- setTimeout(bounceEnd, appLaunchDelay);
}
this.publish('lockscreenslide-unlocking-stop');