Merge mozilla-central to mozilla-inbound

This commit is contained in:
Carsten "Tomcat" Book 2015-09-23 12:47:04 +02:00
Родитель cbf602ece7 292376c78a
Коммит cb02da953c
62 изменённых файлов: 768 добавлений и 532 удалений

Просмотреть файл

@ -22,4 +22,7 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Merge day clobber
Bug 1108782 - Follow-up: clobber. r=me
There's all kinds fail waiting at the end of these dependency changes.
Definitely clobber needed!

Просмотреть файл

@ -71,6 +71,7 @@ this.SafeMode = {
return DOMApplicationRegistry.registryReady.then(() => {
let shell = SafeMode.window.shell;
let document = SafeMode.window.document;
SafeMode.window.screen.mozLockOrientation("portrait");
let url = Services.io.newURI(shell.homeURL, null, null)
.resolve(kSafeModePage);

Просмотреть файл

@ -15,11 +15,11 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="864500d40633bbf0e9a83c92a03cea46bb901906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="aad942e6960cdd6b2d09900b157b16f4ddb9423c"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="2782648aabf0af464dd9c4202b367b408898546d"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="828317e64d28138f24d578ab340c2a0ff8552df0"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>

Просмотреть файл

@ -15,11 +15,11 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="864500d40633bbf0e9a83c92a03cea46bb901906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="aad942e6960cdd6b2d09900b157b16f4ddb9423c"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="2782648aabf0af464dd9c4202b367b408898546d"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="828317e64d28138f24d578ab340c2a0ff8552df0"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>

Просмотреть файл

@ -19,12 +19,12 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="864500d40633bbf0e9a83c92a03cea46bb901906"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="aad942e6960cdd6b2d09900b157b16f4ddb9423c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="12ff7481566587aa4198cf1287598acb3a999973"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="2782648aabf0af464dd9c4202b367b408898546d"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="828317e64d28138f24d578ab340c2a0ff8552df0"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>

Просмотреть файл

@ -17,9 +17,9 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="864500d40633bbf0e9a83c92a03cea46bb901906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="aad942e6960cdd6b2d09900b157b16f4ddb9423c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="2782648aabf0af464dd9c4202b367b408898546d"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="828317e64d28138f24d578ab340c2a0ff8552df0"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>

Просмотреть файл

@ -15,11 +15,11 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="864500d40633bbf0e9a83c92a03cea46bb901906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="aad942e6960cdd6b2d09900b157b16f4ddb9423c"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="2782648aabf0af464dd9c4202b367b408898546d"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="828317e64d28138f24d578ab340c2a0ff8552df0"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>

Просмотреть файл

@ -15,11 +15,11 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="864500d40633bbf0e9a83c92a03cea46bb901906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="aad942e6960cdd6b2d09900b157b16f4ddb9423c"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="2782648aabf0af464dd9c4202b367b408898546d"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="828317e64d28138f24d578ab340c2a0ff8552df0"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>

Просмотреть файл

@ -19,12 +19,12 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="864500d40633bbf0e9a83c92a03cea46bb901906"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="aad942e6960cdd6b2d09900b157b16f4ddb9423c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="12ff7481566587aa4198cf1287598acb3a999973"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="2782648aabf0af464dd9c4202b367b408898546d"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="828317e64d28138f24d578ab340c2a0ff8552df0"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>

Просмотреть файл

@ -15,11 +15,11 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="864500d40633bbf0e9a83c92a03cea46bb901906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="aad942e6960cdd6b2d09900b157b16f4ddb9423c"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="2782648aabf0af464dd9c4202b367b408898546d"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="828317e64d28138f24d578ab340c2a0ff8552df0"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>

Просмотреть файл

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "864500d40633bbf0e9a83c92a03cea46bb901906",
"git_revision": "aad942e6960cdd6b2d09900b157b16f4ddb9423c",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "7ba01d2c6e7edec8a5dc823ccf34cb26eb62169a",
"revision": "1c723e1073f387534a091afba1ed5fbac0461c57",
"repo_path": "integration/gaia-central"
}

Просмотреть файл

@ -17,9 +17,9 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="864500d40633bbf0e9a83c92a03cea46bb901906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="aad942e6960cdd6b2d09900b157b16f4ddb9423c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="2782648aabf0af464dd9c4202b367b408898546d"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="828317e64d28138f24d578ab340c2a0ff8552df0"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>

Просмотреть файл

@ -15,11 +15,11 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="864500d40633bbf0e9a83c92a03cea46bb901906"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="aad942e6960cdd6b2d09900b157b16f4ddb9423c"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="2782648aabf0af464dd9c4202b367b408898546d"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="828317e64d28138f24d578ab340c2a0ff8552df0"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>

Просмотреть файл

@ -11,6 +11,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "CloudSync",
var CloudSync = null;
#endif
XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
"resource://gre/modules/FxAccounts.jsm");
// gSyncUI handles updating the tools menu and displaying notifications.
var gSyncUI = {
_obs: ["weave:service:sync:start",
@ -38,10 +41,7 @@ var gSyncUI = {
// Proceed to set up the UI if Sync has already started up.
// Otherwise we'll do it when Sync is firing up.
let xps = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
if (xps.ready) {
if (this.weaveService.ready) {
this.initUI();
return;
}
@ -99,45 +99,44 @@ var gSyncUI = {
}
},
// Returns a promise that resolves with true if Sync needs to be configured,
// false otherwise.
_needsSetup() {
// We want to treat "account needs verification" as "needs setup". So
// "reach in" to Weave.Status._authManager to check whether we the signed-in
// user is verified.
// NOTE: We used to have this _authManager hack to avoid a nested
// event-loop from querying Weave.Status.checkSetup() - while that's no
// longer true, we do still have the FxA-specific requirement of checking
// the verified state - so the hack remains. We should consider refactoring
// Sync's "check setup" capabilities to take this into account at some point...
if (Weave.Status._authManager._signedInUser !== undefined) {
// If we have a signed in user already, and that user is not verified,
// revert to the "needs setup" state.
return !Weave.Status._authManager._signedInUser ||
!Weave.Status._authManager._signedInUser.verified;
// If Sync is configured for FxAccounts then we do that promise-dance.
if (this.weaveService.fxAccountsEnabled) {
return fxAccounts.getSignedInUser().then(user => {
// We want to treat "account needs verification" as "needs setup".
return !(user && user.verified);
});
}
// We are using legacy sync - check that.
let firstSync = "";
try {
firstSync = Services.prefs.getCharPref("services.sync.firstSync");
} catch (e) { }
return Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED ||
firstSync == "notReady";
return Promise.resolve(Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED ||
firstSync == "notReady");
},
// Returns a promise that resolves with true if the user currently signed in
// to Sync needs to be verified, false otherwise.
_needsVerification() {
// For callers who care about the distinction between "needs setup" and
// "setup but needs verification"
// See _needsSetup for the subtleties here.
if (Weave.Status._authManager._signedInUser === undefined) {
// a legacy sync user - no "verified" concept there.
return false;
// "needs verification"
if (this.weaveService.fxAccountsEnabled) {
return fxAccounts.getSignedInUser().then(user => {
// If there is no user, they can't be in a "needs verification" state.
if (!user) {
return false;
}
return !user.verified;
});
}
if (!Weave.Status._authManager._signedInUser) {
// no user configured at all, so not in a "need verification" state.
return false;
}
return !Weave.Status._authManager._signedInUser.verified;
// Otherwise we are configured for legacy Sync, which has no verification
// concept.
return Promise.resolve(false);
},
// Note that we don't show login errors in a notification bar here, but do
@ -149,27 +148,36 @@ var gSyncUI = {
return Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED;
},
updateUI: function SUI_updateUI() {
let needsSetup = this._needsSetup();
let loginFailed = this._loginFailed();
// Kick off an update of the UI - does *not* return a promise.
updateUI() {
this._promiseUpdateUI().catch(err => {
this.log.error("updateUI failed", err);
})
},
// Start off with a clean slate
document.getElementById("sync-reauth-state").hidden = true;
document.getElementById("sync-setup-state").hidden = true;
document.getElementById("sync-syncnow-state").hidden = true;
// Updates the UI - returns a promise.
_promiseUpdateUI() {
return this._needsSetup().then(needsSetup => {
let loginFailed = this._loginFailed();
if (CloudSync && CloudSync.ready && CloudSync().adapters.count) {
document.getElementById("sync-syncnow-state").hidden = false;
} else if (loginFailed) {
// unhiding this element makes the menubar show the login failure state.
document.getElementById("sync-reauth-state").hidden = false;
} else if (needsSetup) {
document.getElementById("sync-setup-state").hidden = false;
} else {
document.getElementById("sync-syncnow-state").hidden = false;
}
// Start off with a clean slate
document.getElementById("sync-reauth-state").hidden = true;
document.getElementById("sync-setup-state").hidden = true;
document.getElementById("sync-syncnow-state").hidden = true;
this._updateSyncButtonsTooltip();
if (CloudSync && CloudSync.ready && CloudSync().adapters.count) {
document.getElementById("sync-syncnow-state").hidden = false;
} else if (loginFailed) {
// unhiding this element makes the menubar show the login failure state.
document.getElementById("sync-reauth-state").hidden = false;
} else if (needsSetup) {
document.getElementById("sync-setup-state").hidden = false;
} else {
document.getElementById("sync-syncnow-state").hidden = false;
}
return this._updateSyncButtonsTooltip();
});
},
// Functions called by observers
@ -240,21 +248,32 @@ var gSyncUI = {
},
// Commands
doSync: function SUI_doSync() {
let needsSetup = this._needsSetup();
if (!needsSetup) {
setTimeout(function () Weave.Service.errorHandler.syncAndReportErrors(), 0);
}
Services.obs.notifyObservers(null, "cloudsync:user-sync", null);
// doSync forces a sync - it *does not* return a promise as it is called
// via the various UI components.
doSync() {
this._needsSetup().then(needsSetup => {
if (!needsSetup) {
setTimeout(function () Weave.Service.errorHandler.syncAndReportErrors(), 0);
}
Services.obs.notifyObservers(null, "cloudsync:user-sync", null);
}).catch(err => {
this.log.error("Failed to force a sync", err);
});
},
handleToolbarButton: function SUI_handleStatusbarButton() {
if (this._needsSetup() || this._loginFailed())
this.openSetup();
else
this.doSync();
// Handle clicking the toolbar button - which either opens the Sync setup
// pages or forces a sync now. Does *not* return a promise as it is called
// via the UI.
handleToolbarButton() {
this._needsSetup().then(needsSetup => {
if (needsSetup || this._loginFailed()) {
this.openSetup();
} else {
return this.doSync();
}
}).catch(err => {
this.log.error("Failed to handle toolbar button command", err);
});
},
/**
@ -270,10 +289,7 @@ var gSyncUI = {
*/
openSetup: function SUI_openSetup(wizardType, entryPoint = "syncbutton") {
let xps = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
if (xps.fxAccountsEnabled) {
if (this.weaveService.fxAccountsEnabled) {
// If the user is also in an uitour, set the entrypoint to `uitour`
if (UITour.tourBrowsersByWindow.get(window) &&
UITour.tourBrowsersByWindow.get(window).has(gBrowser.selectedBrowser)) {
@ -292,6 +308,7 @@ var gSyncUI = {
}
},
// Open the legacy-sync device pairing UI. Note used for FxA Sync.
openAddDevice: function () {
if (!Weave.Utils.ensureMPUnlocked())
return;
@ -318,29 +335,29 @@ var gSyncUI = {
otherwise the tooltip reflects the fact that Sync needs to be
(re-)configured.
*/
_updateSyncButtonsTooltip: function() {
_updateSyncButtonsTooltip: Task.async(function* () {
if (!gBrowser)
return;
let syncButton = document.getElementById("sync-button");
let statusButton = document.getElementById("PanelUI-fxa-icon");
let email;
try {
email = Services.prefs.getCharPref("services.sync.username");
} catch (ex) {}
let needsSetup = yield this._needsSetup();
let needsVerification = yield this._needsVerification();
let loginFailed = this._loginFailed();
// This is a little messy as the Sync buttons are 1/2 Sync related and
// 1/2 FxA related - so for some strings we use Sync strings, but for
// others we reach into gFxAccounts for strings.
let tooltiptext;
if (this._needsVerification()) {
if (needsVerification) {
// "needs verification"
tooltiptext = gFxAccounts.strings.formatStringFromName("verifyDescription", [email], 1);
} else if (this._needsSetup()) {
} else if (needsSetup) {
// "needs setup".
tooltiptext = this._stringBundle.GetStringFromName("signInToSync.description");
} else if (this._loginFailed()) {
} else if (loginFailed) {
// "need to reconnect/re-enter your password"
tooltiptext = gFxAccounts.strings.formatStringFromName("reconnectDescription", [email], 1);
} else {
@ -358,6 +375,14 @@ var gSyncUI = {
// will cause the tooltip to be removed below.
}
}
// We've done all our promise-y work and ready to update the UI - make
// sure it hasn't been torn down since we started.
if (!gBrowser)
return;
let syncButton = document.getElementById("sync-button");
let statusButton = document.getElementById("PanelUI-fxa-icon");
for (let button of [syncButton, statusButton]) {
if (button) {
if (tooltiptext) {
@ -367,7 +392,7 @@ var gSyncUI = {
}
}
}
},
}),
clearError: function SUI_clearError(errorString) {
Weave.Notifications.removeAll(errorString);
@ -459,3 +484,9 @@ XPCOMUtils.defineLazyGetter(gSyncUI, "_stringBundle", function() {
XPCOMUtils.defineLazyGetter(gSyncUI, "log", function() {
return Log.repository.getLogger("browserwindow.syncui");
});
XPCOMUtils.defineLazyGetter(gSyncUI, "weaveService", function() {
return Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
});

Просмотреть файл

@ -5486,7 +5486,6 @@
this._dndCanvas = canvas;
this._dndPanel = document.createElement("panel");
this._dndPanel.setAttribute("type", "drag");
this._dndPanel.setAttribute("mousethrough", "always");
this._dndPanel.appendChild(canvas);
document.documentElement.appendChild(this._dndPanel);
}

Просмотреть файл

@ -12,6 +12,25 @@ var stringBundle = Cc["@mozilla.org/intl/stringbundle;1"]
// ensure test output sees log messages.
Log.repository.getLogger("browserwindow.syncui").addAppender(new Log.DumpAppender());
// Send the specified sync-related notification and return a promise that
// resolves once gSyncUI._promiseUpateUI is complete and the UI is ready to check.
function notifyAndPromiseUIUpdated(topic) {
return new Promise(resolve => {
// Instrument gSyncUI so we know when the update is complete.
let oldPromiseUpdateUI = gSyncUI._promiseUpdateUI.bind(gSyncUI);
gSyncUI._promiseUpdateUI = function() {
return oldPromiseUpdateUI().then(() => {
// Restore our override.
gSyncUI._promiseUpdateUI = oldPromiseUpdateUI;
// Resolve the promise so the caller knows the update is done.
resolve();
});
};
// Now send the notification.
Services.obs.notifyObservers(null, topic, null);
});
}
// Sync manages 3 broadcasters so the menus correctly reflect the Sync state.
// Only one of these 3 should ever be visible - pass the ID of the broadcaster
// you expect to be visible and it will check it's the only one that is.
@ -55,13 +74,13 @@ add_task(function* prepare() {
yield xps.whenLoaded();
// Put Sync and the UI into a known state.
Weave.Status.login = Weave.LOGIN_FAILED_NO_USERNAME;
Services.obs.notifyObservers(null, "weave:ui:clear-error", null);
yield notifyAndPromiseUIUpdated("weave:ui:clear-error");
checkBroadcasterVisible("sync-setup-state");
checkButtonTooltips("Sign In To Sync");
// mock out the "_needsSetup()" function so we don't short-circuit.
let oldNeedsSetup = window.gSyncUI._needsSetup;
window.gSyncUI._needsSetup = () => false;
window.gSyncUI._needsSetup = () => Promise.resolve(false);
registerCleanupFunction(() => {
window.gSyncUI._needsSetup = oldNeedsSetup;
// and an observer to set the state back to what it should be now we've
@ -69,7 +88,7 @@ add_task(function* prepare() {
Services.obs.notifyObservers(null, "weave:ui:clear-error", null);
});
// and a notification to have the state change away from "needs setup"
Services.obs.notifyObservers(null, "weave:ui:clear-error", null);
yield notifyAndPromiseUIUpdated("weave:ui:clear-error");
checkBroadcasterVisible("sync-syncnow-state");
});
@ -80,7 +99,7 @@ add_task(function* testSyncNeedsVerification() {
window.gSyncUI._needsVerification = () => true;
try {
// a notification for the state change
Services.obs.notifyObservers(null, "weave:ui:clear-error", null);
yield notifyAndPromiseUIUpdated("weave:ui:clear-error");
checkButtonTooltips("Verify");
} finally {
window.gSyncUI._needsVerification = oldNeedsVerification;
@ -95,7 +114,7 @@ add_task(function* testSyncLoginError() {
// Pretend we are in a "login failed" error state
Weave.Status.sync = Weave.LOGIN_FAILED;
Weave.Status.login = Weave.LOGIN_FAILED_LOGIN_REJECTED;
Services.obs.notifyObservers(null, "weave:ui:sync:error", null);
yield notifyAndPromiseUIUpdated("weave:ui:sync:error");
Assert.equal(Notifications.notifications.length, 0, "no notifications shown on login error");
// But the menu *should* reflect the login error.
@ -106,8 +125,8 @@ add_task(function* testSyncLoginError() {
// Now pretend we just had a successful login - the error notification should go away.
Weave.Status.sync = Weave.STATUS_OK;
Weave.Status.login = Weave.LOGIN_SUCCEEDED;
Services.obs.notifyObservers(null, "weave:service:login:start", null);
Services.obs.notifyObservers(null, "weave:service:login:finish", null);
yield notifyAndPromiseUIUpdated("weave:service:login:start");
yield notifyAndPromiseUIUpdated("weave:service:login:finish");
Assert.equal(Notifications.notifications.length, 0, "no notifications left");
// The menus should be back to "all good"
checkBroadcasterVisible("sync-syncnow-state");
@ -125,28 +144,28 @@ function checkButtonsStatus(shouldBeActive) {
}
}
function testButtonActions(startNotification, endNotification) {
function* testButtonActions(startNotification, endNotification) {
checkButtonsStatus(false);
// pretend a sync is starting.
Services.obs.notifyObservers(null, startNotification, null);
yield notifyAndPromiseUIUpdated(startNotification);
checkButtonsStatus(true);
// and has stopped
Services.obs.notifyObservers(null, endNotification, null);
yield notifyAndPromiseUIUpdated(endNotification);
checkButtonsStatus(false);
}
function doTestButtonActivities() {
testButtonActions("weave:service:login:start", "weave:service:login:finish");
testButtonActions("weave:service:login:start", "weave:service:login:error");
function *doTestButtonActivities() {
yield testButtonActions("weave:service:login:start", "weave:service:login:finish");
yield testButtonActions("weave:service:login:start", "weave:service:login:error");
testButtonActions("weave:service:sync:start", "weave:service:sync:finish");
testButtonActions("weave:service:sync:start", "weave:service:sync:error");
yield testButtonActions("weave:service:sync:start", "weave:service:sync:finish");
yield testButtonActions("weave:service:sync:start", "weave:service:sync:error");
// and ensure the counters correctly handle multiple in-flight syncs
Services.obs.notifyObservers(null, "weave:service:sync:start", null);
yield notifyAndPromiseUIUpdated("weave:service:sync:start");
checkButtonsStatus(true);
// sync stops.
Services.obs.notifyObservers(null, "weave:service:sync:finish", null);
yield notifyAndPromiseUIUpdated("weave:service:sync:finish");
// Button should not be active.
checkButtonsStatus(false);
}
@ -154,7 +173,7 @@ function doTestButtonActivities() {
add_task(function* testButtonActivitiesInNavBar() {
// check the button's functionality while the button is in the NavBar - which
// it already is.
doTestButtonActivities();
yield doTestButtonActivities();
});
add_task(function* testButtonActivitiesInPanel() {
@ -163,7 +182,7 @@ add_task(function* testButtonActivitiesInPanel() {
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
yield PanelUI.show();
try {
doTestButtonActivities();
yield doTestButtonActivities();
} finally {
PanelUI.hide();
}

Просмотреть файл

@ -48,7 +48,7 @@ add_task(function* asyncCleanup() {
function mockFunctions() {
// mock needsSetup
gSyncUI._needsSetup = function() false;
gSyncUI._needsSetup = function() Promise.resolve(false);
// mock service.errorHandler.syncAndReportErrors()
service.errorHandler.syncAndReportErrors = mocked_syncAndReportErrors;

Просмотреть файл

@ -4,8 +4,6 @@
include $(topsrcdir)/config/rules.mk
JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar:$(ANDROID_TOOLS)/lib/lint.jar:$(ANDROID_TOOLS)/lib/lint-checks.jar
# Include Android specific java flags, instead of what's in rules.mk.
include $(topsrcdir)/config/android-common.mk

Просмотреть файл

@ -18,3 +18,7 @@ jar.sources += [
'utils/GeneratableElementIterator.java',
'utils/Utils.java',
]
jar.extra_jars += [
CONFIG['ANDROID_TOOLS'] + '/lib/lint.jar',
CONFIG['ANDROID_TOOLS'] + '/lib/lint-checks.jar',
]

Просмотреть файл

@ -12,7 +12,7 @@ MOZ_ARG_WITH_STRING(android-ndk,
MOZ_ARG_WITH_STRING(android-toolchain,
[ --with-android-toolchain=DIR
location of the android toolchain],
location of the Android toolchain],
android_toolchain=$withval)
MOZ_ARG_WITH_STRING(android-gnu-compiler-version,
@ -234,186 +234,182 @@ AC_SUBST([STLPORT_LIBS])
])
AC_DEFUN([concat],[$1$2$3$4])
dnl Find a component of an AAR.
dnl Arg 1: variable name to expose, like ANDROID_SUPPORT_V4_LIB.
dnl Arg 2: path to component.
dnl Arg 3: if non-empty, expect and require component.
AC_DEFUN([MOZ_ANDROID_AAR_COMPONENT], [
ifelse([$3], ,
[
if test -e "$$1" ; then
AC_MSG_ERROR([Found unexpected exploded $1!])
fi
],
[
AC_MSG_CHECKING([for $1])
$1="$2"
if ! test -e "$$1" ; then
AC_MSG_ERROR([Could not find required exploded $1!])
fi
AC_MSG_RESULT([$$1])
AC_SUBST($1)
])
])
dnl Find an AAR and expose variables representing its exploded components.
dnl AC_SUBSTs ANDROID_NAME_{AAR,AAR_RES,AAR_LIB,AAR_INTERNAL_LIB}.
dnl Arg 1: name, like play-services-base
dnl Arg 2: version, like 7.8.0
dnl Arg 3: extras subdirectory, either android or google
dnl Arg 4: package subdirectory, like com/google/android/gms
dnl Arg 5: if non-empty, expect and require internal_impl JAR.
dnl Arg 6: if non-empty, expect and require assets/ directory.
AC_DEFUN([MOZ_ANDROID_AAR],[
define([local_aar_var_base], translit($1, [-a-z], [_A-Z]))
define([local_aar_var], concat(ANDROID_, local_aar_var_base, _AAR))
local_aar_var="$ANDROID_SDK_ROOT/extras/$3/m2repository/$4/$1/$2/$1-$2.aar"
AC_MSG_CHECKING([for $1 AAR])
if ! test -e "$local_aar_var" ; then
AC_MSG_ERROR([You must download the $1 AAR. Run the Android SDK tool and install the Android and Google Support Repositories under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (Looked for $local_aar_var)])
fi
AC_SUBST(local_aar_var)
AC_MSG_RESULT([$local_aar_var])
if ! $PYTHON -m mozbuild.action.explode_aar --destdir=$MOZ_BUILD_ROOT/dist/exploded-aar $local_aar_var ; then
AC_MSG_ERROR([Could not explode $local_aar_var!])
fi
define([root], $MOZ_BUILD_ROOT/dist/exploded-aar/$1-$2/)
MOZ_ANDROID_AAR_COMPONENT(concat(local_aar_var, _LIB), concat(root, $1-$2-classes.jar), REQUIRED)
MOZ_ANDROID_AAR_COMPONENT(concat(local_aar_var, _RES), concat(root, res), REQUIRED)
MOZ_ANDROID_AAR_COMPONENT(concat(local_aar_var, _INTERNAL_LIB), concat(root, libs/$1-$2-internal_impl-$2.jar), $5)
MOZ_ANDROID_AAR_COMPONENT(concat(local_aar_var, _ASSETS), concat(root, assets), $6)
])
AC_DEFUN([MOZ_ANDROID_GOOGLE_PLAY_SERVICES],
[
if test -n "$MOZ_NATIVE_DEVICES" ; then
AC_SUBST(MOZ_NATIVE_DEVICES)
AC_MSG_CHECKING([for google play services])
GOOGLE_PLAY_SERVICES_LIB="${ANDROID_SDK_ROOT}/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar"
GOOGLE_PLAY_SERVICES_RES="${ANDROID_SDK_ROOT}/extras/google/google_play_services/libproject/google-play-services_lib/res"
AC_SUBST(GOOGLE_PLAY_SERVICES_LIB)
AC_SUBST(GOOGLE_PLAY_SERVICES_RES)
if ! test -e $GOOGLE_PLAY_SERVICES_LIB ; then
AC_MSG_ERROR([You must download Google Play Services to build with native video casting support enabled. Run the Android SDK tool and install Google Play Services under Extras. See http://developer.android.com/google/play-services/setup.html for more info. (looked for $GOOGLE_PLAY_SERVICES_LIB) ])
fi
AC_MSG_RESULT([$GOOGLE_PLAY_SERVICES_LIB])
ANDROID_APPCOMPAT_LIB="$ANDROID_COMPAT_DIR_BASE/v7/appcompat/libs/android-support-v7-appcompat.jar"
ANDROID_APPCOMPAT_RES="$ANDROID_COMPAT_DIR_BASE/v7/appcompat/res"
AC_MSG_CHECKING([for v7 appcompat library])
if ! test -e $ANDROID_APPCOMPAT_LIB ; then
AC_MSG_ERROR([You must download the v7 app compat Android support library when targeting Android with native video casting support enabled. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_APPCOMPAT_LIB)])
fi
AC_MSG_RESULT([$ANDROID_APPCOMPAT_LIB])
AC_SUBST(ANDROID_APPCOMPAT_LIB)
AC_SUBST(ANDROID_APPCOMPAT_RES)
ANDROID_MEDIAROUTER_LIB="$ANDROID_COMPAT_DIR_BASE/v7/mediarouter/libs/android-support-v7-mediarouter.jar"
ANDROID_MEDIAROUTER_RES="$ANDROID_COMPAT_DIR_BASE/v7/mediarouter/res"
AC_MSG_CHECKING([for v7 mediarouter library])
if ! test -e $ANDROID_MEDIAROUTER_LIB ; then
AC_MSG_ERROR([You must download the v7 media router Android support library when targeting Android with native video casting support enabled. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_MEDIAROUTER_LIB)])
fi
AC_MSG_RESULT([$ANDROID_MEDIAROUTER_LIB])
AC_SUBST(ANDROID_MEDIAROUTER_LIB)
AC_SUBST(ANDROID_MEDIAROUTER_RES)
MOZ_ANDROID_AAR(play-services-base, 7.8.0, google, com/google/android/gms)
MOZ_ANDROID_AAR(play-services-cast, 7.8.0, google, com/google/android/gms)
MOZ_ANDROID_AAR(appcompat-v7, 22.2.1, android, com/android/support)
MOZ_ANDROID_AAR(mediarouter-v7, 22.2.1, android, com/android/support, REQUIRED_INTERNAL_IMPL)
fi
])
dnl Configure an Android SDK.
dnl Arg 1: target SDK version, like 22.
dnl Arg 2: build tools version, like 22.0.1.
AC_DEFUN([MOZ_ANDROID_SDK],
[
MOZ_ARG_WITH_STRING(android-sdk,
[ --with-android-sdk=DIR
location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
android_sdk=$withval)
location where the Android SDK can be found (like ~/.mozbuild/android-sdk-linux)],
android_sdk_root=$withval)
android_sdk_root=${withval%/platforms/android-*}
case "$target" in
*-android*|*-linuxandroid*)
if test -z "$android_sdk" ; then
if test -z "$android_sdk_root" ; then
AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
else
if ! test -e "$android_sdk"/source.properties ; then
AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).])
fi
# Get the api level from "$android_sdk"/source.properties.
ANDROID_TARGET_SDK=`$AWK -F = changequote(<<, >>)'<<$>>1 == "AndroidVersion.ApiLevel" {print <<$>>2}'changequote([, ]) "$android_sdk"/source.properties`
if test -z "$ANDROID_TARGET_SDK" ; then
AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.])
fi
AC_DEFINE_UNQUOTED(ANDROID_TARGET_SDK,$ANDROID_TARGET_SDK)
AC_SUBST(ANDROID_TARGET_SDK)
if ! test "$ANDROID_TARGET_SDK" -eq "$ANDROID_TARGET_SDK" ; then
AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $ANDROID_TARGET_SDK)])
fi
if test $ANDROID_TARGET_SDK -lt $1 ; then
AC_MSG_ERROR([The given Android SDK provides API level $ANDROID_TARGET_SDK ($1 or higher required).])
fi
fi
android_tools="$android_sdk_root"/tools
android_platform_tools="$android_sdk_root"/platform-tools
if test ! -d "$android_platform_tools" ; then
android_platform_tools="$android_sdk"/tools # SDK Tools < r8
# We were given an old-style
# --with-android-sdk=/path/to/sdk/platforms/android-*. We could warn, but
# we'll get compliance by forcing the issue.
if test -e "$withval"/source.properties ; then
AC_MSG_ERROR([Including platforms/android-* in --with-android-sdk arguments is deprecated. Use --with-android-sdk=$android_sdk_root.])
fi
dnl The build tools got moved around to different directories in SDK
dnl Tools r22. Try to locate them. This is awful, but, from
dnl http://stackoverflow.com/a/4495368, the following sorts versions
dnl of the form x.y.z.a.b from newest to oldest:
dnl sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr
dnl We want to favour the newer versions that start with 'android-';
dnl that's what the sed is about.
dnl We might iterate over directories that aren't build-tools at all;
dnl we use the presence of aapt as a marker.
AC_MSG_CHECKING([for android build-tools directory])
android_build_tools=""
for suffix in `ls "$android_sdk_root/build-tools" | sed -e "s,android-,999.," | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr`; do
tools_directory=`echo "$android_sdk_root/build-tools/$suffix" | sed -e "s,999.,android-,"`
if test -d "$tools_directory" -a -f "$tools_directory/aapt"; then
android_build_tools="$tools_directory"
break
fi
done
if test -z "$android_build_tools" ; then
android_build_tools="$android_platform_tools" # SDK Tools < r22
android_target_sdk=$1
AC_MSG_CHECKING([for Android SDK platform version $android_target_sdk])
android_sdk=$android_sdk_root/platforms/android-$android_target_sdk
if ! test -e "$android_sdk/source.properties" ; then
AC_MSG_ERROR([You must download Android SDK platform version $android_target_sdk. Try |mach bootstrap|. (Looked for $android_sdk)])
fi
all_android_build_tools=""
for suffix in `ls "$android_sdk_root/build-tools" | sed -e "s,android-,999.," | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr`; do
tools_directory=`echo "$android_sdk_root/build-tools/$suffix" | sed -e "s,999.,android-,"`
if test -d "$tools_directory" -a -f "$tools_directory/aapt"; then
all_android_build_tools="$all_android_build_tools:$tools_directory"
fi
done
AC_MSG_RESULT([$android_sdk])
android_build_tools="$android_sdk_root"/build-tools/$2
AC_MSG_CHECKING([for Android build-tools version $2])
if test -d "$android_build_tools" -a -f "$android_build_tools/aapt"; then
AC_MSG_RESULT([$android_build_tools])
else
AC_MSG_ERROR([not found. Please check your SDK for the subdirectory of build-tools. With the current configuration, it should be in $android_sdk_root/build_tools])
AC_MSG_ERROR([You must install the Android build-tools version $2. Try |mach bootstrap|. (Looked for $android_build_tools)])
fi
MOZ_PATH_PROG(ZIPALIGN, zipalign, :, [$android_build_tools])
MOZ_PATH_PROG(DX, dx, :, [$android_build_tools])
MOZ_PATH_PROG(AAPT, aapt, :, [$android_build_tools])
MOZ_PATH_PROG(AIDL, aidl, :, [$android_build_tools])
if test -z "$ZIPALIGN" -o "$ZIPALIGN" = ":"; then
AC_MSG_ERROR([The program zipalign was not found. Try |mach bootstrap|.])
fi
if test -z "$DX" -o "$DX" = ":"; then
AC_MSG_ERROR([The program dx was not found. Try |mach bootstrap|.])
fi
if test -z "$AAPT" -o "$AAPT" = ":"; then
AC_MSG_ERROR([The program aapt was not found. Try |mach bootstrap|.])
fi
if test -z "$AIDL" -o "$AIDL" = ":"; then
AC_MSG_ERROR([The program aidl was not found. Try |mach bootstrap|.])
fi
android_platform_tools="$android_sdk_root"/platform-tools
AC_MSG_CHECKING([for Android platform-tools])
if test -d "$android_platform_tools" -a -f "$android_platform_tools/adb"; then
AC_MSG_RESULT([$android_platform_tools])
else
AC_MSG_ERROR([You must install the Android platform-tools. Try |mach bootstrap|. (Looked for $android_platform_tools)])
fi
MOZ_PATH_PROG(ADB, adb, :, [$android_platform_tools])
if test -z "$ADB" -o "$ADB" = ":"; then
AC_MSG_ERROR([The program adb was not found. Try |mach bootstrap|.])
fi
android_tools="$android_sdk_root"/tools
AC_MSG_CHECKING([for Android tools])
if test -d "$android_tools" -a -f "$android_tools/emulator"; then
AC_MSG_RESULT([$android_tools])
else
AC_MSG_ERROR([You must install the Android tools. Try |mach bootstrap|. (Looked for $android_tools)])
fi
MOZ_PATH_PROG(EMULATOR, emulator, :, [$android_tools])
if test -z "$EMULATOR" -o "$EMULATOR" = ":"; then
AC_MSG_ERROR([The program emulator was not found. Try |mach bootstrap|.])
fi
ANDROID_TARGET_SDK="${android_target_sdk}"
ANDROID_SDK="${android_sdk}"
ANDROID_SDK_ROOT="${android_sdk_root}"
AC_MSG_CHECKING([for compat library dirs])
if test -e "${android_sdk_root}/extras/android/compatibility/v4/android-support-v4.jar" ; then
ANDROID_COMPAT_DIR_BASE="${android_sdk_root}/extras/android/compatibility";
else
ANDROID_COMPAT_DIR_BASE="${android_sdk_root}/extras/android/support";
fi
AC_MSG_RESULT([$ANDROID_COMPAT_DIR_BASE])
ANDROID_TOOLS="${android_tools}"
ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
ANDROID_BUILD_TOOLS="${android_build_tools}"
AC_DEFINE_UNQUOTED(ANDROID_TARGET_SDK,$ANDROID_TARGET_SDK)
AC_SUBST(ANDROID_TARGET_SDK)
AC_SUBST(ANDROID_SDK_ROOT)
AC_SUBST(ANDROID_SDK)
AC_SUBST(ANDROID_TOOLS)
AC_SUBST(ANDROID_PLATFORM_TOOLS)
AC_SUBST(ANDROID_BUILD_TOOLS)
ANDROID_COMPAT_LIB=$ANDROID_COMPAT_DIR_BASE/v4/android-support-v4.jar
AC_MSG_CHECKING([for v4 compat library])
AC_SUBST(ANDROID_COMPAT_LIB)
if ! test -e $ANDROID_COMPAT_LIB ; then
AC_MSG_ERROR([You must download the Android v4 support library when targeting Android. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_COMPAT_LIB)])
fi
AC_MSG_RESULT([$ANDROID_COMPAT_LIB])
MOZ_ANDROID_AAR(support-v4, 22.2.1, android, com/android/support, REQUIRED_INTERNAL_IMPL)
MOZ_ANDROID_AAR(recyclerview-v7, 22.2.1, android, com/android/support)
ANDROID_RECYCLERVIEW_LIB="$ANDROID_COMPAT_DIR_BASE/v7/recyclerview/libs/android-support-v7-recyclerview.jar"
ANDROID_RECYCLERVIEW_RES="$ANDROID_COMPAT_DIR_BASE/v7/recyclerview/res"
AC_MSG_CHECKING([for v7 recyclerview library])
if ! test -e $ANDROID_RECYCLERVIEW_LIB ; then
AC_MSG_ERROR([You must download the v7 recyclerview Android support library. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_RECYCLERVIEW_LIB)])
fi
AC_MSG_RESULT([$ANDROID_RECYCLERVIEW_LIB])
AC_SUBST(ANDROID_RECYCLERVIEW_LIB)
AC_SUBST(ANDROID_RECYCLERVIEW_RES)
dnl Google has a history of moving the Android tools around. We don't
dnl care where they are, so let's try to find them anywhere we can.
ALL_ANDROID_TOOLS_PATHS="$ANDROID_TOOLS$all_android_build_tools:$ANDROID_PLATFORM_TOOLS"
MOZ_PATH_PROG(ZIPALIGN, zipalign, :, [$ALL_ANDROID_TOOLS_PATHS])
MOZ_PATH_PROG(DX, dx, :, [$ALL_ANDROID_TOOLS_PATHS])
MOZ_PATH_PROG(AAPT, aapt, :, [$ALL_ANDROID_TOOLS_PATHS])
MOZ_PATH_PROG(AIDL, aidl, :, [$ALL_ANDROID_TOOLS_PATHS])
MOZ_PATH_PROG(ADB, adb, :, [$ALL_ANDROID_TOOLS_PATHS])
if test -z "$ZIPALIGN" -o "$ZIPALIGN" = ":"; then
AC_MSG_ERROR([The program zipalign was not found. Use --with-android-sdk={android-sdk-dir}.])
fi
if test -z "$DX" -o "$DX" = ":"; then
AC_MSG_ERROR([The program dx was not found. Use --with-android-sdk={android-sdk-dir}.])
fi
if test -z "$AAPT" -o "$AAPT" = ":"; then
AC_MSG_ERROR([The program aapt was not found. Use --with-android-sdk={android-sdk-dir}.])
fi
if test -z "$AIDL" -o "$AIDL" = ":"; then
AC_MSG_ERROR([The program aidl was not found. Use --with-android-sdk={android-sdk-dir}.])
fi
if test -z "$ADB" -o "$ADB" = ":"; then
AC_MSG_ERROR([The program adb was not found. Use --with-android-sdk={android-sdk-dir}.])
ANDROID_SUPPORT_ANNOTATIONS_JAR="$ANDROID_SDK_ROOT/extras/android/m2repository/com/android/support/support-annotations/22.2.1/support-annotations-22.2.1.jar"
AC_MSG_CHECKING([for support-annotations JAR])
if ! test -e $ANDROID_SUPPORT_ANNOTATIONS_JAR ; then
AC_MSG_ERROR([You must download the support-annotations lib. Run the Android SDK tool and install the Android Support Repository under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_SUPPORT_ANNOTATIONS_JAR)])
fi
AC_MSG_RESULT([$ANDROID_SUPPORT_ANNOTATIONS_JAR])
AC_SUBST(ANDROID_SUPPORT_ANNOTATIONS_JAR)
ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB=$ANDROID_SUPPORT_ANNOTATIONS_JAR
AC_SUBST(ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB)
;;
esac

Просмотреть файл

@ -63,8 +63,10 @@ tools:: $(ANDROID_APK_NAME).apk
# out of sync with base's build config.
jars_dir := $(DEPTH)/mobile/android/base
stumbler_jars_dir := $(DEPTH)/mobile/android/stumbler
JAVA_BOOTCLASSPATH := $(JAVA_BOOTCLASSPATH):$(subst $(NULL) ,:,$(wildcard $(jars_dir)/*.jar)):$(subst $(NULL) ,:,$(wildcard $(stumbler_jars_dir)/*.jar)):$(ANDROID_COMPAT_LIB):$(ANDROID_RECYCLERVIEW_LIB)
# We also want to re-compile classes.dex when the associated base
# content changes.
classes.dex: $(wildcard $(jars_dir)/*.jar)
classes.dex: $(wildcard $(stumbler_jars_dir)/*.jar)
ANDROID_CLASSPATH_JARS += \
$(wildcard $(jars_dir)/*.jar) \
$(wildcard $(stumbler_jars_dir)/*.jar) \
$(ANDROID_SUPPORT_V4_AAR_LIB) \
$(ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB) \
$(ANDROID_RECYCLERVIEW_V7_AAR_LIB) \
$(NULL)

Просмотреть файл

@ -30,11 +30,6 @@ RELEASE_SIGN_ANDROID_APK = \
$(ZIPALIGN) -f -v 4 $(2)-unaligned.apk $(2) && \
$(RM) $(2)-unaligned.apk
# For Android, this defaults to $(ANDROID_SDK)/android.jar
ifndef JAVA_BOOTCLASSPATH
JAVA_BOOTCLASSPATH = $(ANDROID_SDK)/android.jar
endif
# For Android, we default to 1.7
ifndef JAVA_VERSION
JAVA_VERSION = 1.7
@ -43,8 +38,6 @@ endif
JAVAC_FLAGS = \
-target $(JAVA_VERSION) \
-source $(JAVA_VERSION) \
$(if $(JAVA_CLASSPATH),-classpath $(JAVA_CLASSPATH),) \
-bootclasspath $(JAVA_BOOTCLASSPATH) \
-encoding UTF8 \
-g:source,lines \
-Werror \

Просмотреть файл

@ -14,6 +14,18 @@ export:: classes
classes: $(call mkdir_deps,classes)
endif #} JAVAFILES
default_bootclasspath_jars := \
$(ANDROID_SDK)/android.jar \
$(NULL)
default_classpath_jars := \
$(NULL)
# Turn a possibly empty list of JAR files into a Java classpath, like a.jar:b.jar.
# Arg 1: Possibly empty list of JAR files.
define classpath_template
$(subst $(NULL) ,:,$(strip $(1)))
endef
ifdef ANDROID_APK_NAME #{
$(if $(ANDROID_APK_PACKAGE),,$(error Missing ANDROID_APK_PACKAGE with ANDROID_APK_NAME))
@ -30,10 +42,12 @@ generated_r_java := generated/$(subst .,/,$(ANDROID_APK_PACKAGE))/R.java
classes.dex: $(call mkdir_deps,classes)
classes.dex: $(generated_r_java)
classes.dex: $(ANDROID_APK_NAME).ap_
classes.dex: $(ANDROID_EXTRA_JARS)
classes.dex: $(default_classpath_jars) $(ANDROID_CLASSPATH_JARS)
classes.dex: $(default_bootclasspath_jars) $(ANDROID_BOOTCLASSPATH_JARS) $(ANDROID_EXTRA_JARS)
classes.dex: $(JAVAFILES)
$(JAVAC) $(JAVAC_FLAGS) -d classes $(filter %.java,$^) \
$(if $(strip $(ANDROID_EXTRA_JARS)),-classpath $(subst $(NULL) ,:,$(strip $(ANDROID_EXTRA_JARS))))
$(addprefix -bootclasspath ,$(call classpath_template,$(default_bootclasspath_jars) $(ANDROID_BOOTCLASSPATH_JARS))) \
$(addprefix -classpath ,$(call classpath_template,$(default_classpath_jars) $(ANDROID_CLASSPATH_JARS) $(ANDROID_EXTRA_JARS)))
$(DX) --dex --output=$@ classes $(ANDROID_EXTRA_JARS)
# R.java and $(ANDROID_APK_NAME).ap_ are both produced by aapt. To
@ -93,8 +107,6 @@ GARBAGE += \
$(ANDROID_APK_NAME).apk \
$(NULL)
JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar
# Include Android specific java flags, instead of what's in rules.mk.
include $(topsrcdir)/config/android-common.mk
endif #} ANDROID_APK_NAME
@ -116,15 +128,16 @@ ifdef JAVA_JAR_TARGETS #{
# existing jarfile-classes directory and start fresh.
define java_jar_template
$(1): $(2) $(3)
$(1): $(2) $(3) $(default_bootclasspath_jars) $(default_classpath_jars)
$$(REPORT_BUILD)
@$$(RM) -rf $(1:.jar=)-classes
@$$(NSINSTALL) -D $(1:.jar=)-classes
@$$(if $$(filter-out .,$$(@D)),$$(NSINSTALL) -D $$(@D))
$$(JAVAC) $$(JAVAC_FLAGS)\
$(4)\
$(4)\
-d $(1:.jar=)-classes\
$(if $(strip $(3)),-classpath $(subst $(NULL) ,:,$(strip $(3))))\
$(addprefix -bootclasspath ,$(call classpath_template,$(default_bootclasspath_jars)))\
$(addprefix -classpath ,$(call classpath_template,$(default_classpath_jars) $(3)))\
$$(filter %.java,$$^)
$$(JAR) cMf $$@ -C $(1:.jar=)-classes .

Просмотреть файл

@ -4070,14 +4070,13 @@ WINNT|Darwin|Android)
esac
dnl ========================================================
dnl Check Android SDK version depending on mobile target.
dnl Ensure Android SDK and build-tools versions depending on
dnl mobile target.
dnl ========================================================
if test -z "$gonkdir" ; then
# Minimum Android SDK API Level we require.
case "$MOZ_BUILD_APP" in
mobile/android | mobile/android/b2gdroid)
android_min_api_level=20
case "$target" in
*-android*|*-linuxandroid*)
:
@ -4087,10 +4086,10 @@ if test -z "$gonkdir" ; then
See https://wiki.mozilla.org/Mobile/Fennec/Android#Setup_Fennec_mozconfig for more information about the necessary options])
;;
esac
MOZ_ANDROID_SDK(22, 22.0.1)
;;
esac
MOZ_ANDROID_SDK($android_min_api_level)
fi
dnl ========================================================

Просмотреть файл

@ -146,7 +146,7 @@
// which is a valid use case.
"no-empty": 2,
// Disallow the use of empty character classes in regular expressions.
"no-empty-class": 2,
"no-empty-character-class": 2,
// Disallow use of labels for anything other then loops and switches.
"no-empty-label": 2,
// Disallow use of eval(). We have other APIs to evaluate code in content.
@ -320,7 +320,7 @@
// Deprecated, will be removed in 1.0.
"space-unary-word-ops": 0,
// Require a space immediately following the // in a line comment.
"spaced-line-comment": [1, "always"],
"spaced-comment": [1, "always"],
// Require "use strict" to be defined globally in the script.
"strict": [2, "global"],
// Disallow comparisons with the value NaN.

Просмотреть файл

@ -8,7 +8,7 @@ MOZ_APP_VENDOR=Mozilla
MOZ_B2GDROID=1
MOZ_B2G=1
MOZ_APP_VERSION=43.0a1
MOZ_APP_VERSION=$FIREFOX_VERSION
MOZ_APP_UA_NAME=Firefox
MOZ_UA_OS_AGNOSTIC=1

Просмотреть файл

@ -49,20 +49,26 @@ GARBAGE_DIRS += classes db jars res sync services generated
# over changes in behaviour between versions.
JAVA_BOOTCLASSPATH := \
$(ANDROID_SDK)/android.jar \
$(ANDROID_COMPAT_LIB) \
$(NULL)
JAVA_BOOTCLASSPATH := $(subst $(NULL) ,:,$(strip $(JAVA_BOOTCLASSPATH)))
JAVA_CLASSPATH += $(ANDROID_RECYCLERVIEW_LIB)
JAVA_CLASSPATH += \
$(ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB) \
$(ANDROID_SUPPORT_V4_AAR_LIB) \
$(ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB) \
$(ANDROID_RECYCLERVIEW_V7_AAR_LIB) \
$(NULL)
# If native devices are enabled, add Google Play Services and some of the v7
# compat libraries.
ifdef MOZ_NATIVE_DEVICES
JAVA_CLASSPATH += \
$(GOOGLE_PLAY_SERVICES_LIB) \
$(ANDROID_MEDIAROUTER_LIB) \
$(ANDROID_APPCOMPAT_LIB) \
$(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \
$(ANDROID_PLAY_SERVICES_CAST_AAR_LIB) \
$(ANDROID_MEDIAROUTER_V7_AAR_LIB) \
$(ANDROID_MEDIAROUTER_V7_AAR_INTERNAL_LIB) \
$(ANDROID_APPCOMPAT_V7_AAR_LIB) \
$(NULL)
endif
@ -71,15 +77,18 @@ JAVA_CLASSPATH := $(subst $(NULL) ,:,$(strip $(JAVA_CLASSPATH)))
# Library jars that we're bundling: these are subject to Proguard before inclusion
# into classes.dex.
java_bundled_libs := \
$(ANDROID_COMPAT_LIB) \
$(ANDROID_RECYCLERVIEW_LIB) \
$(ANDROID_SUPPORT_V4_AAR_LIB) \
$(ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB) \
$(ANDROID_RECYCLERVIEW_V7_AAR_LIB) \
$(NULL)
ifdef MOZ_NATIVE_DEVICES
java_bundled_libs += \
$(GOOGLE_PLAY_SERVICES_LIB) \
$(ANDROID_MEDIAROUTER_LIB) \
$(ANDROID_APPCOMPAT_LIB) \
$(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \
$(ANDROID_PLAY_SERVICES_CAST_AAR_LIB) \
$(ANDROID_MEDIAROUTER_V7_AAR_LIB) \
$(ANDROID_MEDIAROUTER_V7_AAR_INTERNAL_LIB) \
$(ANDROID_APPCOMPAT_V7_AAR_LIB) \
$(NULL)
endif
@ -358,10 +367,12 @@ endif
generated/org/mozilla/gecko/R.java: .aapt.deps ;
# If native devices are enabled, add Google Play Services, build their resources
generated/android/support/v4/R.java: .aapt.deps ;
generated/android/support/v7/appcompat/R.java: .aapt.deps ;
generated/android/support/v7/mediarouter/R.java: .aapt.deps ;
generated/android/support/v7/recyclerview/R.java: .aapt.deps ;
generated/com/google/android/gms/R.java: .aapt.deps ;
generated/com/google/android/gms/cast/R.java: .aapt.deps ;
gecko.ap_: .aapt.deps ;
R.txt: .aapt.deps ;

Просмотреть файл

@ -32,7 +32,7 @@ public class FxAccountConstants {
// Key for avatar URI in profile JSON.
public static final String KEY_PROFILE_JSON_AVATAR = "avatar";
// Key for username in profile JSON.
public static final String KEY_PROFILE_JSON_USERNAME = "username";
public static final String KEY_PROFILE_JSON_USERNAME = "displayName";
// You must wait 15 minutes after failing an age check before trying to create a different account.
public static final long MINIMUM_TIME_TO_WAIT_AFTER_AGE_CHECK_FAILED_IN_MILLISECONDS = 15 * 60 * 1000;

Просмотреть файл

@ -242,6 +242,13 @@ public class FxAccountStatusFragment
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference == profilePreference) {
if (!AppConstants.MOZ_ANDROID_NATIVE_ACCOUNT_UI) {
// There is no native equivalent, bind the click action to fire an intent.
ActivityUtils.openURLInFennec(getActivity().getApplicationContext(), "about:accounts?action=avatar");
}
}
if (preference == manageAccountPreference) {
// There's no native equivalent, so no need to re-direct through an Intent filter.
ActivityUtils.openURLInFennec(getActivity().getApplicationContext(), "about:accounts?action=manage");
@ -482,7 +489,6 @@ public class FxAccountStatusFragment
FxAccountSyncStatusHelper.getInstance().startObserving(syncStatusDelegate);
if (AppConstants.MOZ_ANDROID_FIREFOX_ACCOUNT_PROFILES) {
profilePreference.getIntent().setData(Uri.parse("about:accounts?action=avatar"));
// Register a local broadcast receiver to get profile cached notification.
final IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(FxAccountConstants.ACCOUNT_PROFILE_JSON_UPDATED_ACTION);

Просмотреть файл

@ -7,12 +7,14 @@ package org.mozilla.gecko.home;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.db.BrowserContract.SearchHistory;
import org.mozilla.gecko.GeckoSharedPrefs;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.home.BrowserSearch.OnEditSuggestionListener;
import org.mozilla.gecko.home.BrowserSearch.OnSearchListener;
import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
import org.mozilla.gecko.preferences.GeckoPreferences;
import org.mozilla.gecko.util.StringUtils;
import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.widget.AnimatedHeightLayout;
@ -22,6 +24,7 @@ import org.mozilla.gecko.widget.FlowLayout;
import android.database.Cursor;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@ -218,6 +221,14 @@ class SearchEngineRow extends AnimatedHeightLayout {
}
}
/**
* Displays search suggestions from previous searches.
*
* @param c The Cursor to iterate over for saved search suggestion to display
* @param suggestionCounter global index of where to start adding suggestion "buttons" in the search engine row
* @param animate whether or not to animate suggestions for visual polish
* @param recycledSuggestionCount How many suggestion "button" views we could recycle from previous calls
*/
private void updateFromSavedSearches(Cursor c, boolean animate, int suggestionCounter, int recycledSuggestionCount) {
if (c == null) {
return;
@ -241,7 +252,13 @@ class SearchEngineRow extends AnimatedHeightLayout {
hideRecycledSuggestions(suggestionCounter, recycledSuggestionCount);
}
private Cursor getSavedSearches(String searchTerm, boolean isTablet) {
/**
* Gets matching suggestions from search history.
*
* @param searchTerm the string with which to look for matches in the saved searches
* @return matching prior searches that contain searchTerm
*/
private Cursor getSavedSearches(String searchTerm) {
if (!AppConstants.NIGHTLY_BUILD) {
return null;
}
@ -250,20 +267,28 @@ class SearchEngineRow extends AnimatedHeightLayout {
String[] columns = new String[] { SearchHistory.QUERY };
String actualQuery = SearchHistory.QUERY + " LIKE ?";
String[] queryArgs = new String[] { '%' + searchTerm + '%' };
final int limit = isTablet ? TABLET_MAX : PHONE_MAX;
final int limit = HardwareUtils.isTablet() ? TABLET_MAX : PHONE_MAX;
String sortOrderAndLimit = SearchHistory.DATE +" DESC LIMIT "+limit;
return cr.query(SearchHistory.CONTENT_URI, columns, actualQuery, queryArgs, sortOrderAndLimit);
}
private int updateFromSearchEngine(boolean animate, int recycledSuggestionCount, boolean isTablet, int savedCount) {
/**
* Displays suggestions supplied by the search engine, relative to number of suggestions from search history.
*
* @param animate whether or not to animate suggestions for visual polish
* @param recycledSuggestionCount How many suggestion "button" views we could recycle from previous calls
* @param savedCount how many saved searches this searchTerm has
* @return the global count of how many suggestions have been bound/shown in the search engine row
*/
private int updateFromSearchEngine(boolean animate, int recycledSuggestionCount, int savedCount) {
// Remove this default limit value in Bug 1201325
int limit = TABLET_MAX;
if (AppConstants.NIGHTLY_BUILD) {
limit = isTablet ? TABLET_MAX : PHONE_MAX;
limit = HardwareUtils.isTablet() ? TABLET_MAX : PHONE_MAX;
// If there are less than max saved searches on phones, fill the space with more search engine suggestions
if (!isTablet && savedCount < PHONE_MAX) {
if (!HardwareUtils.isTablet() && savedCount < PHONE_MAX) {
limit += PHONE_MAX - savedCount;
}
}
@ -288,32 +313,58 @@ class SearchEngineRow extends AnimatedHeightLayout {
return suggestionCounter;
}
public void updateSuggestions(boolean suggestionsEnabled, SearchEngine searchEngine, String searchTerm, boolean animate) {
// Update search engine reference. Even if the user has not seen the prompt, we need to set the engine for the mSearchTerm suggestion
/**
* Updates the whole suggestions UI, the search engine UI, suggestions from the default search engine,
* and suggestions from search history.
*
* This can be called before the opt-in permission prompt is shown or set.
* Even if both suggestion types are disabled, we need to update the search engine, its image, and the content description.
*
* @param searchSuggestionsEnabled whether or not suggestions from the default search engine are enabled
* @param searchEngine the search engine to use throughout the SearchEngineRow class
* @param searchTerm the text from the url to get suggestions on
* @param animate whether or not to use animations
**/
public void updateSuggestions(boolean searchSuggestionsEnabled, SearchEngine searchEngine, String searchTerm, boolean animate) {
mSearchEngine = searchEngine;
// Set the search engine icon (e.g., Google) for the row.
mIconView.updateAndScaleImage(mSearchEngine.getIcon(), mSearchEngine.getEngineIdentifier());
// Set the initial content description.
setDescriptionOnSuggestion(mUserEnteredTextView, mUserEnteredTextView.getText().toString());
// This can be called before the opt-in permission prompt is shown or set. Check first.
if (suggestionsEnabled) {
final int recycledSuggestionCount = mSuggestionView.getChildCount();
if (AppConstants.NIGHTLY_BUILD) {
final boolean isTablet = HardwareUtils.isTablet();
final Cursor c = getSavedSearches(searchTerm, isTablet);
try {
final int savedSearchCount = (c != null) ? c.getCount(): 0;
final int suggestionViewCount = updateFromSearchEngine(animate, recycledSuggestionCount, isTablet, savedSearchCount);
updateFromSavedSearches(c, animate, suggestionViewCount, recycledSuggestionCount);
} finally {
if (c != null) {
c.close();
}
}
} else {
updateFromSearchEngine(animate, recycledSuggestionCount, true, 0);
if (!AppConstants.NIGHTLY_BUILD) {
if (searchSuggestionsEnabled) {
updateFromSearchEngine(animate, mSuggestionView.getChildCount(), 0);
}
return;
}
final int recycledSuggestionCount = mSuggestionView.getChildCount();
final SharedPreferences prefs = GeckoSharedPrefs.forApp(getContext());
final boolean savedSearchesEnabled = prefs.getBoolean(GeckoPreferences.PREFS_HISTORY_SAVED_SEARCH, true);
if (searchSuggestionsEnabled && savedSearchesEnabled) {
final Cursor c = getSavedSearches(searchTerm);
try {
final int savedSearchCount = (c != null) ? c.getCount() : 0;
final int suggestionViewCount = updateFromSearchEngine(animate, recycledSuggestionCount, savedSearchCount);
updateFromSavedSearches(c, animate, suggestionViewCount, recycledSuggestionCount);
} finally {
if (c != null) {
c.close();
}
}
} else if (savedSearchesEnabled) {
final Cursor c = getSavedSearches(searchTerm);
try {
updateFromSavedSearches(c, animate, 0, recycledSuggestionCount);
} finally {
if (c != null) {
c.close();
}
}
} else if (searchSuggestionsEnabled) {
updateFromSearchEngine(animate, recycledSuggestionCount, 0);
}
}

Просмотреть файл

@ -290,6 +290,7 @@ size. -->
<!ENTITY pref_sync "Sync">
<!ENTITY pref_sync_summary2 "Sync your tabs, bookmarks, logins, history">
<!ENTITY pref_search_suggestions "Show search suggestions">
<!ENTITY pref_history_search_suggestions "Show search history">
<!ENTITY pref_import_android "Import from Android">
<!ENTITY pref_import_android_summary "Import bookmarks and history from the native browser">
<!ENTITY pref_private_data_history2 "Browsing history">
@ -721,8 +722,6 @@ just addresses the organization to follow, e.g. "This site is run by " -->
<!ENTITY restriction_disallow_guest_browsing_title2 "Disable Guest Browsing">
<!-- Default Bookmarks titles-->
<!-- LOCALIZATION NOTE (bookmarks_title): title for the folder that will contains the default bookmarks -->
<!ENTITY bookmarks_title "Mobile">
<!-- LOCALIZATION NOTE (bookmarks_about_browser): link title for about:fennec -->
<!ENTITY bookmarks_about_browser "Firefox: About your browser">
<!-- LOCALIZATION NOTE (bookmarks_addons): link title for https://addons.mozilla.org/en-US/mobile -->

Просмотреть файл

@ -44,9 +44,13 @@ resjar.generated_sources += [
'org/mozilla/gecko/R.java',
]
if CONFIG['ANDROID_RECYCLERVIEW_RES']:
if CONFIG['ANDROID_SUPPORT_V4_AAR']:
ANDROID_EXTRA_PACKAGES += ['android.support.v4']
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_SUPPORT_V4_AAR_RES']]
resjar.generated_sources += ['android/support/v4/R.java']
if CONFIG['ANDROID_RECYCLERVIEW_V7_AAR']:
ANDROID_EXTRA_PACKAGES += ['android.support.v7.recyclerview']
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_RECYCLERVIEW_RES']]
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_RES']]
resjar.generated_sources += ['android/support/v7/recyclerview/R.java']
resjar.javac_flags += ['-Xlint:all']
@ -107,6 +111,9 @@ gujar.sources += [
'util/WindowUtils.java',
]
gujar.extra_jars = [
CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
'constants.jar',
'gecko-mozglue.jar',
]
@ -585,6 +592,9 @@ gbjar.sources += [ thirdparty_source_dir + f for f in [
android_package_dir = CONFIG['ANDROID_PACKAGE_NAME'].replace('.', '/')
gbjar.generated_sources = [] # Keep it this way.
gbjar.extra_jars += [
CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
'constants.jar'
]
if CONFIG['MOZ_CRASHREPORTER']:
@ -638,9 +648,11 @@ gbjar.extra_jars += [
]
moz_native_devices_jars = [
CONFIG['ANDROID_APPCOMPAT_LIB'],
CONFIG['ANDROID_MEDIAROUTER_LIB'],
CONFIG['GOOGLE_PLAY_SERVICES_LIB'],
CONFIG['ANDROID_APPCOMPAT_V7_AAR_LIB'],
CONFIG['ANDROID_MEDIAROUTER_V7_AAR_LIB'],
CONFIG['ANDROID_MEDIAROUTER_V7_AAR_INTERNAL_LIB'],
CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR_LIB'],
CONFIG['ANDROID_PLAY_SERVICES_CAST_AAR_LIB'],
]
moz_native_devices_sources = [
'ChromeCast.java',
@ -652,22 +664,27 @@ if CONFIG['MOZ_NATIVE_DEVICES']:
gbjar.extra_jars += moz_native_devices_jars
gbjar.sources += moz_native_devices_sources
if CONFIG['ANDROID_APPCOMPAT_RES']:
if CONFIG['ANDROID_APPCOMPAT_V7_AAR']:
ANDROID_EXTRA_PACKAGES += ['android.support.v7.appcompat']
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_APPCOMPAT_RES']]
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_APPCOMPAT_V7_AAR_RES']]
resjar.generated_sources += ['android/support/v7/appcompat/R.java']
if CONFIG['ANDROID_MEDIAROUTER_RES']:
if CONFIG['ANDROID_MEDIAROUTER_V7_AAR']:
ANDROID_EXTRA_PACKAGES += ['android.support.v7.mediarouter']
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_MEDIAROUTER_RES']]
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_MEDIAROUTER_V7_AAR_RES']]
resjar.generated_sources += ['android/support/v7/mediarouter/R.java']
if CONFIG['GOOGLE_PLAY_SERVICES_RES']:
if CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR']:
ANDROID_EXTRA_PACKAGES += ['com.google.android.gms']
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['GOOGLE_PLAY_SERVICES_RES']]
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR_RES']]
resjar.generated_sources += ['com/google/android/gms/R.java']
gbjar.extra_jars += [CONFIG['ANDROID_RECYCLERVIEW_LIB']]
if CONFIG['ANDROID_PLAY_SERVICES_CAST_AAR']:
ANDROID_EXTRA_PACKAGES += ['com.google.android.gms.cast']
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PLAY_SERVICES_CAST_AAR_RES']]
resjar.generated_sources += ['com/google/android/gms/cast/R.java']
gbjar.extra_jars += [CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_LIB']]
gbjar.javac_flags += ['-Xlint:all,-deprecation,-fallthrough', '-J-Xmx512m', '-J-Xms128m']
@ -739,7 +756,11 @@ gtjar.sources += [ thirdparty_source_dir + f for f in [
'com/squareup/picasso/UrlConnectionDownloader.java',
'com/squareup/picasso/Utils.java'
] ]
#gtjar.javac_flags += ['-Xlint:all']
gtjar.extra_jars = [
CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
]
if not CONFIG['MOZILLA_OFFICIAL']:
gtjar.sources += [ thirdparty_source_dir + f for f in [
@ -846,6 +867,9 @@ if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']:
search_activity.sources += [search_source_dir + '/' + f for f in search_activity_sources]
search_activity.javac_flags += ['-Xlint:all']
search_activity.extra_jars = [
CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
'constants.jar',
'gecko-R.jar',
'gecko-browser.jar',

Просмотреть файл

@ -137,6 +137,7 @@ OnSharedPreferenceChangeListener
private static final String PREFS_TRACKING_PROTECTION_LEARN_MORE = NON_PREF_PREFIX + "trackingprotection.learn_more";
private static final String PREFS_CATEGORY_PRIVATE_DATA = NON_PREF_PREFIX + "category_private_data";
public static final String PREFS_HOMEPAGE = NON_PREF_PREFIX + "homepage";
public static final String PREFS_HISTORY_SAVED_SEARCH = NON_PREF_PREFIX + "search.search_history.enabled";
private static final String ACTION_STUMBLER_UPLOAD_PREF = AppConstants.ANDROID_PACKAGE_NAME + ".STUMBLER_PREF";
@ -755,6 +756,13 @@ OnSharedPreferenceChangeListener
i--;
continue;
}
} else if (PREFS_HISTORY_SAVED_SEARCH.equals(key)) {
// Remove settings UI if not on Nightly
if (!AppConstants.NIGHTLY_BUILD) {
preferences.removePreference(pref);
i--;
continue;
}
} else if (PREFS_TELEMETRY_ENABLED.equals(key)) {
if (!AppConstants.MOZ_TELEMETRY_REPORTING) {
preferences.removePreference(pref);

Просмотреть файл

@ -13,6 +13,11 @@
android:defaultValue="false"
android:persistent="false" />
<CheckBoxPreference android:key="android.not_a_preference.search.search_history.enabled"
android:title="@string/pref_history_search_suggestions"
android:defaultValue="true"
android:persistent="true" />
<org.mozilla.gecko.preferences.SearchPreferenceCategory
android:title="@string/pref_category_installed_search_engines"/>

Просмотреть файл

@ -10,12 +10,7 @@
android:key="profile"
android:icon="@drawable/sync_avatar_default"
android:persistent="false"
android:title="" >
<intent
android:action="android.intent.action.VIEW"
android:targetClass="@string/browser_intent_class"
android:targetPackage="@string/browser_intent_package" />
</Preference>
android:title="" />
<Preference
android:editable="false"
android:key="email"

Просмотреть файл

@ -13,6 +13,11 @@
android:defaultValue="false"
android:persistent="false" />
<CheckBoxPreference android:key="android.not_a_preference.search.search_history.enabled"
android:title="@string/pref_history_search_suggestions"
android:defaultValue="true"
android:persistent="true" />
<org.mozilla.gecko.preferences.SearchPreferenceCategory
android:title="@string/pref_category_installed_search_engines"/>

Просмотреть файл

@ -248,6 +248,7 @@
<string name="pref_sync">&pref_sync;</string>
<string name="pref_sync_summary">&pref_sync_summary2;</string>
<string name="pref_search_suggestions">&pref_search_suggestions;</string>
<string name="pref_history_search_suggestions">&pref_history_search_suggestions;</string>
<string name="pref_private_data_history2">&pref_private_data_history2;</string>
<string name="pref_private_data_searchHistory">&pref_private_data_searchHistory;</string>
<string name="pref_private_data_formdata2">&pref_private_data_formdata2;</string>

Просмотреть файл

@ -29,20 +29,13 @@ MOZ_SZIP_FLAGS="-D auto -f auto"
ac_add_options --enable-elf-hack
ANDROID_NDK_VERSION="r8e"
ANDROID_NDK_VERSION="r10e"
ANDROID_NDK_VERSION_32BIT="r8c"
ANDROID_SDK_VERSION="22"
# Build Fennec
ac_add_options --enable-application=mobile/android
if test `uname -m` = 'x86_64'; then
ac_add_options --with-android-ndk="$topsrcdir/android-ndk"
ac_add_options --with-android-sdk="$topsrcdir/android-sdk-linux/platforms/android-$ANDROID_SDK_VERSION"
else
ac_add_options --with-android-ndk="/tools/android-ndk-$ANDROID_NDK_VERSION_32BIT"
ac_add_options --with-android-sdk="/tools/android-sdk-r$ANDROID_SDK_VERSION/platforms/android-$ANDROID_SDK_VERSION"
fi
ac_add_options --with-android-ndk="$topsrcdir/android-ndk"
ac_add_options --with-android-sdk="$topsrcdir/android-sdk-linux"
ac_add_options --with-android-gnu-compiler-version=4.9
ac_add_options --with-android-version=9

Просмотреть файл

@ -7,8 +7,9 @@
"unpack": true
},
{
"size": 329217868,
"digest": "1cf54f12c271a2eea8f03caafa458207768ba12400cf53d742e3c4654a32b18fb75d8e0dece95e27691695751a6f6514ccb724b1a74958948c5f111c5c00da4f",
"size": 408728104,
"visibility": "internal",
"digest": "f78e203a95d748ff74ad69e42ce11829417a2752306dd469bb81bbbc9e5dbaa26eccab92b9de5f30a3a045754e2ebddf6734b3bd9676bbb0aa4131a1c24f7613",
"algorithm": "sha512",
"filename": "android-sdk-linux.tar.xz",
"unpack": true

Просмотреть файл

@ -8,8 +8,9 @@
"unpack": true
},
{
"size": 329217868,
"digest": "1cf54f12c271a2eea8f03caafa458207768ba12400cf53d742e3c4654a32b18fb75d8e0dece95e27691695751a6f6514ccb724b1a74958948c5f111c5c00da4f",
"size": 408728104,
"visibility": "internal",
"digest": "f78e203a95d748ff74ad69e42ce11829417a2752306dd469bb81bbbc9e5dbaa26eccab92b9de5f30a3a045754e2ebddf6734b3bd9676bbb0aa4131a1c24f7613",
"algorithm": "sha512",
"filename": "android-sdk-linux.tar.xz",
"unpack": true

Просмотреть файл

@ -8,9 +8,9 @@
"unpack": true
},
{
"size": 329217868,
"visibility": "internal",
"digest": "1cf54f12c271a2eea8f03caafa458207768ba12400cf53d742e3c4654a32b18fb75d8e0dece95e27691695751a6f6514ccb724b1a74958948c5f111c5c00da4f",
"size": 408728104,
"visibility": "internal",
"digest": "f78e203a95d748ff74ad69e42ce11829417a2752306dd469bb81bbbc9e5dbaa26eccab92b9de5f30a3a045754e2ebddf6734b3bd9676bbb0aa4131a1c24f7613",
"algorithm": "sha512",
"filename": "android-sdk-linux.tar.xz",
"unpack": true

Просмотреть файл

@ -4,7 +4,6 @@
include $(topsrcdir)/config/rules.mk
JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar
include $(topsrcdir)/config/android-common.mk
libs:: javaaddons-1.0.jar

Просмотреть файл

@ -4,7 +4,6 @@
include $(topsrcdir)/config/rules.mk
JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar
include $(topsrcdir)/config/android-common.mk
libs:: stumbler.jar

Просмотреть файл

@ -8,5 +8,5 @@ include('stumbler_sources.mozbuild')
stumbler_jar = add_java_jar('stumbler')
stumbler_jar.sources += stumbler_sources
stumbler_jar.extra_jars += [CONFIG['ANDROID_COMPAT_LIB']]
stumbler_jar.extra_jars += [CONFIG['ANDROID_SUPPORT_V4_AAR_LIB']]
stumbler_jar.javac_flags += ['-Xlint:all']

Просмотреть файл

@ -17,17 +17,6 @@ manifest_FLAGS += \
$(NULL)
ANDROID_MANIFEST_FILE := $(CURDIR)/AndroidManifest.xml
GARBAGE += AndroidManifest.xml
# The test APK needs to know the contents of the target APK while not
# being linked against them. This is a best effort to avoid getting
# out of sync with base's build config.
JARS_DIR := $(DEPTH)/mobile/android/base
JAVA_BOOTCLASSPATH := $(ANDROID_SDK)/android.jar:$(subst $(NULL) ,:,$(wildcard $(JARS_DIR)/*.jar))
# We also want to re-compile classes.dex when the associated base
# content changes.
classes.dex: $(wildcard $(JARS_DIR)/*.jar)
include $(topsrcdir)/config/rules.mk
tools:: $(ANDROID_APK_NAME).apk

Просмотреть файл

@ -13,6 +13,21 @@ include('background_junit3_sources.mozbuild')
jar = add_java_jar('background-junit3')
jar.sources += background_junit3_sources
jar.extra_jars += [CONFIG['ANDROID_COMPAT_LIB']]
jar.extra_jars += [
CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_LIB'],
TOPOBJDIR + '/mobile/android/base/constants.jar',
TOPOBJDIR + '/mobile/android/base/gecko-R.jar',
TOPOBJDIR + '/mobile/android/base/gecko-browser.jar',
TOPOBJDIR + '/mobile/android/base/gecko-mozglue.jar',
TOPOBJDIR + '/mobile/android/base/gecko-thirdparty.jar',
TOPOBJDIR + '/mobile/android/base/gecko-util.jar',
TOPOBJDIR + '/mobile/android/base/sync-thirdparty.jar',
]
if CONFIG['MOZ_ANDROID_MLS_STUMBLER']:
jar.extra_jars += [
TOPOBJDIR + '/mobile/android/stumbler/stumbler.jar',
]
ANDROID_INSTRUMENTATION_MANIFESTS += ['instrumentation.ini']

Просмотреть файл

@ -18,12 +18,3 @@ ANDROID_MANIFEST_FILE := $(CURDIR)/AndroidManifest.xml
include $(topsrcdir)/config/rules.mk
tools:: $(ANDROID_APK_NAME).apk
# The test APK needs to know the contents of the target APK while not
# being linked against them. This is a best effort to avoid getting
# out of sync with base's build config.
JARS_DIR := $(DEPTH)/mobile/android/base
JAVA_BOOTCLASSPATH := $(JAVA_BOOTCLASSPATH):$(subst $(NULL) ,:,$(wildcard $(JARS_DIR)/*.jar))
# We also want to re-compile classes.dex when the associated base
# content changes.
classes.dex: $(wildcard $(JARS_DIR)/*.jar)

Просмотреть файл

@ -28,4 +28,21 @@ jar.sources += [
jar.generated_sources = [] # None yet -- try to keep it this way.
jar.javac_flags += ['-Xlint:all']
jar.extra_jars += [
CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_LIB'],
TOPOBJDIR + '/mobile/android/base/constants.jar',
TOPOBJDIR + '/mobile/android/base/gecko-R.jar',
TOPOBJDIR + '/mobile/android/base/gecko-browser.jar',
TOPOBJDIR + '/mobile/android/base/gecko-mozglue.jar',
TOPOBJDIR + '/mobile/android/base/gecko-thirdparty.jar',
TOPOBJDIR + '/mobile/android/base/gecko-util.jar',
TOPOBJDIR + '/mobile/android/base/sync-thirdparty.jar',
]
if CONFIG['MOZ_ANDROID_MLS_STUMBLER']:
jar.extra_jars += [
TOPOBJDIR + '/mobile/android/stumbler/stumbler.jar',
]
ANDROID_INSTRUMENTATION_MANIFESTS += ['instrumentation.ini']

Просмотреть файл

@ -32,7 +32,6 @@ REPOSITORY_PATH_PREFIX = 'python/mozboot'
REPOSITORY_PATHS = [
'mozboot/__init__.py',
'mozboot/android-ndk.rb',
'mozboot/android.py',
'mozboot/archlinux.py',
'mozboot/base.py',

Просмотреть файл

@ -1,54 +0,0 @@
require "formula"
# This is an antiquated version pinned to NDK revision r8e. That's
# the revision Mozilla's automation currently uses. We could push
# this to https://github.com/Homebrew/homebrew-versions if there's a
# problem shipping it locally.
class AndroidNdk < Formula
homepage "http://developer.android.com/sdk/ndk/index.html"
if MacOS.prefer_64_bit?
url "http://dl.google.com/android/ndk/android-ndk-r8e-darwin-x86_64.tar.bz2"
sha1 "8c8f0d7df5f160c3ef82f2f4836cbcaf18aabf68"
else
url "http://dl.google.com/android/ndk/android-ndk-r8e-darwin-x86.tar.bz2"
sha1 "60536b22b3c09015a4c7072097404a9a1316b242"
end
version "r8e"
depends_on "android-sdk" => :recommended
def install
bin.mkpath
# Now we can install both 64-bit and 32-bit targeting toolchains
prefix.install Dir["*"]
# Create a dummy script to launch the ndk apps
ndk_exec = prefix+"ndk-exec.sh"
ndk_exec.write <<-EOS.undent
#!/bin/sh
BASENAME=`basename $0`
EXEC="#{prefix}/$BASENAME"
test -f "$EXEC" && exec "$EXEC" "$@"
EOS
ndk_exec.chmod 0755
%w[ndk-build ndk-gdb ndk-stack].each { |app| bin.install_symlink ndk_exec => app }
end
def caveats; <<-EOS.undent
We agreed to the Android NDK License Agreement for you by downloading the NDK.
If this is unacceptable you should uninstall.
License information at:
http://developer.android.com/sdk/terms.html
Software and System requirements at:
http://developer.android.com/sdk/ndk/index.html#requirements
For more documentation on Android NDK, please check:
#{prefix}/docs
EOS
end
end

Просмотреть файл

@ -7,24 +7,23 @@ from __future__ import print_function
import errno
import os
import stat
import subprocess
# These are the platform and build-tools versions for building
# mobile/android, respectively. Try to keep these in synch with the
# build system and Mozilla's automation.
ANDROID_PLATFORM = 'android-22'
ANDROID_TARGET_SDK = '22'
ANDROID_BUILD_TOOLS_VERSION = '22.0.1'
# These are the "Android packages" needed for building Firefox for Android.
# Use |android list sdk --extended| to see these identifiers.
ANDROID_PACKAGES = [
'tools',
'platform-tools',
'platform-tools-preview', # Temporarily, tools depends on platform-tools-preview.
'build-tools-%s' % ANDROID_BUILD_TOOLS_VERSION,
ANDROID_PLATFORM,
'extra-android-support',
'extra-google-google_play_services',
'android-%s' % ANDROID_TARGET_SDK,
'extra-google-m2repository',
'extra-android-m2repository',
]
@ -149,15 +148,31 @@ def install_mobile_android_sdk_or_ndk(url, path):
file = url.split('/')[-1]
os.chdir(path)
abspath = os.path.join(download_path, file)
if file.endswith('.tar.gz') or file.endswith('.tgz'):
cmd = ['tar', 'zvxf']
cmd = ['tar', 'zvxf', abspath]
elif file.endswith('.tar.bz2'):
cmd = ['tar', 'jvxf']
elif file.endswitch('.zip'):
cmd = ['unzip']
cmd = ['tar', 'jvxf', abspath]
elif file.endswith('.zip'):
cmd = ['unzip', abspath]
elif file.endswith('.bin'):
# Execute the .bin file, which unpacks the content.
mode = os.stat(path).st_mode
os.chmod(abspath, mode | stat.S_IXUSR)
cmd = [abspath]
else:
raise NotImplementedError("Don't know how to unpack file: %s" % file)
subprocess.check_call(cmd + [os.path.join(download_path, file)])
print('Unpacking %s...' % abspath)
with open(os.devnull, "w") as stdout:
# These unpack commands produce a ton of output; ignore it. The
# .bin files are 7z archives; there's no command line flag to quiet
# output, so we use this hammer.
subprocess.check_call(cmd, stdout=stdout)
print('Unpacking %s... DONE' % abspath)
finally:
os.chdir(old_path)
@ -194,7 +209,11 @@ def ensure_android_packages(android_tool, packages=None):
if not packages:
packages = ANDROID_PACKAGES
missing = list_missing_android_packages(android_tool, packages=packages)
# Bug 1171232: The |android| tool behaviour has changed; we no longer can
# see what packages are installed easily. Force installing everything until
# we find a way to actually see the missing packages.
missing = packages
if not missing:
print(NOT_INSTALLING_ANDROID_PACKAGES % ', '.join(packages))
return
@ -203,11 +222,13 @@ def ensure_android_packages(android_tool, packages=None):
# may be prompted to agree to the Android license.
print(INSTALLING_ANDROID_PACKAGES % ', '.join(missing))
subprocess.check_call([android_tool,
'update', 'sdk', '--no-ui',
'update', 'sdk', '--no-ui', '--all',
'--filter', ','.join(missing)])
# Let's verify.
failing = list_missing_android_packages(android_tool, packages=packages)
# Bug 1171232: The |android| tool behaviour has changed; we no longer can
# see what packages are installed easily. Don't check until we find a way
# to actually verify.
failing = []
if failing:
raise Exception(MISSING_ANDROID_PACKAGES % (', '.join(missing), ', '.join(failing)))

Просмотреть файл

@ -123,16 +123,16 @@ class DebianBootstrapper(BaseBootstrapper):
# 2. The user may have an external Android SDK (in which case we save
# them a lengthy download), or they may have already completed the
# download. We unpack to ~/.mozbuild/{android-sdk-linux, android-ndk-r8e}.
# download. We unpack to ~/.mozbuild/{android-sdk-linux, android-ndk-r10e}.
mozbuild_path = os.environ.get('MOZBUILD_STATE_PATH', os.path.expanduser(os.path.join('~', '.mozbuild')))
self.sdk_path = os.environ.get('ANDROID_SDK_HOME', os.path.join(mozbuild_path, 'android-sdk-linux'))
self.ndk_path = os.environ.get('ANDROID_NDK_HOME', os.path.join(mozbuild_path, 'android-ndk-r8e'))
self.ndk_path = os.environ.get('ANDROID_NDK_HOME', os.path.join(mozbuild_path, 'android-ndk-r10e'))
self.sdk_url = 'https://dl.google.com/android/android-sdk_r24.0.1-linux.tgz'
is_64bits = sys.maxsize > 2**32
if is_64bits:
self.ndk_url = 'https://dl.google.com/android/ndk/android-ndk-r8e-linux-x86_64.tar.bz2'
self.ndk_url = 'https://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin'
else:
self.ndk_url = 'https://dl.google.com/android/ndk/android-ndk-r8e-linux-x86.tar.bz2'
self.ndk_url = 'https://dl.google.com/android/ndk/android-ndk-r10e-linux-x86.bin'
android.ensure_android_sdk_and_ndk(path=mozbuild_path,
sdk_path=self.sdk_path, sdk_url=self.sdk_url,
ndk_path=self.ndk_path, ndk_url=self.ndk_url)
@ -144,10 +144,7 @@ class DebianBootstrapper(BaseBootstrapper):
def suggest_mobile_android_mozconfig(self):
import android
# The SDK path that mozconfig wants includes platforms/android-21.
sdk_path = os.path.join(self.sdk_path, 'platforms', android.ANDROID_PLATFORM)
android.suggest_mozconfig(sdk_path=sdk_path,
android.suggest_mozconfig(sdk_path=self.sdk_path,
ndk_path=self.ndk_path)
def _update_package_manager(self):

Просмотреть файл

@ -324,20 +324,18 @@ class OSXBootstrapper(BaseBootstrapper):
'--with-clang', '--all-targets'])
def ensure_homebrew_mobile_android_packages(self):
# Multi-part process:
# 1. System packages.
# 2. Android SDK and NDK.
# 3. Android packages.
import android
# If we're run from a downloaded bootstrap.py, then android-ndk.rb is
# fetched into a temporary directory. This finds that directory.
import inspect
path_to_android = os.path.abspath(os.path.dirname(inspect.getfile(android)))
# We don't need wget because we install the Android SDK and NDK from
# packages. If we used the android.py module, we'd need wget.
# 1. System packages.
packages = [
('android-sdk', 'android-sdk'),
('android-ndk', os.path.join(path_to_android, 'android-ndk.rb')), # This is a locally provided brew formula!
('ant', 'ant'),
('brew-cask', 'caskroom/cask/brew-cask'), # For installing Java later.
('wget', 'wget'),
]
self._ensure_homebrew_packages(packages)
@ -348,16 +346,31 @@ class OSXBootstrapper(BaseBootstrapper):
if installed:
print(JAVA_LICENSE_NOTICE) # We accepted a license agreement for the user.
# We could probably fish this path from |brew info android-sdk|.
android_tool = '/usr/local/opt/android-sdk/tools/android'
android.ensure_android_packages(android_tool)
# 2. The user may have an external Android SDK (in which case we save
# them a lengthy download), or they may have already completed the
# download. We unpack to ~/.mozbuild/{android-sdk-linux, android-ndk-r10e}.
mozbuild_path = os.environ.get('MOZBUILD_STATE_PATH', os.path.expanduser(os.path.join('~', '.mozbuild')))
self.sdk_path = os.environ.get('ANDROID_SDK_HOME', os.path.join(mozbuild_path, 'android-sdk-macosx'))
self.ndk_path = os.environ.get('ANDROID_NDK_HOME', os.path.join(mozbuild_path, 'android-ndk-r10e'))
self.sdk_url = 'https://dl.google.com/android/android-sdk_r24.0.1-macosx.zip'
is_64bits = sys.maxsize > 2**32
if is_64bits:
self.ndk_url = 'https://dl.google.com/android/ndk/android-ndk-r10e-darwin-x86_64.bin'
else:
raise Exception('You need a 64-bit version of Mac OS X to build Firefox for Android.')
android.ensure_android_sdk_and_ndk(path=mozbuild_path,
sdk_path=self.sdk_path, sdk_url=self.sdk_url,
ndk_path=self.ndk_path, ndk_url=self.ndk_url)
def suggest_homebrew_mobile_android_mozconfig(self):
# 3. We expect the |android| tool to at
# ~/.mozbuild/android-sdk-macosx/tools/android.
android_tool = os.path.join(self.sdk_path, 'tools', 'android')
android.ensure_android_packages(android_tool=android_tool)
def suggest_mobile_android_mozconfig(self):
import android
# We could probably fish this path from |brew info android-sdk|.
sdk_path = '/usr/local/opt/android-sdk/platforms/%s' % android.ANDROID_PLATFORM
ndk_path = '/usr/local/opt/android-ndk'
android.suggest_mozconfig(sdk_path=sdk_path, ndk_path=ndk_path)
android.suggest_mozconfig(sdk_path=self.sdk_path,
ndk_path=self.ndk_path)
def _ensure_macports_packages(self, packages):
self.port = self.which('port')

Просмотреть файл

@ -0,0 +1,72 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals
import argparse
import errno
import os
import shutil
import sys
import zipfile
from mozpack.files import FileFinder
import mozpack.path as mozpath
from mozbuild.util import ensureParentDir
def explode(aar, destdir):
# Take just the support-v4-22.2.1 part.
name, _ = os.path.splitext(os.path.basename(aar))
destdir = mozpath.join(destdir, name)
if os.path.exists(destdir):
# We always want to start fresh.
shutil.rmtree(destdir)
ensureParentDir(destdir)
with zipfile.ZipFile(aar) as zf:
zf.extractall(destdir)
# classes.jar is always present. However, multiple JAR files with the same
# name confuses our staged Proguard process in
# mobile/android/base/Makefile.in, so we make the names unique here.
classes_jar = mozpath.join(destdir, name + '-classes.jar')
os.rename(mozpath.join(destdir, 'classes.jar'), classes_jar)
# Embedded JAR libraries are optional.
finder = FileFinder(mozpath.join(destdir, 'libs'), find_executables=False)
for p, _ in finder.find('*.jar'):
jar = mozpath.join(finder.base, name + '-' + p)
os.rename(mozpath.join(finder.base, p), jar)
# Frequently assets/ is present but empty. Protect against meaningless
# changes to the AAR files by deleting empty assets/ directories.
assets = mozpath.join(destdir, 'assets')
try:
os.rmdir(assets)
except OSError, e:
if e.errno in (errno.ENOTEMPTY, errno.ENOENT):
pass
else:
raise
return True
def main(argv):
parser = argparse.ArgumentParser(
description='Explode Android AAR file.')
parser.add_argument('--destdir', required=True, help='Destination directory.')
parser.add_argument('aars', nargs='+', help='Path to AAR file(s).')
args = parser.parse_args(argv)
for aar in args.aars:
if not explode(aar, args.destdir):
return 1
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))

Просмотреть файл

@ -10,7 +10,6 @@ include $(topsrcdir)/config/rules.mk
# Fennec and all instrumentation tests need to be signed with the same
# key, which means release signing them all.
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
include $(topsrcdir)/config/android-common.mk
stage-package:

Просмотреть файл

@ -98,7 +98,6 @@ $(_DEST_DIR):
# On Android only, include a release signed Robocop APK in the test package.
ifeq ($(MOZ_BUILD_APP),mobile/android)
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
include $(topsrcdir)/config/android-common.mk
stage-package-android:

Просмотреть файл

@ -485,38 +485,50 @@ class AndroidEmulator(object):
def _find_sdk_exe(self, exe, tools):
if tools:
subdir = 'tools'
var = 'ANDROID_TOOLS'
else:
subdir = 'platform-tools'
var = 'ANDROID_PLATFORM_TOOLS'
found = False
if not found and self.substs:
# It's best to use the tool specified by the build, rather
# than something we find on the PATH or crawl for.
try:
exe_path = self.substs[exe.upper()]
if os.path.exists(exe_path):
found = True
else:
self._log_debug(
"Unable to find executable at %s" % exe_path)
except KeyError:
self._log_debug("%s not set" % exe.upper())
# Can exe be found in the Android SDK?
try:
android_sdk_root = os.environ['ANDROID_SDK_ROOT']
exe_path = os.path.join(
android_sdk_root, subdir, exe)
if os.path.exists(exe_path):
found = True
else:
_log_debug(
"Unable to find executable at %s" % exe_path)
except KeyError:
_log_debug("ANDROID_SDK_ROOT not set")
if not found and self.substs:
# Can exe be found in ANDROID_TOOLS/ANDROID_PLATFORM_TOOLS?
if not found:
try:
android_sdk_root = os.environ['ANDROID_SDK_ROOT']
exe_path = os.path.join(
self.substs[var], exe)
android_sdk_root, subdir, exe)
if os.path.exists(exe_path):
found = True
else:
_log_debug(
"Unable to find executable at %s" % exe_path)
except KeyError:
_log_debug("%s not set" % var)
_log_debug("ANDROID_SDK_ROOT not set")
if not found:
# Can exe be found in the Android SDK?
try:
android_sdk_root = os.environ['ANDROID_SDK_ROOT']
exe_path = os.path.join(
android_sdk_root, subdir, exe)
if os.path.exists(exe_path):
found = True
else:
_log_debug(
"Unable to find executable at %s" % exe_path)
except KeyError:
_log_debug("ANDROID_SDK_ROOT not set")
if not found:
# Can exe be found in the default bootstrap location?

Просмотреть файл

@ -286,7 +286,9 @@ this.SearchSuggestionController.prototype = {
return;
}
if (this._searchString !== serverResults[0]) {
if (!serverResults[0] ||
this._searchString.localeCompare(serverResults[0], undefined,
{ sensitivity: "base" })) {
// something is wrong here so drop remote results
deferredResponse.resolve("Unexpected response, this._searchString does not match remote response");
return;

Просмотреть файл

@ -27,6 +27,8 @@ function handleRequest(request, response) {
writeSuggestions(q);
} else if (q == "Query Mismatch") {
writeSuggestions("This is an incorrect query string", ["some result"]);
} else if (q == "Query Case Mismatch") {
writeSuggestions(q.toUpperCase(), [q]);
} else if (q == "") {
writeSuggestions("", ["The server should never be sent an empty query"]);
} else if (q && q.startsWith("mo")) {
@ -70,7 +72,7 @@ function parseQueryString(queryString) {
let query = {};
queryString.split('&').forEach(function (val) {
let [name, value] = val.split('=');
query[name] = unescape(value).replace("+", " ");
query[name] = unescape(value).replace(/[+]/g, " ");
});
return query;
}

Просмотреть файл

@ -124,6 +124,14 @@ add_task(function* simple_remote_no_local_result() {
do_check_eq(result.remote[2], "mom");
});
add_task(function* remote_term_case_mismatch() {
let controller = new SearchSuggestionController();
let result = yield controller.fetch("Query Case Mismatch", false, getEngine);
do_check_eq(result.term, "Query Case Mismatch");
do_check_eq(result.remote.length, 1);
do_check_eq(result.remote[0], "Query Case Mismatch");
});
add_task(function* simple_local_no_remote_result() {
yield updateSearchHistory("bump", "no remote entries");

Просмотреть файл

@ -17,6 +17,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "ViewSourceBrowser",
"resource://gre/modules/ViewSourceBrowser.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
"resource://gre/modules/Deprecated.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
var gViewSourceUtils = {
@ -232,18 +234,35 @@ var gViewSourceUtils = {
"openInExternalEditor are using an out-of-date API.",
"https://developer.mozilla.org/en-US/Add-ons/" +
"Code_snippets/View_Source_for_XUL_Applications");
if (Components.utils.isCrossProcessWrapper(aDocument)) {
throw new Error("View Source cannot accept a CPOW as a document.");
}
data = {
url: aArgsOrURL,
pageDescriptor: aPageDescriptor,
doc: aDocument,
lineNumber: aLineNumber
lineNumber: aLineNumber,
isPrivate: false,
};
if (aDocument) {
data.isPrivate =
PrivateBrowsingUtils.isWindowPrivate(aDocument.defaultView);
}
} else {
let { URL, outerWindowID, lineNumber } = aArgsOrURL;
let { URL, browser, lineNumber } = aArgsOrURL;
data = {
url: URL,
lineNumber
lineNumber,
isPrivate: false,
};
if (browser) {
data.doc = {
characterSet: browser.characterSet,
contentType: browser.documentContentType,
title: browser.contentTitle,
};
data.isPrivate = PrivateBrowsingUtils.isBrowserPrivate(browser);
}
}
try {
@ -256,12 +275,12 @@ var gViewSourceUtils = {
// make a uri
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var charset = aDocument ? aDocument.characterSet : null;
var charset = data.doc ? data.doc.characterSet : null;
var uri = ios.newURI(data.url, charset, null);
data.uri = uri;
var path;
var contentType = aDocument ? aDocument.contentType : null;
var contentType = data.doc ? data.doc.contentType : null;
if (uri.scheme == "file") {
// it's a local file; we can open it directly
path = uri.QueryInterface(Components.interfaces.nsIFileURL).file.path;
@ -275,24 +294,11 @@ var gViewSourceUtils = {
this.viewSourceProgressListener.editor = editor;
this.viewSourceProgressListener.callBack = aCallBack;
this.viewSourceProgressListener.data = data;
if (!aPageDescriptor) {
if (!data.pageDescriptor) {
// without a page descriptor, loadPage has no chance of working. download the file.
var file = this.getTemporaryFile(uri, aDocument, contentType);
var file = this.getTemporaryFile(uri, data.doc, contentType);
this.viewSourceProgressListener.file = file;
let fromPrivateWindow = false;
if (aDocument) {
try {
fromPrivateWindow =
aDocument.defaultView
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsILoadContext)
.usePrivateBrowsing;
} catch (e) {
}
}
var webBrowserPersist = Components
.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
.createInstance(this.mnsIWebBrowserPersist);
@ -300,11 +306,11 @@ var gViewSourceUtils = {
webBrowserPersist.persistFlags = this.mnsIWebBrowserPersist.PERSIST_FLAGS_REPLACE_EXISTING_FILES;
webBrowserPersist.progressListener = this.viewSourceProgressListener;
let referrerPolicy = Components.interfaces.nsIHttpChannel.REFERRER_POLICY_NO_REFERRER;
webBrowserPersist.savePrivacyAwareURI(uri, null, null, referrerPolicy, null, null, file, fromPrivateWindow);
webBrowserPersist.savePrivacyAwareURI(uri, null, null, referrerPolicy, null, null, file, data.isPrivate);
let helperService = Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"]
.getService(Components.interfaces.nsPIExternalAppLauncher);
if (fromPrivateWindow) {
if (data.isPrivate) {
// register the file to be deleted when possible
helperService.deleteTemporaryPrivateFileWhenPossible(file);
} else {
@ -324,7 +330,7 @@ var gViewSourceUtils = {
progress.addProgressListener(this.viewSourceProgressListener,
this.mnsIWebProgress.NOTIFY_STATE_DOCUMENT);
var pageLoader = webShell.QueryInterface(this.mnsIWebPageDescriptor);
pageLoader.loadPage(aPageDescriptor, this.mnsIWebPageDescriptor.DISPLAY_AS_SOURCE);
pageLoader.loadPage(data.pageDescriptor, this.mnsIWebPageDescriptor.DISPLAY_AS_SOURCE);
}
}
} catch (ex) {
@ -457,16 +463,9 @@ var gViewSourceUtils = {
coStream.close();
foStream.close();
let fromPrivateWindow =
this.data.doc.defaultView
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsILoadContext)
.usePrivateBrowsing;
let helperService = Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"]
.getService(Components.interfaces.nsPIExternalAppLauncher);
if (fromPrivateWindow) {
if (this.data.isPrivate) {
// register the file to be deleted when possible
helperService.deleteTemporaryPrivateFileWhenPossible(this.file);
} else {

Просмотреть файл

@ -264,7 +264,6 @@ endif #Create an RPM file
ifeq ($(MOZ_PKG_FORMAT),APK)
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
include $(MOZILLA_DIR)/config/android-common.mk
DIST_FILES =