Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Revert "Bug 1055299: Ignore continuous app launch request in homescre…
Browse files Browse the repository at this point in the history
…en side and send homescreen to background while rocketbar is open in system side"

This reverts commit b866e8a.
  • Loading branch information
KevinGrandon committed Sep 18, 2014
1 parent b0b0ab8 commit 9f3588e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 85 deletions.
10 changes: 4 additions & 6 deletions apps/system/js/visibility_manager.js
@@ -1,4 +1,4 @@
/* global attentionWindowManager, System, rocketbar */
/* global attentionWindowManager, System */
'use strict';

(function(exports) {
Expand Down Expand Up @@ -88,8 +88,6 @@
this.publish('showwindow', { type: evt.type });
this._resetDeviceLockedTimer();
break;

case 'rocketbar-overlayclosed':
case 'lockscreen-request-unlock':
var detail = evt.detail,
activity = null,
Expand All @@ -100,8 +98,7 @@
notificationId = detail.notificationId;
}

if (!attentionWindowManager.hasActiveWindow() &&
!rocketbar.active) {
if (!attentionWindowManager.hasActiveWindow()) {
this.publish('showwindow', {
activity: activity, // Trigger activity opening in AWM
notificationId: notificationId
Expand All @@ -110,7 +107,6 @@
this._resetDeviceLockedTimer();
break;
case 'lockscreen-appopened':
case 'rocketbar-overlayopened':
// If the audio is active, the app should not set non-visible
// otherwise it will be muted.
// TODO: Remove this hack.
Expand All @@ -128,11 +124,13 @@
this.publish('hidewindow', { type: evt.type });
}
break;
case 'rocketbar-overlayopened':
case 'utility-tray-overlayopened':
case 'cardviewshown':
case 'system-dialog-show':
this.publish('hidewindowforscreenreader');
break;
case 'rocketbar-overlayclosed':
case 'utility-tray-overlayclosed':
case 'cardviewclosed':
case 'system-dialog-hide':
Expand Down
2 changes: 1 addition & 1 deletion apps/system/test/marionette/homescreen_navigation_test.js
Expand Up @@ -64,7 +64,7 @@ marionette('Homescreen navigation >', function() {

goHome();
launchSettings();
client.helper.wait(1000);

reflowHelper.startTracking(System.URL);
client.switchToFrame();

Expand Down
69 changes: 21 additions & 48 deletions apps/system/test/unit/visibility_manager_test.js
@@ -1,4 +1,4 @@
/* globals MocksHelper, VisibilityManager, MockRocketbar,
/* globals MocksHelper, VisibilityManager,
MockAttentionWindowManager, MockTaskManager, MockAppWindow */
'use strict';

Expand All @@ -8,7 +8,6 @@ requireApp('system/shared/test/unit/mocks/mock_manifest_helper.js');
require('/shared/test/unit/mocks/mock_system.js');
requireApp('system/test/unit/mock_attention_window_manager.js');
requireApp('system/test/unit/mock_app_window.js');
requireApp('system/test/unit/mock_rocketbar.js');

var mocksForVisibilityManager = new MocksHelper([
'AttentionWindowManager', 'System', 'AppWindow'
Expand All @@ -20,7 +19,6 @@ suite('system/VisibilityManager', function() {
mocksForVisibilityManager.attachTestHelpers();
setup(function(done) {
window.attentionWindowManager = MockAttentionWindowManager;
window.rocketbar = new MockRocketbar();
this.sinon.useFakeTimers();

stubById = this.sinon.stub(document, 'getElementById');
Expand All @@ -38,51 +36,6 @@ suite('system/VisibilityManager', function() {
});

suite('handle events', function() {
test('rocketbar-overlayopened', function() {
visibilityManager._normalAudioChannelActive = false;
var stubPublish = this.sinon.stub(visibilityManager, 'publish');
visibilityManager.handleEvent({
type: 'rocketbar-overlayopened'
});

assert.isTrue(stubPublish.calledOnce);
assert.equal(stubPublish.getCall(0).args[0], 'hidewindow');

visibilityManager._normalAudioChannelActive = true;
visibilityManager.handleEvent({
type: 'rocketbar-overlayopened'
});

assert.isTrue(stubPublish.calledOnce);

visibilityManager._normalAudioChannelActive = false;
});

test('searchclosed', function() {
this.sinon.stub(MockAttentionWindowManager,
'hasActiveWindow').returns(false);
var stubPublish = this.sinon.stub(visibilityManager, 'publish');

visibilityManager.handleEvent({
type: 'rocketbar-overlayclosed'
});

assert.isTrue(stubPublish.calledOnce);
assert.isTrue(stubPublish.getCall(0).args[0] === 'showwindow');
});

test('searchclosed when there is active attention window', function() {
this.sinon.stub(MockAttentionWindowManager,
'hasActiveWindow').returns(true);
var stubPublish = this.sinon.stub(visibilityManager, 'publish');

visibilityManager.handleEvent({
type: 'searchclosed'
});

assert.isFalse(stubPublish.called);
});

test('lock', function() {
visibilityManager._normalAudioChannelActive = false;
var stubPublish = this.sinon.stub(visibilityManager, 'publish');
Expand Down Expand Up @@ -157,6 +110,26 @@ suite('system/VisibilityManager', function() {
assert.isTrue(stubPublish.calledWith('showlockscreenwindow'));
});

test('rocketbar-overlayopened', function() {
var stubPublish = this.sinon.stub(visibilityManager, 'publish');
visibilityManager.handleEvent({
type: 'rocketbar-overlayopened'
});

assert.isTrue(stubPublish.called);
assert.isTrue(stubPublish.calledWith('hidewindowforscreenreader'));
});

test('rocketbar-overlayclosed', function() {
var stubPublish = this.sinon.stub(visibilityManager, 'publish');
visibilityManager.handleEvent({
type: 'rocketbar-overlayclosed'
});

assert.isTrue(stubPublish.called);
assert.isTrue(stubPublish.calledWith('showwindowforscreenreader'));
});

test('utility-tray-overlayopened', function() {
var stubPublish = this.sinon.stub(visibilityManager, 'publish');
visibilityManager.handleEvent({
Expand Down
30 changes: 0 additions & 30 deletions shared/elements/gaia_grid/js/grid_view.js
Expand Up @@ -29,7 +29,6 @@
this.onTouchEnd = this.onTouchEnd.bind(this);
this.onScroll = this.onScroll.bind(this);
this.onContextMenu = this.onContextMenu.bind(this);
this.onVisibilityChange = this.onVisibilityChange.bind(this);
this.lastScrollTime = 0;

if (config.features.zoom) {
Expand Down Expand Up @@ -74,11 +73,6 @@
this.layout.cols = value;
},

/**
* We are in the state of launching an app.
*/
_launchingApp: false,

/**
* Adds an item into the items array.
* If the item is an icon, add it to icons.
Expand Down Expand Up @@ -150,7 +144,6 @@
this.element.addEventListener('touchend', this.onTouchEnd);
this.element.addEventListener('contextmenu', this.onContextMenu);
window.addEventListener('scroll', this.onScroll, true);
window.addEventListener('visibilitychange', this.onVisibilityChange);
this.lastTouchStart = null;
},

Expand All @@ -159,7 +152,6 @@
this.element.removeEventListener('touchend', this.onTouchEnd);
this.element.removeEventListener('contextmenu', this.onContextMenu);
window.removeEventListener('scroll', this.onScroll, true);
window.removeEventListener('visibilitychange', this.onVisibilityChange);
this.lastTouchStart = null;
},

Expand Down Expand Up @@ -216,10 +208,6 @@
}
},

onVisibilityChange: function() {
this._launchingApp = false;
},

/**
* Launches an app.
*/
Expand Down Expand Up @@ -268,24 +256,6 @@
}, returnTimeout);
}

if ((icon.detail.type === 'app' || icon.detail.type === 'bookmark') &&
this._launchingApp) {
return;
}
if ((icon.detail.type === 'app' && icon.appState === 'ready') ||
icon.detail.type === 'bookmark') {
this._launchingApp = true;
if (this._launchingTimeout) {
window.clearTimeout(this._launchingTimeout);
this._launchingTimeout = null;
}
// This avoids some edge cases if we didn't get visibilitychange anyway.
this._launchingTimeout = window.setTimeout(function() {
this._launchingTimeout = null;
this._launchingApp = false;
}.bind(this), 3000);
}

icon[action]();
},

Expand Down

0 comments on commit 9f3588e

Please sign in to comment.