This commit is contained in:
Ryan VanderMeulen 2014-10-12 14:26:20 -04:00
Родитель 0417eeccfc 32dfc68a9e
Коммит 4f3847ee9a
163 изменённых файлов: 1259 добавлений и 542 удалений

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

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource:///modules/SitePermissions.jsm");
Components.utils.import("resource://gre/modules/BrowserUtils.jsm");
const nsIQuotaManager = Components.interfaces.nsIQuotaManager;
@ -231,20 +232,6 @@ function onIndexedDBUsageCallback(uri, usage, fileUsage)
}
}
// XXX copied this from browser-plugins.js - is there a way to share?
function makeNicePluginName(aName) {
if (aName == "Shockwave Flash")
return "Adobe Flash";
// Clean up the plugin name by stripping off any trailing version numbers
// or "plugin". EG, "Foo Bar Plugin 1.23_02" --> "Foo Bar"
// Do this by first stripping the numbers, etc. off the end, and then
// removing "Plugin" (and then trimming to get rid of any whitespace).
// (Otherwise, something like "Java(TM) Plug-in 1.7.0_07" gets mangled)
let newName = aName.replace(/[\s\d\.\-\_\(\)]+$/, "").replace(/\bplug-?in\b/i, "").trim();
return newName;
}
function fillInPluginPermissionTemplate(aPluginName, aPermissionString) {
let permPluginTemplate = document.getElementById("permPluginTemplate").cloneNode(true);
permPluginTemplate.setAttribute("permString", aPermissionString);
@ -288,7 +275,7 @@ function initPluginsRow() {
for (let mimeType of plugin.getMimeTypes()) {
let permString = pluginHost.getPermissionStringForType(mimeType);
if (!permissionMap.has(permString)) {
var name = makeNicePluginName(plugin.name);
let name = BrowserUtils.makeNicePluginName(plugin.name);
if (permString.startsWith("plugin-vulnerable:")) {
name += " \u2014 " + vulnerableLabel;
}

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

@ -301,6 +301,7 @@ SearchSuggestionUIController.prototype = {
_makeTableRow: function (type, suggestionStr, currentRow, searchWords) {
let row = document.createElementNS(HTML_NS, "tr");
row.dir = "auto";
row.classList.add("searchSuggestionRow");
row.classList.add(type);
row.setAttribute("role", "presentation");
@ -365,7 +366,6 @@ SearchSuggestionUIController.prototype = {
this._table = document.createElementNS(HTML_NS, "table");
this._table.id = id;
this._table.hidden = true;
this._table.dir = "auto";
this._table.classList.add("searchSuggestionTable");
this._table.setAttribute("role", "listbox");
return this._table;

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

@ -43,6 +43,8 @@ add_task(function* () {
let result = yield promise_first_result("open a search");
isnot(result, null, "Should have a result");
is(result.hasAttribute("image"), false, "Result shouldn't have an image attribute");
let tabPromise = promiseTabLoaded(gBrowser.selectedTab);
EventUtils.synthesizeMouseAtCenter(result, {});
yield tabPromise;

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

@ -3,14 +3,13 @@
* http://creativecommons.org/publicdomain/zero/1.0/
**/
let gOriginalEngine;
let gOriginalEngine;
add_task(function* () {
// This test is only relevant if UnifiedComplete is enabled.
if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete"))
return;
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
Services.search.addEngineWithDetails("MozSearch", "", "moz", "", "GET",
let iconURI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC";
Services.search.addEngineWithDetails("MozSearch", iconURI, "moz", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
gOriginalEngine = Services.search.currentEngine;
@ -22,6 +21,7 @@ add_task(function* () {
Services.search.currentEngine = gOriginalEngine;
let engine = Services.search.getEngineByName("MozSearch");
Services.search.removeEngine(engine);
Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
try {
gBrowser.removeTab(tab);
@ -35,6 +35,12 @@ add_task(function* () {
EventUtils.synthesizeKey("h" , {});
yield promiseSearchComplete();
let result = gURLBar.popup.richlistbox.children[0];
ok(result.hasAttribute("image"), "Result should have an image attribute");
// Image attribute gets a suffix (-moz-resolution) added in the value.
ok(result.getAttribute("image").startsWith(engine.iconURI.spec),
"Image attribute should have the search engine's icon");
EventUtils.synthesizeKey("VK_RETURN" , { });
yield promiseTabLoaded(gBrowser.selectedTab);

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

@ -24,7 +24,9 @@ function test() {
}
function startTests() {
ok (!DevEdition.styleSheet, "There is no devedition style sheet by default.");
info ("Setting browser.devedition.theme.enabled to false.");
Services.prefs.setBoolPref(PREF_DEVEDITION_THEME, false);
ok (!DevEdition.styleSheet, "There is no devedition style sheet when the pref is false.");
info ("Setting browser.devedition.theme.enabled to true.");
Services.prefs.setBoolPref(PREF_DEVEDITION_THEME, true);
@ -53,6 +55,7 @@ function startTests() {
ok (!DevEdition.styleSheet, "The devedition stylesheet has been removed.");
info ("Checking :root attributes based on devtools theme.");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light");
is (document.documentElement.getAttribute("devtoolstheme"), "light",
"The documentElement has an attribute based on devtools theme.");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");

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

@ -20,7 +20,7 @@
<script type="text/javascript" src="loop/libs/l10n.js"></script>
<script type="text/javascript" src="loop/js/otconfig.js"></script>
<script type="text/javascript" src="loop/libs/sdk.js"></script>
<script type="text/javascript" src="loop/shared/libs/react-0.11.1.js"></script>
<script type="text/javascript" src="loop/shared/libs/react-0.11.2.js"></script>
<script type="text/javascript" src="loop/shared/libs/jquery-2.1.0.js"></script>
<script type="text/javascript" src="loop/shared/libs/lodash-2.4.1.js"></script>
<script type="text/javascript" src="loop/shared/libs/backbone-1.1.2.js"></script>

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

@ -14,7 +14,7 @@
<div id="main"></div>
<script type="text/javascript" src="loop/shared/libs/react-0.11.1.js"></script>
<script type="text/javascript" src="loop/shared/libs/react-0.11.2.js"></script>
<script type="text/javascript" src="loop/libs/l10n.js"></script>
<script type="text/javascript" src="loop/shared/libs/jquery-2.1.0.js"></script>
<script type="text/javascript" src="loop/shared/libs/lodash-2.4.1.js"></script>

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -1,5 +1,5 @@
/**
* React (with addons) v0.11.1
* React (with addons) v0.11.2
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.React=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/**
@ -3713,6 +3713,7 @@ var HTMLDOMPropertyConfig = {
loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
max: null,
maxLength: MUST_USE_ATTRIBUTE,
media: MUST_USE_ATTRIBUTE,
mediaGroup: null,
method: null,
min: null,
@ -3720,6 +3721,7 @@ var HTMLDOMPropertyConfig = {
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
name: null,
noValidate: HAS_BOOLEAN_VALUE,
open: null,
pattern: null,
placeholder: null,
poster: null,
@ -3740,11 +3742,12 @@ var HTMLDOMPropertyConfig = {
selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
shape: null,
size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
sizes: MUST_USE_ATTRIBUTE,
span: HAS_POSITIVE_NUMERIC_VALUE,
spellCheck: null,
src: null,
srcDoc: MUST_USE_PROPERTY,
srcSet: null,
srcSet: MUST_USE_ATTRIBUTE,
start: HAS_NUMERIC_VALUE,
step: null,
style: null,
@ -4279,9 +4282,21 @@ var ReactServerRendering = _dereq_("./ReactServerRendering");
var ReactTextComponent = _dereq_("./ReactTextComponent");
var onlyChild = _dereq_("./onlyChild");
var warning = _dereq_("./warning");
ReactDefaultInjection.inject();
// Specifying arguments isn't necessary since we just use apply anyway, but it
// makes it clear for those actually consuming this API.
function createDescriptor(type, props, children) {
var args = Array.prototype.slice.call(arguments, 1);
return type.apply(null, args);
}
if ("production" !== "development") {
var _warnedForDeprecation = false;
}
var React = {
Children: {
map: ReactChildren.map,
@ -4295,10 +4310,18 @@ var React = {
EventPluginUtils.useTouchEvents = shouldUseTouch;
},
createClass: ReactCompositeComponent.createClass,
createDescriptor: function(type, props, children) {
var args = Array.prototype.slice.call(arguments, 1);
return type.apply(null, args);
createDescriptor: function() {
if ("production" !== "development") {
("production" !== "development" ? warning(
_warnedForDeprecation,
'React.createDescriptor is deprecated and will be removed in the ' +
'next version of React. Use React.createElement instead.'
) : null);
_warnedForDeprecation = true;
}
return createDescriptor.apply(this, arguments);
},
createElement: createDescriptor,
constructAndRenderComponent: ReactMount.constructAndRenderComponent,
constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
renderComponent: ReactPerf.measure(
@ -4367,11 +4390,11 @@ if ("production" !== "development") {
// Version exists only in the open-source version of React, not in Facebook's
// internal version.
React.version = '0.11.1';
React.version = '0.11.2';
module.exports = React;
},{"./DOMPropertyOperations":12,"./EventPluginUtils":20,"./ExecutionEnvironment":22,"./ReactChildren":34,"./ReactComponent":35,"./ReactCompositeComponent":38,"./ReactContext":39,"./ReactCurrentOwner":40,"./ReactDOM":41,"./ReactDOMComponent":43,"./ReactDefaultInjection":53,"./ReactDescriptor":56,"./ReactInstanceHandles":64,"./ReactMount":67,"./ReactMultiChild":68,"./ReactPerf":71,"./ReactPropTypes":75,"./ReactServerRendering":79,"./ReactTextComponent":83,"./onlyChild":149}],30:[function(_dereq_,module,exports){
},{"./DOMPropertyOperations":12,"./EventPluginUtils":20,"./ExecutionEnvironment":22,"./ReactChildren":34,"./ReactComponent":35,"./ReactCompositeComponent":38,"./ReactContext":39,"./ReactCurrentOwner":40,"./ReactDOM":41,"./ReactDOMComponent":43,"./ReactDefaultInjection":53,"./ReactDescriptor":56,"./ReactInstanceHandles":64,"./ReactMount":67,"./ReactMultiChild":68,"./ReactPerf":71,"./ReactPropTypes":75,"./ReactServerRendering":79,"./ReactTextComponent":83,"./onlyChild":149,"./warning":158}],30:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
@ -7408,6 +7431,7 @@ var ReactDOM = mapObject({
del: false,
details: false,
dfn: false,
dialog: false,
div: false,
dl: false,
dt: false,
@ -7455,6 +7479,7 @@ var ReactDOM = mapObject({
output: false,
p: false,
param: true,
picture: false,
pre: false,
progress: false,
q: false,

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

@ -69,9 +69,9 @@ browser.jar:
# Shared libs
#ifdef DEBUG
content/browser/loop/shared/libs/react-0.11.1.js (content/shared/libs/react-0.11.1.js)
content/browser/loop/shared/libs/react-0.11.2.js (content/shared/libs/react-0.11.2.js)
#else
content/browser/loop/shared/libs/react-0.11.1.js (content/shared/libs/react-0.11.1-prod.js)
content/browser/loop/shared/libs/react-0.11.2.js (content/shared/libs/react-0.11.2-prod.js)
#endif
content/browser/loop/shared/libs/lodash-2.4.1.js (content/shared/libs/lodash-2.4.1.js)
content/browser/loop/shared/libs/jquery-2.1.0.js (content/shared/libs/jquery-2.1.0.js)

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

@ -29,7 +29,7 @@
</script>
<script type="text/javascript" src="shared/libs/sdk.js"></script>
<script type="text/javascript" src="libs/l10n-gaia-02ca67948fe8.js"></script>
<script type="text/javascript" src="shared/libs/react-0.11.1.js"></script>
<script type="text/javascript" src="shared/libs/react-0.11.2.js"></script>
<script type="text/javascript" src="shared/libs/jquery-2.1.0.js"></script>
<script type="text/javascript" src="shared/libs/lodash-2.4.1.js"></script>
<script type="text/javascript" src="shared/libs/backbone-1.1.2.js"></script>

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

@ -16,7 +16,7 @@
<div id="fixtures"></div>
<!-- libs -->
<script src="../../content/libs/l10n.js"></script>
<script src="../../content/shared/libs/react-0.11.1.js"></script>
<script src="../../content/shared/libs/react-0.11.2.js"></script>
<script src="../../content/shared/libs/jquery-2.1.0.js"></script>
<script src="../../content/shared/libs/lodash-2.4.1.js"></script>
<script src="../../content/shared/libs/backbone-1.1.2.js"></script>

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

@ -16,7 +16,7 @@
<div id="fixtures"></div>
<!-- libs -->
<script src="../../content/shared/libs/react-0.11.1.js"></script>
<script src="../../content/shared/libs/react-0.11.2.js"></script>
<script src="../../content/shared/libs/jquery-2.1.0.js"></script>
<script src="../../content/shared/libs/lodash-2.4.1.js"></script>
<script src="../../content/shared/libs/backbone-1.1.2.js"></script>

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

@ -16,7 +16,7 @@
<div id="messages"></div>
<div id="fixtures"></div>
<!-- libs -->
<script src="../../content/shared/libs/react-0.11.1.js"></script>
<script src="../../content/shared/libs/react-0.11.2.js"></script>
<script src="../../content/shared/libs/jquery-2.1.0.js"></script>
<script src="../../content/shared/libs/lodash-2.4.1.js"></script>
<script src="../../content/shared/libs/backbone-1.1.2.js"></script>

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

@ -27,7 +27,7 @@
window.OTProperties.cssURL = window.OTProperties.assetURL + 'css/ot.css';
</script>
<script src="../content/shared/libs/sdk.js"></script>
<script src="../content/shared/libs/react-0.11.1.js"></script>
<script src="../content/shared/libs/react-0.11.2.js"></script>
<script src="../content/shared/libs/jquery-2.1.0.js"></script>
<script src="../content/shared/libs/lodash-2.4.1.js"></script>
<script src="../content/shared/libs/backbone-1.1.2.js"></script>

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

@ -1017,10 +1017,6 @@ let SessionStoreInternal = {
SessionCookies.update([winData]);
}
// Until we decide otherwise elsewhere, this window is part of a series
// of closing windows to quit.
RevivableWindows.add(winData);
// Store the window's close date to figure out when each individual tab
// was closed. This timestamp should allow re-arranging data based on how
// recently something was closed.
@ -1051,6 +1047,10 @@ let SessionStoreInternal = {
this._closedWindows.unshift(winData);
this._capClosedWindows();
}
// Until we decide otherwise elsewhere, this window
// is part of a series of closing windows to quit.
RevivableWindows.add(winData);
}
// clear this window from the list

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

@ -39,6 +39,16 @@ add_task(function* test_revive_windows() {
yield promiseBrowserLoaded(tab.linkedBrowser);
}
// Create a private window.
// This window must not be revived.
{
let win = yield promiseNewWindow({private: true});
windows.push(win);
let tab = win.gBrowser.addTab("about:mozilla");
yield promiseBrowserLoaded(tab.linkedBrowser);
}
// Close all windows.
for (let win of windows) {
yield promiseWindowClosed(win);
@ -139,8 +149,8 @@ add_task(function* test_revive_windows_order() {
}
});
function promiseNewWindow() {
return new Promise(resolve => whenNewWindowLoaded({private: false}, resolve));
function promiseNewWindow(opts = {private: false}) {
return new Promise(resolve => whenNewWindowLoaded(opts, resolve));
}
function forgetClosedWindows() {

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

@ -14,6 +14,7 @@ this.EXPORTED_SYMBOLS = [ "PluginContent" ];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Timer.jsm");
Cu.import("resource://gre/modules/BrowserUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "gNavigatorBundle", function() {
const url = "chrome://browser/locale/browser.properties";
@ -119,7 +120,7 @@ PluginContent.prototype = {
if (this.isKnownPlugin(pluginElement)) {
pluginTag = pluginHost.getPluginTagForType(pluginElement.actualType);
pluginName = this.makeNicePluginName(pluginTag.name);
pluginName = BrowserUtils.makeNicePluginName(pluginTag.name);
permissionString = pluginHost.getPermissionStringForType(pluginElement.actualType);
fallbackType = pluginElement.defaultFallbackType;
@ -142,26 +143,6 @@ PluginContent.prototype = {
};
},
// Map the plugin's name to a filtered version more suitable for user UI.
makeNicePluginName : function (aName) {
if (aName == "Shockwave Flash")
return "Adobe Flash";
// Regex checks if aName begins with "Java" + non-letter char
if (/^Java\W/.exec(aName))
return "Java";
// Clean up the plugin name by stripping off parenthetical clauses,
// trailing version numbers or "plugin".
// EG, "Foo Bar (Linux) Plugin 1.23_02" --> "Foo Bar"
// Do this by first stripping the numbers, etc. off the end, and then
// removing "Plugin" (and then trimming to get rid of any whitespace).
// (Otherwise, something like "Java(TM) Plug-in 1.7.0_07" gets mangled)
let newName = aName.replace(/\(.*?\)/g, "").
replace(/[\s\d\.\-\_\(\)]+$/, "").
replace(/\bplug-?in\b/i, "").trim();
return newName;
},
/**
* Update the visibility of the plugin overlay.
*/
@ -843,7 +824,7 @@ PluginContent.prototype = {
// For non-GMP plugins, remap the plugin name to a more user-presentable form.
if (!gmpPlugin) {
pluginName = this.makeNicePluginName(pluginName);
pluginName = BrowserUtils.makeNicePluginName(pluginName);
}
let messageString = gNavigatorBundle.formatStringFromName("crashedpluginsMessage.title", [pluginName], 1);

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

@ -146,7 +146,7 @@ panelmultiview[nosubviews=true] > .panel-viewcontainer > .panel-viewstack > .pan
margin: -4px -4px 4px;
box-shadow: 0 -1px 0 hsla(210,4%,10%,.05) inset;
color: GrayText;
text-transform: uppercase;
font-variant: small-caps;
}
.cui-widget-panelview .panel-subview-header {

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

@ -15,7 +15,7 @@ this.EXPORTED_SYMBOLS = [ "addDebuggerToGlobal" ];
* same thread.
*
* For documentation on the API, see:
* https://wiki.mozilla.org/Debugger
* https://developer.mozilla.org/en-US/docs/Tools/Debugger-API
*/
const init = Components.classes["@mozilla.org/jsdebugger;1"].createInstance(Components.interfaces.IJSDebugger);

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

@ -250,7 +250,8 @@ public final class ANRReporter extends BroadcastReceiver
Log.d(LOGTAG, "uptime " + String.valueOf(uptimeMins));
}
return uptimeMins;
} else if (DEBUG) {
}
if (DEBUG) {
Log.d(LOGTAG, "could not get uptime");
}
return 0L;

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

@ -62,6 +62,7 @@ class ActionModeCompatView extends LinearLayout implements GeckoMenu.ActionItemB
((GeckoMenu) mPopupMenu.getMenu()).setActionItemBarPresenter(this);
mMenuButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openMenu();
}
@ -90,6 +91,7 @@ class ActionModeCompatView extends LinearLayout implements GeckoMenu.ActionItemB
return mPopupMenu.getMenu();
}
@Override
public void invalidate() {
// onFinishInflate may not have been called yet on some versions of Android
if (mPopupMenu != null && mMenuButton != null) {

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

@ -258,7 +258,9 @@ public class AndroidGamepadManager {
// Queue up key events for pending devices.
sPendingGamepads.get(deviceId).add(ev);
return true;
} else if (!sGamepads.containsKey(deviceId)) {
}
if (!sGamepads.containsKey(deviceId)) {
InputDevice device = ev.getDevice();
if (device != null &&
(device.getSources() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
@ -332,6 +334,7 @@ public class AndroidGamepadManager {
// Poll known gamepads to see if they've disappeared.
sPollTimer = new Timer();
sPollTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
for (Integer deviceId : sGamepads.keySet()) {
if (InputDevice.getDevice(deviceId) == null) {
@ -343,6 +346,7 @@ public class AndroidGamepadManager {
return;
}
sListener = new InputManager.InputDeviceListener() {
@Override
public void onInputDeviceAdded(int deviceId) {
InputDevice device = InputDevice.getDevice(deviceId);
if (device == null) {
@ -353,6 +357,7 @@ public class AndroidGamepadManager {
}
}
@Override
public void onInputDeviceRemoved(int deviceId) {
if (sPendingGamepads.containsKey(deviceId)) {
// Got removed before Gecko's ack reached us.
@ -365,6 +370,7 @@ public class AndroidGamepadManager {
}
}
@Override
public void onInputDeviceChanged(int deviceId) {
}
};

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

@ -35,6 +35,7 @@ public class BaseGeckoInterface implements GeckoAppShell.GeckoInterface {
mContext = context;
}
@Override
public GeckoProfile getProfile() {
// Fall back to default profile if we didn't load a specific one
if (mProfile == null) {
@ -44,32 +45,39 @@ public class BaseGeckoInterface implements GeckoAppShell.GeckoInterface {
}
// Bug 908770: Implement this
@Override
public PromptService getPromptService() {
return null;
}
@Override
public Activity getActivity() {
return (Activity)mContext;
}
@Override
public String getDefaultUAString() {
return HardwareUtils.isTablet() ? AppConstants.USER_AGENT_FENNEC_TABLET :
AppConstants.USER_AGENT_FENNEC_MOBILE;
}
// Bug 908772: Implement this
@Override
public LocationListener getLocationListener() {
return null;
}
// Bug 908773: Implement this
@Override
public SensorEventListener getSensorEventListener() {
return null;
}
// Bug 908775: Implement this
@Override
public void doRestart() {}
@Override
public void setFullScreen(final boolean fullscreen) {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -80,53 +88,67 @@ public class BaseGeckoInterface implements GeckoAppShell.GeckoInterface {
}
// Bug 908779: Implement this
@Override
public void addPluginView(final View view, final RectF rect, final boolean isFullScreen) {}
// Bug 908781: Implement this
@Override
public void removePluginView(final View view, final boolean isFullScreen) {}
// Bug 908783: Implement this
@Override
public void enableCameraView() {}
// Bug 908785: Implement this
@Override
public void disableCameraView() {}
// Bug 908786: Implement this
@Override
public void addAppStateListener(GeckoAppShell.AppStateListener listener) {}
// Bug 908787: Implement this
@Override
public void removeAppStateListener(GeckoAppShell.AppStateListener listener) {}
// Bug 908788: Implement this
@Override
public View getCameraView() {
return null;
}
// Bug 908789: Implement this
@Override
public void notifyWakeLockChanged(String topic, String state) {}
// Bug 908790: Implement this
@Override
public FormAssistPopup getFormAssistPopup() {
return null;
}
@Override
public boolean areTabsShown() {
return false;
}
// Bug 908791: Implement this
@Override
public AbsoluteLayout getPluginContainer() {
return null;
}
@Override
public void notifyCheckUpdateResult(String result) {
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Update:CheckResult", result));
}
@Override
public boolean hasTabsSideBar() {
return false;
}
// Bug 908792: Implement this
@Override
public void invalidateOptionsMenu() {}
}

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

@ -860,24 +860,28 @@ public class BrowserApp extends GeckoApp
private void setBrowserToolbarListeners() {
mBrowserToolbar.setOnActivateListener(new BrowserToolbar.OnActivateListener() {
@Override
public void onActivate() {
enterEditingMode();
}
});
mBrowserToolbar.setOnCommitListener(new BrowserToolbar.OnCommitListener() {
@Override
public void onCommit() {
commitEditingMode();
}
});
mBrowserToolbar.setOnDismissListener(new BrowserToolbar.OnDismissListener() {
@Override
public void onDismiss() {
mBrowserToolbar.cancelEdit();
}
});
mBrowserToolbar.setOnFilterListener(new BrowserToolbar.OnFilterListener() {
@Override
public void onFilter(String searchText, AutocompleteHandler handler) {
filterEditingMode(searchText, handler);
}
@ -893,6 +897,7 @@ public class BrowserApp extends GeckoApp
});
mBrowserToolbar.setOnStartEditingListener(new BrowserToolbar.OnStartEditingListener() {
@Override
public void onStartEditing() {
// Temporarily disable doorhanger notifications.
mDoorHangerPopup.disable();
@ -900,6 +905,7 @@ public class BrowserApp extends GeckoApp
});
mBrowserToolbar.setOnStopEditingListener(new BrowserToolbar.OnStopEditingListener() {
@Override
public void onStopEditing() {
selectTargetTabForEditingMode();
@ -1253,6 +1259,7 @@ public class BrowserApp extends GeckoApp
mDynamicToolbarCanScroll = false;
if (mBrowserChrome.getVisibility() != View.VISIBLE) {
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {
mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE);
}
@ -1267,6 +1274,7 @@ public class BrowserApp extends GeckoApp
final ToolbarProgressView progressView = mProgressView;
final int marginTop = Math.round(aMetrics.marginTop);
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {
final float translationY = marginTop - browserChrome.getHeight();
ViewHelper.setTranslationY(browserChrome, translationY);

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

@ -75,6 +75,7 @@ public class BrowserLocaleManager implements LocaleManager {
}
}
@Override
public boolean isEnabled() {
return AppConstants.MOZ_LOCALE_SWITCHER;
}

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

@ -152,6 +152,7 @@ class ChromeCast implements GeckoMediaPlayer {
// This dumps everything we can find about the device into JSON. This will hopefully make it
// easier to filter out duplicate devices from different sources in js.
@Override
public JSONObject toJSON() {
final JSONObject obj = new JSONObject();
try {
@ -175,6 +176,7 @@ class ChromeCast implements GeckoMediaPlayer {
return obj;
}
@Override
public void load(final String title, final String url, final String type, final EventCallback callback) {
final CastDevice device = CastDevice.getFromBundle(route.getExtras());
Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions.builder(device, new Cast.Listener() {
@ -218,11 +220,13 @@ class ChromeCast implements GeckoMediaPlayer {
apiClient.connect();
}
@Override
public void start(final EventCallback callback) {
// Nothing to be done here
callback.sendSuccess(null);
}
@Override
public void stop(final EventCallback callback) {
// Nothing to be done here
callback.sendSuccess(null);
@ -249,6 +253,7 @@ class ChromeCast implements GeckoMediaPlayer {
return true;
}
@Override
public void play(final EventCallback callback) {
if (!verifySession(callback)) {
return;
@ -273,6 +278,7 @@ class ChromeCast implements GeckoMediaPlayer {
}
}
@Override
public void pause(final EventCallback callback) {
if (!verifySession(callback)) {
return;
@ -297,6 +303,7 @@ class ChromeCast implements GeckoMediaPlayer {
}
}
@Override
public void end(final EventCallback callback) {
if (!verifySession(callback)) {
return;
@ -376,6 +383,7 @@ class ChromeCast implements GeckoMediaPlayer {
}
@Override
public void onResult(ApplicationConnectionResult result) {
Status status = result.getStatus();
if (status.isSuccess()) {
@ -405,12 +413,14 @@ class ChromeCast implements GeckoMediaPlayer {
}
}
@Override
public void message(String msg, final EventCallback callback) {
if (mMirrorChannel != null) {
mMirrorChannel.sendMessage(msg);
}
}
@Override
public void mirror(final EventCallback callback) {
final CastDevice device = CastDevice.getFromBundle(route.getExtras());
Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions.builder(device, new Cast.Listener() {

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

@ -247,9 +247,7 @@ public class ContactService implements GeckoEventListener {
// Truncate the raw contacts IDs array if necessary
if (filterLimit > 0 && allRawContactIds.length > filterLimit) {
long[] truncatedRawContactIds = new long[filterLimit];
for (int i = 0; i < filterLimit; i++) {
truncatedRawContactIds[i] = allRawContactIds[i];
}
System.arraycopy(allRawContactIds, 0, truncatedRawContactIds, 0, filterLimit);
return truncatedRawContactIds;
}
return allRawContactIds;
@ -402,41 +400,47 @@ public class ContactService implements GeckoEventListener {
filterValue = filterValue.toLowerCase();
databaseValue = databaseValue.toLowerCase();
if ("match".equals(filterOp)) {
// If substring matching is a positive number, only pay attention to the last X characters
// of both the filter and database values
if (substringMatching > 0) {
databaseValue = substringStartFromEnd(cleanPhoneNumber(databaseValue), substringMatching);
filterValue = substringStartFromEnd(cleanPhoneNumber(filterValue), substringMatching);
return databaseValue.startsWith(filterValue);
}
return databaseValue.equals(filterValue);
} else if ("equals".equals(filterOp)) {
if (isPhone) {
return PhoneNumberUtils.compare(filterValue, databaseValue);
}
return databaseValue.equals(filterValue);
} else if ("contains".equals(filterOp)) {
if (isPhone) {
filterValue = cleanPhoneNumber(filterValue);
databaseValue = cleanPhoneNumber(databaseValue);
}
return databaseValue.contains(filterValue);
} else if ("startsWith".equals(filterOp)) {
// If a phone number, remove non-dialable characters and then only pay attention to
// the last X digits given by the substring matching values (see bug 877302)
if (isPhone) {
String cleanedDatabasePhone = cleanPhoneNumber(databaseValue);
switch (filterOp) {
case "match":
// If substring matching is a positive number, only pay attention to the last X characters
// of both the filter and database values
if (substringMatching > 0) {
cleanedDatabasePhone = substringStartFromEnd(cleanedDatabasePhone, substringMatching);
databaseValue = substringStartFromEnd(cleanPhoneNumber(databaseValue), substringMatching);
filterValue = substringStartFromEnd(cleanPhoneNumber(filterValue), substringMatching);
return databaseValue.startsWith(filterValue);
}
if (cleanedDatabasePhone.startsWith(filterValue)) {
return true;
return databaseValue.equals(filterValue);
case "equals":
if (isPhone) {
return PhoneNumberUtils.compare(filterValue, databaseValue);
}
}
return databaseValue.startsWith(filterValue);
return databaseValue.equals(filterValue);
case "contains":
if (isPhone) {
filterValue = cleanPhoneNumber(filterValue);
databaseValue = cleanPhoneNumber(databaseValue);
}
return databaseValue.contains(filterValue);
case "startsWith":
// If a phone number, remove non-dialable characters and then only pay attention to
// the last X digits given by the substring matching values (see bug 877302)
if (isPhone) {
String cleanedDatabasePhone = cleanPhoneNumber(databaseValue);
if (substringMatching > 0) {
cleanedDatabasePhone = substringStartFromEnd(cleanedDatabasePhone, substringMatching);
}
if (cleanedDatabasePhone.startsWith(filterValue)) {
return true;
}
}
return databaseValue.startsWith(filterValue);
}
return false;
}
@ -659,7 +663,7 @@ public class ContactService implements GeckoEventListener {
}
private boolean bool(int integer) {
return integer != 0 ? true : false;
return integer != 0;
}
private void getGenericDataAsJSONObject(Cursor cursor, JSONArray array, final String dataColumn,
@ -1558,6 +1562,7 @@ public class ContactService implements GeckoEventListener {
});
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
builder.show();
}

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

@ -255,10 +255,12 @@ public final class EventDispatcher {
this.type = type;
}
@Override
public void sendSuccess(final Object response) {
sendResponse(STATUS_SUCCESS, response);
}
@Override
public void sendError(final Object response) {
sendResponse(STATUS_ERROR, response);
}

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

@ -61,6 +61,7 @@ public class FilePicker implements GeckoEventListener {
mimeType = GeckoAppShell.getMimeTypeFromExtensions(message.optString("extensions"));
showFilePickerAsync(title, mimeType, new ResultHandler() {
@Override
public void gotFile(String filename) {
try {
message.put("file", filename);
@ -198,7 +199,7 @@ public class FilePicker implements GeckoEventListener {
title = getFilePickerTitle(mimeType);
}
Intent chooser = Intent.createChooser(base, title);
chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new Parcelable[]{}));
chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new Parcelable[intents.size()]));
handler.gotIntent(chooser);
}

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

@ -73,13 +73,13 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
private static final String LOGTAG = "GeckoFormAssistPopup";
// The blocklist is so short that ArrayList is probably cheaper than HashSet.
private static final Collection<String> sInputMethodBlocklist = Arrays.asList(new String[] {
private static final Collection<String> sInputMethodBlocklist = Arrays.asList(
InputMethods.METHOD_GOOGLE_JAPANESE_INPUT, // bug 775850
InputMethods.METHOD_OPENWNN_PLUS, // bug 768108
InputMethods.METHOD_SIMEJI, // bug 768108
InputMethods.METHOD_SWYPE, // bug 755909
InputMethods.METHOD_SWYPE_BETA, // bug 755909
});
InputMethods.METHOD_SWYPE_BETA // bug 755909
);
public FormAssistPopup(Context context, AttributeSet attrs) {
super(context, attrs);

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

@ -263,6 +263,7 @@ public class GeckoAccessibility {
AccessibilityManager accessibilityManager =
(AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
accessibilityManager.addAccessibilityStateChangeListener(new AccessibilityManager.AccessibilityStateChangeListener() {
@Override
public void onAccessibilityStateChanged(boolean enabled) {
updateAccessibilitySettings(context);
}

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

@ -198,6 +198,7 @@ public abstract class GeckoApp
private EventListener mWebappEventListener;
abstract public int getLayout();
@Override
abstract public boolean hasTabsSideBar();
abstract protected String getDefaultProfileName() throws NoMozillaDirectoryException;
@ -229,30 +230,37 @@ public abstract class GeckoApp
return GeckoSharedPrefs.forApp(this);
}
@Override
public Activity getActivity() {
return this;
}
@Override
public LocationListener getLocationListener() {
return this;
}
@Override
public SensorEventListener getSensorEventListener() {
return this;
}
@Override
public View getCameraView() {
return mCameraView;
}
@Override
public void addAppStateListener(GeckoAppShell.AppStateListener listener) {
mAppStateListeners.add(listener);
}
@Override
public void removeAppStateListener(GeckoAppShell.AppStateListener listener) {
mAppStateListeners.remove(listener);
}
@Override
public FormAssistPopup getFormAssistPopup() {
return mFormAssistPopup;
}
@ -537,6 +545,7 @@ public abstract class GeckoApp
*/
public boolean autoHideTabs() { return false; }
@Override
public boolean areTabsShown() { return false; }
@Override
@ -862,6 +871,7 @@ public abstract class GeckoApp
mFullScreenPluginView = view;
}
@Override
public void addPluginView(final View view, final RectF rect, final boolean isFullScreen) {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -919,6 +929,7 @@ public abstract class GeckoApp
setFullScreen(false);
}
@Override
public void removePluginView(final View view, final boolean isFullScreen) {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -1071,6 +1082,7 @@ public abstract class GeckoApp
requestRender();
}
@Override
public void setFullScreen(final boolean fullscreen) {
ThreadUtils.postToUiThread(new Runnable() {
@Override
@ -1658,6 +1670,7 @@ public abstract class GeckoApp
}
}
@Override
public synchronized GeckoProfile getProfile() {
// fall back to default profile if we didn't load a specific one
if (mProfile == null) {
@ -1722,6 +1735,7 @@ public abstract class GeckoApp
.build());
}
@Override
public void enableCameraView() {
// Start listening for orientation events
mCameraOrientationEventListener = new OrientationEventListener(this) {
@ -1737,7 +1751,7 @@ public abstract class GeckoApp
mCameraOrientationEventListener.enable();
// Try to make it fully transparent.
if (mCameraView != null && (mCameraView instanceof SurfaceView)) {
if (mCameraView instanceof SurfaceView) {
if (Versions.feature11Plus) {
mCameraView.setAlpha(0.0f);
}
@ -1748,6 +1762,7 @@ public abstract class GeckoApp
}
}
@Override
public void disableCameraView() {
if (mCameraOrientationEventListener != null) {
mCameraOrientationEventListener.disable();
@ -1759,6 +1774,7 @@ public abstract class GeckoApp
}
}
@Override
public String getDefaultUAString() {
return HardwareUtils.isTablet() ? AppConstants.USER_AGENT_FENNEC_TABLET :
AppConstants.USER_AGENT_FENNEC_MOBILE;
@ -2119,6 +2135,7 @@ public abstract class GeckoApp
}
}
@Override
public void doRestart() {
doRestart(RESTARTER_ACTION, null, null);
}
@ -2222,6 +2239,7 @@ public abstract class GeckoApp
}
}
@Override
public PromptService getPromptService() {
return mPromptService;
}
@ -2287,6 +2305,7 @@ public abstract class GeckoApp
}
}
@Override
public AbsoluteLayout getPluginContainer() { return mPluginContainer; }
// Accelerometer.
@ -2325,6 +2344,7 @@ public abstract class GeckoApp
private static final String SCREEN = "screen";
// Called when a Gecko Hal WakeLock is changed
@Override
public void notifyWakeLockChanged(String topic, String state) {
PowerManager.WakeLock wl = mWakeLocks.get(topic);
if (state.equals("locked-foreground") && wl == null) {
@ -2346,6 +2366,7 @@ public abstract class GeckoApp
}
}
@Override
public void notifyCheckUpdateResult(String result) {
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Update:CheckResult", result));
}

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

@ -71,6 +71,7 @@ public class GeckoJavaSampler {
mSampleCount = aSampleCount;
}
@Override
public void run() {
synchronized (GeckoJavaSampler.class) {
mSamples.put(0, new Sample[mSampleCount]);

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

@ -280,9 +280,12 @@ public class GeckoNetworkManager extends BroadcastReceiver implements NativeEven
if (networkOperator == null || networkOperator.length() <= 3) {
return -1;
}
if (type == InfoType.MNC) {
return Integer.parseInt(networkOperator.substring(3));
} else if (type == InfoType.MCC) {
}
if (type == InfoType.MCC) {
return Integer.parseInt(networkOperator.substring(0, 3));
}

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

@ -298,24 +298,21 @@ public class GeckoScreenOrientation {
* otherwise.
*/
public static ScreenOrientation screenOrientationFromString(String aStr) {
if ("portrait".equals(aStr)) {
return ScreenOrientation.PORTRAIT_PRIMARY;
}
else if ("landscape".equals(aStr)) {
return ScreenOrientation.LANDSCAPE_PRIMARY;
}
else if ("portrait-primary".equals(aStr)) {
return ScreenOrientation.PORTRAIT_PRIMARY;
}
else if ("portrait-secondary".equals(aStr)) {
return ScreenOrientation.PORTRAIT_SECONDARY;
}
else if ("landscape-primary".equals(aStr)) {
return ScreenOrientation.LANDSCAPE_PRIMARY;
}
else if ("landscape-secondary".equals(aStr)) {
return ScreenOrientation.LANDSCAPE_SECONDARY;
switch (aStr) {
case "portrait":
return ScreenOrientation.PORTRAIT_PRIMARY;
case "landscape":
return ScreenOrientation.LANDSCAPE_PRIMARY;
case "portrait-primary":
return ScreenOrientation.PORTRAIT_PRIMARY;
case "portrait-secondary":
return ScreenOrientation.PORTRAIT_SECONDARY;
case "landscape-primary":
return ScreenOrientation.LANDSCAPE_PRIMARY;
case "landscape-secondary":
return ScreenOrientation.LANDSCAPE_SECONDARY;
}
Log.w(LOGTAG, "screenOrientationFromString: unknown orientation string");
return DEFAULT_SCREEN_ORIENTATION;
}

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

@ -354,6 +354,7 @@ public class GeckoView extends LayerView
return DEFAULT_SHARED_PREFERENCES_FILE;
}
@Override
public SharedPreferences getSharedPreferences() {
return getContext().getSharedPreferences(getSharedPreferencesFile(), 0);
}

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

@ -10,6 +10,7 @@ public class GeckoViewChrome implements GeckoView.ChromeDelegate {
* Tell the host application that Gecko is ready to handle requests.
* @param view The GeckoView that initiated the callback.
*/
@Override
public void onReady(GeckoView view) {}
/**
@ -20,6 +21,7 @@ public class GeckoViewChrome implements GeckoView.ChromeDelegate {
* @param result A PromptResult used to send back the result without blocking.
* Defaults to cancel requests.
*/
@Override
public void onAlert(GeckoView view, GeckoView.Browser browser, String message, GeckoView.PromptResult result) {
result.cancel();
}
@ -32,6 +34,7 @@ public class GeckoViewChrome implements GeckoView.ChromeDelegate {
* @param result A PromptResult used to send back the result without blocking.
* Defaults to cancel requests.
*/
@Override
public void onConfirm(GeckoView view, GeckoView.Browser browser, String message, GeckoView.PromptResult result) {
result.cancel();
}
@ -45,6 +48,7 @@ public class GeckoViewChrome implements GeckoView.ChromeDelegate {
* @param result A PromptResult used to send back the result without blocking.
* Defaults to cancel requests.
*/
@Override
public void onPrompt(GeckoView view, GeckoView.Browser browser, String message, String defaultValue, GeckoView.PromptResult result) {
result.cancel();
}
@ -55,6 +59,7 @@ public class GeckoViewChrome implements GeckoView.ChromeDelegate {
* @param result A PromptResult used to send back the result without blocking.
* Defaults to cancel requests.
*/
@Override
public void onDebugRequest(GeckoView view, GeckoView.PromptResult result) {
result.cancel();
}

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

@ -12,6 +12,7 @@ public class GeckoViewContent implements GeckoView.ContentDelegate {
* @param browser The Browser that is loading the content.
* @param url The resource being loaded.
*/
@Override
public void onPageStart(GeckoView view, GeckoView.Browser browser, String url) {}
/**
@ -20,6 +21,7 @@ public class GeckoViewContent implements GeckoView.ContentDelegate {
* @param browser The Browser that was loading the content.
* @param success Whether the page loaded successfully or an error occured.
*/
@Override
public void onPageStop(GeckoView view, GeckoView.Browser browser, boolean success) {}
/**
@ -28,6 +30,7 @@ public class GeckoViewContent implements GeckoView.ContentDelegate {
* @param view The GeckoView that initiated the callback.
* @param browser The Browser that is showing the content.
*/
@Override
public void onPageShow(GeckoView view, GeckoView.Browser browser) {}
/**
@ -37,6 +40,7 @@ public class GeckoViewContent implements GeckoView.ContentDelegate {
* @param browser The Browser that is showing the content.
* @param title The title sent from the content.
*/
@Override
public void onReceivedTitle(GeckoView view, GeckoView.Browser browser, String title) {}
/**
@ -47,5 +51,6 @@ public class GeckoViewContent implements GeckoView.ContentDelegate {
* @param url The href of the link element specifying the favicon.
* @param size The maximum size specified for the favicon, or -1 for any size.
*/
@Override
public void onReceivedFavicon(GeckoView view, GeckoView.Browser browser, String url, int size) {}
}

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

@ -343,7 +343,7 @@ public class LightweightTheme implements GeckoEventListener {
curView = (View) parent;
}
} while(parent instanceof View && parent != null);
} while(parent instanceof View);
// Adjust the coordinates for the offset.
left -= offsetX;

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

@ -162,7 +162,7 @@ public class NotificationHandler {
* @return whether the notification is an AlertNotification showing progress.
*/
private boolean isProgressStyle(Notification notification) {
if (notification != null && notification instanceof AlertNotification) {
if (notification instanceof AlertNotification) {
return ((AlertNotification)notification).isProgressStyle();
}
return false;

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

@ -112,6 +112,7 @@ public class RemoteClientsDialogFragment extends DialogFragment {
});
} else {
builder.setItems(clientNames, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int index) {
final ArrayList<RemoteClient> checked = new ArrayList<RemoteClient>();
checked.add(clients.get(index));

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

@ -277,6 +277,7 @@ class TextSelection extends Layer implements GeckoEventListener {
menuitem.setShowAsAction(actionEnum, R.attr.menuItemActionModeStyle);
BitmapUtils.getDrawable(mStartHandle.getContext(), obj.optString("icon"), new BitmapLoader() {
@Override
public void onBitmapFound(Drawable d) {
if (d != null) {
menuitem.setIcon(d);
@ -290,11 +291,13 @@ class TextSelection extends Layer implements GeckoEventListener {
return true;
}
@Override
public boolean onCreateActionMode(ActionModeCompat mode, Menu menu) {
mActionMode = mode;
return true;
}
@Override
public boolean onActionItemClicked(ActionModeCompat mode, MenuItem item) {
try {
final JSONObject obj = mItems.getJSONObject(item.getItemId());
@ -307,6 +310,7 @@ class TextSelection extends Layer implements GeckoEventListener {
}
// Called when the user exits the action mode
@Override
public void onDestroyActionMode(ActionModeCompat mode) {
mActionMode = null;
mCallback = null;

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

@ -42,7 +42,7 @@ public class AndroidLevelCachingLogWriter extends LogWriter {
private boolean shouldLogError(String logTag) {
Boolean out = isErrorLoggable.get(logTag);
if (out != null) {
return out.booleanValue();
return out;
}
out = Log.isLoggable(logTag, Log.ERROR);
isErrorLoggable.put(logTag, out);
@ -52,7 +52,7 @@ public class AndroidLevelCachingLogWriter extends LogWriter {
private boolean shouldLogWarn(String logTag) {
Boolean out = isWarnLoggable.get(logTag);
if (out != null) {
return out.booleanValue();
return out;
}
out = Log.isLoggable(logTag, Log.WARN);
isWarnLoggable.put(logTag, out);
@ -62,7 +62,7 @@ public class AndroidLevelCachingLogWriter extends LogWriter {
private boolean shouldLogInfo(String logTag) {
Boolean out = isInfoLoggable.get(logTag);
if (out != null) {
return out.booleanValue();
return out;
}
out = Log.isLoggable(logTag, Log.INFO);
isInfoLoggable.put(logTag, out);
@ -72,7 +72,7 @@ public class AndroidLevelCachingLogWriter extends LogWriter {
private boolean shouldLogDebug(String logTag) {
Boolean out = isDebugLoggable.get(logTag);
if (out != null) {
return out.booleanValue();
return out;
}
out = Log.isLoggable(logTag, Log.DEBUG);
isDebugLoggable.put(logTag, out);
@ -83,43 +83,49 @@ public class AndroidLevelCachingLogWriter extends LogWriter {
public boolean shouldLogVerbose(String logTag) {
Boolean out = isVerboseLoggable.get(logTag);
if (out != null) {
return out.booleanValue();
return out;
}
out = Log.isLoggable(logTag, Log.VERBOSE);
isVerboseLoggable.put(logTag, out);
return out;
}
@Override
public void error(String tag, String message, Throwable error) {
if (shouldLogError(tag)) {
inner.error(tag, message, error);
}
}
@Override
public void warn(String tag, String message, Throwable error) {
if (shouldLogWarn(tag)) {
inner.warn(tag, message, error);
}
}
@Override
public void info(String tag, String message, Throwable error) {
if (shouldLogInfo(tag)) {
inner.info(tag, message, error);
}
}
@Override
public void debug(String tag, String message, Throwable error) {
if (shouldLogDebug(tag)) {
inner.debug(tag, message, error);
}
}
@Override
public void trace(String tag, String message, Throwable error) {
if (shouldLogVerbose(tag)) {
inner.trace(tag, message, error);
}
}
@Override
public void close() {
inner.close();
}

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

@ -15,26 +15,32 @@ public class AndroidLogWriter extends LogWriter {
return true;
}
@Override
public void error(String tag, String message, Throwable error) {
Log.e(tag, message, error);
}
@Override
public void warn(String tag, String message, Throwable error) {
Log.w(tag, message, error);
}
@Override
public void info(String tag, String message, Throwable error) {
Log.i(tag, message, error);
}
@Override
public void debug(String tag, String message, Throwable error) {
Log.d(tag, message, error);
}
@Override
public void trace(String tag, String message, Throwable error) {
Log.v(tag, message, error);
}
@Override
public void close() {
}
}

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

@ -20,6 +20,7 @@ public class LevelFilteringLogWriter extends LogWriter {
this.logLevel = logLevel;
}
@Override
public void close() {
inner.close();
}

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

@ -64,6 +64,7 @@ public class PrintLogWriter extends LogWriter {
return true;
}
@Override
public void close() {
if (closed) {
return;

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

@ -14,6 +14,7 @@ public class SimpleTagLogWriter extends TagLogWriter {
this.tag = tag;
}
@Override
protected String getMainTag() {
return tag;
}

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

@ -25,26 +25,32 @@ public class StringLogWriter extends LogWriter {
return true;
}
@Override
public void error(String tag, String message, Throwable error) {
inner.error(tag, message, error);
}
@Override
public void warn(String tag, String message, Throwable error) {
inner.warn(tag, message, error);
}
@Override
public void info(String tag, String message, Throwable error) {
inner.info(tag, message, error);
}
@Override
public void debug(String tag, String message, Throwable error) {
inner.debug(tag, message, error);
}
@Override
public void trace(String tag, String message, Throwable error) {
inner.trace(tag, message, error);
}
@Override
public void close() {
inner.close();
}

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

@ -91,6 +91,6 @@ public class FxAccountAgeLockoutHelper {
FxAccountConstants.pii(LOG_TAG, "Passed age check: year text was found in item list but was not a number.");
return true;
}
return passesAgeCheck(yearOfBirth.intValue());
return passesAgeCheck(yearOfBirth);
}
}

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

@ -144,7 +144,7 @@ public class FxAccountClient20 extends FxAccountClient10 implements FxAccountCli
boolean verified = false; // In production, we're definitely not verified immediately upon creation.
Boolean tempVerified = body.getBoolean(JSON_KEY_VERIFIED);
if (tempVerified != null) {
verified = tempVerified.booleanValue();
verified = tempVerified;
}
byte[] sessionToken = Utils.hex2Byte(body.getString(JSON_KEY_SESSIONTOKEN));
byte[] keyFetchToken = null;
@ -154,10 +154,8 @@ public class FxAccountClient20 extends FxAccountClient10 implements FxAccountCli
LoginResponse loginResponse = new LoginResponse(new String(emailUTF8, "UTF-8"), uid, verified, sessionToken, keyFetchToken);
delegate.handleSuccess(loginResponse);
return;
} catch (Exception e) {
delegate.handleError(e);
return;
}
}
};
@ -172,7 +170,6 @@ public class FxAccountClient20 extends FxAccountClient10 implements FxAccountCli
createAccount(emailUTF8, quickStretchedPW, true, false, "sync", delegate);
} catch (Exception e) {
invokeHandleError(delegate, e);
return;
}
}

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

@ -19,6 +19,7 @@ public class QuickPasswordStretcher implements PasswordStretcher {
this.password = password;
}
@Override
public synchronized byte[] getQuickStretchedPW(byte[] emailUTF8) throws UnsupportedEncodingException, GeneralSecurityException {
if (emailUTF8 == null) {
throw new IllegalArgumentException("emailUTF8 must not be null");

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

@ -1197,7 +1197,7 @@ public class HealthReportDatabaseStorage implements HealthReportStorage {
@Override
public void recordDailyLast(int env, int day, int field, int value) {
this.recordDailyLast(env, day, field, Integer.valueOf(value), EVENTS_INTEGER);
this.recordDailyLast(env, day, field, value, EVENTS_INTEGER);
}
private void recordDailyDiscrete(int env, int day, int field, Object value, String table) {
@ -1371,10 +1371,12 @@ public class HealthReportDatabaseStorage implements HealthReportStorage {
"date, environment, measurement_name, measurement_version, field_name");
}
@Override
public int getEventCount() {
return getRowCount("events");
}
@Override
public int getEnvironmentCount() {
return getRowCount("environments");
}
@ -1394,6 +1396,7 @@ public class HealthReportDatabaseStorage implements HealthReportStorage {
* @param curEnv The ID of the current environment.
* @return The number of environments and addon entries deleted.
*/
@Override
public int deleteDataBefore(final long time, final int curEnv) {
final SQLiteDatabase db = this.helper.getWritableDatabase();
db.beginTransaction();
@ -1598,6 +1601,7 @@ public class HealthReportDatabaseStorage implements HealthReportStorage {
* Prunes the given number of least-recently used environments. Note that orphaned environments
* are not removed and the environment cache is cleared.
*/
@Override
public void pruneEnvironments(final int numToPrune) {
final SQLiteDatabase db = this.helper.getWritableDatabase();
db.beginTransaction();
@ -1625,6 +1629,7 @@ public class HealthReportDatabaseStorage implements HealthReportStorage {
* events reaches the given maximum. Note that this technicality means this method cannot be
* used to delete all events.
*/
@Override
public void pruneEvents(final int maxNumToPrune) {
final SQLiteDatabase db = this.helper.getWritableDatabase();

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

@ -189,7 +189,7 @@ public class HealthReportProvider extends ContentProvider {
Object object = values.get("value");
if (object instanceof Integer ||
object instanceof Long) {
storage.recordDailyLast(env, day, field.getID(), ((Integer) object).intValue());
storage.recordDailyLast(env, day, field.getID(), (Integer) object);
} else if (object instanceof String) {
storage.recordDailyLast(env, day, field.getID(), (String) object);
} else {
@ -287,7 +287,7 @@ public class HealthReportProvider extends ContentProvider {
private MeasurementFields getFieldSpecs(ContentValues values) {
final ArrayList<FieldSpec> specs = new ArrayList<FieldSpec>(values.size());
for (Entry<String, Object> entry : values.valueSet()) {
specs.add(new FieldSpec(entry.getKey(), ((Integer) entry.getValue()).intValue()));
specs.add(new FieldSpec(entry.getKey(), (Integer) entry.getValue()));
}
return new MeasurementFields() {

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

@ -41,10 +41,12 @@ public class PrunePolicyDatabaseStorage implements PrunePolicyStorage {
this.currentEnvironmentID = -1;
}
@Override
public void pruneEvents(final int count) {
getStorage().pruneEvents(count);
}
@Override
public void pruneEnvironments(final int count) {
getStorage().pruneEnvironments(count);
@ -59,10 +61,12 @@ public class PrunePolicyDatabaseStorage implements PrunePolicyStorage {
* current environment from the profile cache, it will not delete data so be sure to prune by
* other methods (e.g. {@link pruneEvents}) as well.
*/
@Override
public int deleteDataBefore(final long time) {
return getStorage().deleteDataBefore(time, getCurrentEnvironmentID());
}
@Override
public void cleanup() {
final HealthReportDatabaseStorage storage = getStorage();
// The change to auto_vacuum will only take affect after a vacuum.
@ -70,14 +74,17 @@ public class PrunePolicyDatabaseStorage implements PrunePolicyStorage {
storage.vacuum();
}
@Override
public int getEventCount() {
return getStorage().getEventCount();
}
@Override
public int getEnvironmentCount() {
return getStorage().getEnvironmentCount();
}
@Override
public void close() {
if (client != null) {
client.release();

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

@ -131,13 +131,13 @@ public class ObsoleteDocumentTracker {
public int compare(Entry<String, Object> lhs, Entry<String, Object> rhs) {
Object l = lhs.getValue();
Object r = rhs.getValue();
if (l == null || !(l instanceof Long)) {
if (r == null || !(r instanceof Long)) {
if (!(l instanceof Long)) {
if (!(r instanceof Long)) {
return 0;
}
return -1;
}
if (r == null || !(r instanceof Long)) {
if (!(r instanceof Long)) {
return 1;
}
return ((Long) r).compareTo((Long) l);
@ -236,7 +236,7 @@ public class ObsoleteDocumentTracker {
if (!(o instanceof Long)) {
continue;
}
if (((Long) o).longValue() > HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID) {
if ((Long) o > HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID) {
ids.put(key, HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID);
}
}

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

@ -32,200 +32,195 @@ import android.util.Log;
public class PreferenceManagerCompat {
private static final String TAG = PreferenceManagerCompat.class.getSimpleName();
private static final String TAG = PreferenceManagerCompat.class.getSimpleName();
/**
* Interface definition for a callback to be invoked when a {@link Preference} in the hierarchy
* rooted at this {@link PreferenceScreen} is clicked.
*/
interface OnPreferenceTreeClickListener {
/**
* Interface definition for a callback to be invoked when a
* {@link Preference} in the hierarchy rooted at this {@link PreferenceScreen} is
* Called when a preference in the tree rooted at this {@link PreferenceScreen} has been
* clicked.
*/
interface OnPreferenceTreeClickListener {
/**
* Called when a preference in the tree rooted at this
* {@link PreferenceScreen} has been clicked.
*
* @param preferenceScreen The {@link PreferenceScreen} that the
* preference is located in.
* @param preference The preference that was clicked.
* @return Whether the click was handled.
*/
boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference);
}
static PreferenceManager newInstance(Activity activity, int firstRequestCode) {
try {
Constructor<PreferenceManager> c = PreferenceManager.class.getDeclaredConstructor(Activity.class, int.class);
c.setAccessible(true);
return c.newInstance(activity, firstRequestCode);
} catch (Exception e) {
Log.w(TAG, "Couldn't call constructor PreferenceManager by reflection", e);
}
return null;
}
/**
* Sets the owning preference fragment
*/
static void setFragment(PreferenceManager manager, PreferenceFragment fragment) {
// stub
}
/**
* Sets the callback to be invoked when a {@link Preference} in the
* hierarchy rooted at this {@link PreferenceManager} is clicked.
*
* @param listener The callback to be invoked.
* @param preferenceScreen The {@link PreferenceScreen} that the preference is located in.
* @param preference The preference that was clicked.
*
* @return Whether the click was handled.
*/
static void setOnPreferenceTreeClickListener(PreferenceManager manager, final OnPreferenceTreeClickListener listener) {
try {
Field onPreferenceTreeClickListener = PreferenceManager.class.getDeclaredField("mOnPreferenceTreeClickListener");
onPreferenceTreeClickListener.setAccessible(true);
if (listener != null) {
Object proxy = Proxy.newProxyInstance(
onPreferenceTreeClickListener.getType().getClassLoader(),
new Class<?>[] { onPreferenceTreeClickListener.getType() },
new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) {
if (method.getName().equals("onPreferenceTreeClick")) {
return Boolean.valueOf(listener.onPreferenceTreeClick((PreferenceScreen) args[0], (Preference) args[1]));
} else {
return null;
}
}
});
onPreferenceTreeClickListener.set(manager, proxy);
} else {
onPreferenceTreeClickListener.set(manager, null);
boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference);
}
static PreferenceManager newInstance(Activity activity, int firstRequestCode) {
try {
Constructor<PreferenceManager> c = PreferenceManager.class.getDeclaredConstructor(Activity.class, int.class);
c.setAccessible(true);
return c.newInstance(activity, firstRequestCode);
} catch (Exception e) {
Log.w(TAG, "Couldn't call constructor PreferenceManager by reflection", e);
}
return null;
}
/**
* Sets the owning preference fragment
*/
static void setFragment(PreferenceManager manager, PreferenceFragment fragment) {
// stub
}
/**
* Sets the callback to be invoked when a {@link Preference} in the hierarchy rooted at this
* {@link PreferenceManager} is clicked.
*
* @param listener The callback to be invoked.
*/
static void setOnPreferenceTreeClickListener(PreferenceManager manager, final OnPreferenceTreeClickListener listener) {
try {
Field onPreferenceTreeClickListener = PreferenceManager.class.getDeclaredField("mOnPreferenceTreeClickListener");
onPreferenceTreeClickListener.setAccessible(true);
if (listener != null) {
Object proxy = Proxy.newProxyInstance(
onPreferenceTreeClickListener.getType().getClassLoader(),
new Class<?>[] { onPreferenceTreeClickListener.getType() },
new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) {
if (method.getName().equals("onPreferenceTreeClick")) {
return listener.onPreferenceTreeClick((PreferenceScreen) args[0], (Preference) args[1]);
} else {
return null;
}
}
} catch (Exception e) {
Log.w(TAG, "Couldn't set PreferenceManager.mOnPreferenceTreeClickListener by reflection", e);
}
});
onPreferenceTreeClickListener.set(manager, proxy);
} else {
onPreferenceTreeClickListener.set(manager, null);
}
} catch (Exception e) {
Log.w(TAG, "Couldn't set PreferenceManager.mOnPreferenceTreeClickListener by reflection", e);
}
}
/**
* Inflates a preference hierarchy from the preference hierarchies of
* {@link Activity Activities} that match the given {@link Intent}. An
* {@link Activity} defines its preference hierarchy with meta-data using
* the {@link #METADATA_KEY_PREFERENCES} key.
* <p>
* If a preference hierarchy is given, the new preference hierarchies will
* be merged in.
*
* @param queryIntent The intent to match activities.
* @param rootPreferences Optional existing hierarchy to merge the new
* hierarchies into.
* @return The root hierarchy (if one was not provided, the new hierarchy's
* root).
*/
static PreferenceScreen inflateFromIntent(PreferenceManager manager, Intent intent, PreferenceScreen screen) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("inflateFromIntent", Intent.class, PreferenceScreen.class);
m.setAccessible(true);
PreferenceScreen prefScreen = (PreferenceScreen) m.invoke(manager, intent, screen);
return prefScreen;
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.inflateFromIntent by reflection", e);
}
return null;
/**
* Inflates a preference hierarchy from the preference hierarchies of {@link Activity Activities}
* that match the given {@link Intent}. An {@link Activity} defines its preference hierarchy with
* meta-data using the {@link #METADATA_KEY_PREFERENCES} key.
* <p/>
* If a preference hierarchy is given, the new preference hierarchies will be merged in.
*
* @param queryIntent The intent to match activities.
* @param rootPreferences Optional existing hierarchy to merge the new hierarchies into.
*
* @return The root hierarchy (if one was not provided, the new hierarchy's root).
*/
static PreferenceScreen inflateFromIntent(PreferenceManager manager, Intent intent, PreferenceScreen screen) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("inflateFromIntent", Intent.class, PreferenceScreen.class);
m.setAccessible(true);
PreferenceScreen prefScreen = (PreferenceScreen) m.invoke(manager, intent, screen);
return prefScreen;
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.inflateFromIntent by reflection", e);
}
return null;
}
/**
* Inflates a preference hierarchy from XML. If a preference hierarchy is
* given, the new preference hierarchies will be merged in.
*
* @param context The context of the resource.
* @param resId The resource ID of the XML to inflate.
* @param rootPreferences Optional existing hierarchy to merge the new
* hierarchies into.
* @return The root hierarchy (if one was not provided, the new hierarchy's
* root).
* @hide
*/
static PreferenceScreen inflateFromResource(PreferenceManager manager, Activity activity, int resId, PreferenceScreen screen) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("inflateFromResource", Context.class, int.class, PreferenceScreen.class);
m.setAccessible(true);
PreferenceScreen prefScreen = (PreferenceScreen) m.invoke(manager, activity, resId, screen);
return prefScreen;
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.inflateFromResource by reflection", e);
}
return null;
/**
* Inflates a preference hierarchy from XML. If a preference hierarchy is given, the new
* preference hierarchies will be merged in.
*
* @param context The context of the resource.
* @param resId The resource ID of the XML to inflate.
* @param rootPreferences Optional existing hierarchy to merge the new hierarchies into.
*
* @return The root hierarchy (if one was not provided, the new hierarchy's root).
*
* @hide
*/
static PreferenceScreen inflateFromResource(PreferenceManager manager, Activity activity, int resId, PreferenceScreen screen) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("inflateFromResource", Context.class, int.class, PreferenceScreen.class);
m.setAccessible(true);
PreferenceScreen prefScreen = (PreferenceScreen) m.invoke(manager, activity, resId, screen);
return prefScreen;
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.inflateFromResource by reflection", e);
}
return null;
}
/**
* Returns the root of the preference hierarchy managed by this class.
*
* @return The {@link PreferenceScreen} object that is at the root of the hierarchy.
*/
static PreferenceScreen getPreferenceScreen(PreferenceManager manager) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("getPreferenceScreen");
m.setAccessible(true);
return (PreferenceScreen) m.invoke(manager);
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.getPreferenceScreen by reflection", e);
}
return null;
/**
* Returns the root of the preference hierarchy managed by this class.
*
* @return The {@link PreferenceScreen} object that is at the root of the hierarchy.
*/
static PreferenceScreen getPreferenceScreen(PreferenceManager manager) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("getPreferenceScreen");
m.setAccessible(true);
return (PreferenceScreen) m.invoke(manager);
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.getPreferenceScreen by reflection", e);
}
return null;
}
/**
* Called by the {@link PreferenceManager} to dispatch a subactivity result.
*/
static void dispatchActivityResult(PreferenceManager manager, int requestCode, int resultCode, Intent data) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityResult", int.class, int.class, Intent.class);
m.setAccessible(true);
m.invoke(manager, requestCode, resultCode, data);
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.dispatchActivityResult by reflection", e);
}
/**
* Called by the {@link PreferenceManager} to dispatch a subactivity result.
*/
static void dispatchActivityResult(PreferenceManager manager, int requestCode, int resultCode, Intent data) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityResult", int.class, int.class, Intent.class);
m.setAccessible(true);
m.invoke(manager, requestCode, resultCode, data);
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.dispatchActivityResult by reflection", e);
}
}
/**
* Called by the {@link PreferenceManager} to dispatch the activity stop
* event.
*/
static void dispatchActivityStop(PreferenceManager manager) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityStop");
m.setAccessible(true);
m.invoke(manager);
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.dispatchActivityStop by reflection", e);
}
/**
* Called by the {@link PreferenceManager} to dispatch the activity stop event.
*/
static void dispatchActivityStop(PreferenceManager manager) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityStop");
m.setAccessible(true);
m.invoke(manager);
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.dispatchActivityStop by reflection", e);
}
}
/**
* Called by the {@link PreferenceManager} to dispatch the activity destroy
* event.
*/
static void dispatchActivityDestroy(PreferenceManager manager) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityDestroy");
m.setAccessible(true);
m.invoke(manager);
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.dispatchActivityDestroy by reflection", e);
}
/**
* Called by the {@link PreferenceManager} to dispatch the activity destroy event.
*/
static void dispatchActivityDestroy(PreferenceManager manager) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityDestroy");
m.setAccessible(true);
m.invoke(manager);
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.dispatchActivityDestroy by reflection", e);
}
}
/**
* Sets the root of the preference hierarchy.
*
* @param preferenceScreen The root {@link PreferenceScreen} of the preference hierarchy.
* @return Whether the {@link PreferenceScreen} given is different than the previous.
*/
static boolean setPreferences(PreferenceManager manager, PreferenceScreen screen) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("setPreferences", PreferenceScreen.class);
m.setAccessible(true);
return ((Boolean) m.invoke(manager, screen));
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.setPreferences by reflection", e);
}
return false;
/**
* Sets the root of the preference hierarchy.
*
* @param preferenceScreen The root {@link PreferenceScreen} of the preference hierarchy.
*
* @return Whether the {@link PreferenceScreen} given is different than the previous.
*/
static boolean setPreferences(PreferenceManager manager, PreferenceScreen screen) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("setPreferences", PreferenceScreen.class);
m.setAccessible(true);
return ((Boolean) m.invoke(manager, screen));
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.setPreferences by reflection", e);
}
return false;
}
}

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

@ -214,6 +214,7 @@ public class TabsProvider extends PerProfileDatabaseProvider<TabsProvider.TabsDa
return null;
}
@Override
@SuppressWarnings("fallthrough")
public int deleteInTransaction(Uri uri, String selection, String[] selectionArgs) {
trace("Calling delete in transaction on URI: " + uri);
@ -255,6 +256,7 @@ public class TabsProvider extends PerProfileDatabaseProvider<TabsProvider.TabsDa
return deleted;
}
@Override
public Uri insertInTransaction(Uri uri, ContentValues values) {
trace("Calling insert in transaction on URI: " + uri);
@ -287,6 +289,7 @@ public class TabsProvider extends PerProfileDatabaseProvider<TabsProvider.TabsDa
return null;
}
@Override
public int updateInTransaction(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
trace("Calling update in transaction on URI: " + uri);

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

@ -476,6 +476,7 @@ public class TopSitesCursorWrapper implements Cursor {
return false;
}
@Override
public Uri getNotificationUri() {
// There's no single notification URI for the wrapper
return null;

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

@ -84,7 +84,9 @@ public class FaviconCacheElement implements Comparable<FaviconCacheElement> {
final int w2 = another.imageSize;
if (w1 > w2) {
return 1;
} else if (w2 > w1) {
}
if (w2 > w1) {
return -1;
}
return 0;

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

@ -379,7 +379,7 @@ abstract public class FxAccountAbstractSetupActivity extends FxAccountAbstractAc
}
// And then sorted in alphabetical order.
final String[] sortedEmails = emails.toArray(new String[0]);
final String[] sortedEmails = emails.toArray(new String[emails.size()]);
Arrays.sort(sortedEmails);
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, sortedEmails);

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

@ -176,7 +176,7 @@ public class FxAccountCreateAccountActivity extends FxAccountAbstractSetupActivi
for (int i = 1991; i <= year - 5; i++) {
years.add(Integer.toString(i));
}
return years.toArray(new String[0]);
return years.toArray(new String[years.size()]);
}
protected void createYearEdit() {

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

@ -171,7 +171,9 @@ public class FxAccountStatusActivity extends LocaleAwareFragmentActivity {
if (itemId == android.R.id.home) {
finish();
return true;
} else if (itemId == R.id.remove_account) {
}
if (itemId == R.id.remove_account) {
maybeDeleteAndroidAccount(FirefoxAccounts.getFirefoxAccount(this));
return true;
}

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

@ -82,8 +82,8 @@ public class AccountPickler {
public static ExtendedJSONObject toJSON(final AndroidFxAccount account, final long now) {
final ExtendedJSONObject o = new ExtendedJSONObject();
o.put(KEY_PICKLE_VERSION, Long.valueOf(PICKLE_VERSION));
o.put(KEY_PICKLE_TIMESTAMP, Long.valueOf(now));
o.put(KEY_PICKLE_VERSION, PICKLE_VERSION);
o.put(KEY_PICKLE_TIMESTAMP, now);
o.put(KEY_ACCOUNT_VERSION, AndroidFxAccount.CURRENT_ACCOUNT_VERSION);
o.put(KEY_ACCOUNT_TYPE, FxAccountConstants.ACCOUNT_TYPE);
@ -188,7 +188,7 @@ public class AccountPickler {
Long timestamp = json.getLong(KEY_PICKLE_TIMESTAMP);
if (timestamp == null) {
Logger.warn(LOG_TAG, "Did not find timestamp in pickle file; ignoring.");
timestamp = Long.valueOf(-1);
timestamp = -1L;
}
Logger.info(LOG_TAG, "Un-pickled Android account named " + params.email + " (version " +

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

@ -63,8 +63,7 @@ public class AndroidFxAccount {
public static final String BUNDLE_KEY_STATE_LABEL = "stateLabel";
public static final String BUNDLE_KEY_STATE = "state";
protected static final List<String> ANDROID_AUTHORITIES = Collections.unmodifiableList(Arrays.asList(
new String[] { BrowserContract.AUTHORITY }));
protected static final List<String> ANDROID_AUTHORITIES = Collections.unmodifiableList(Arrays.asList(BrowserContract.AUTHORITY));
protected final Context context;
protected final AccountManager accountManager;
@ -170,7 +169,7 @@ public class AndroidFxAccount {
if (b == null) {
return def;
}
return b.booleanValue();
return b;
}
protected byte[] getBundleDataBytes(String key) {

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

@ -144,6 +144,7 @@ public final class BitmapUtils {
final Tab tab = Tabs.getInstance().getTab(id);
runOnBitmapFoundOnUiThread(loader, tab.getThumbnail());
Tabs.registerOnTabsChangedListener(new Tabs.OnTabsChangedListener() {
@Override
public void onTabChanged(Tab t, Tabs.TabEvents msg, Object data) {
if (tab == t && msg == Tabs.TabEvents.THUMBNAIL) {
Tabs.unregisterOnTabsChangedListener(this);

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

@ -32,6 +32,7 @@ class NativePanZoomController implements PanZoomController, GeckoEventListener {
}
}
@Override
public void handleMessage(String event, JSONObject message) {
if ("Gecko:Ready".equals(event)) {
mDispatcher.unregisterGeckoThreadListener(this, "Gecko:Ready");
@ -39,49 +40,61 @@ class NativePanZoomController implements PanZoomController, GeckoEventListener {
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
GeckoEvent wrapped = GeckoEvent.createMotionEvent(event, true);
return handleTouchEvent(wrapped);
}
@Override
public boolean onMotionEvent(MotionEvent event) {
// FIXME implement this
return false;
}
@Override
public boolean onKeyEvent(KeyEvent event) {
// FIXME implement this
return false;
}
@Override
public PointF getVelocityVector() {
// FIXME implement this
return new PointF(0, 0);
}
@Override
public void pageRectUpdated() {
// no-op in APZC, I think
}
@Override
public void abortPanning() {
// no-op in APZC, I think
}
@Override
public void notifyDefaultActionPrevented(boolean prevented) {
// This should never get called; there is a different
// codepath that notifies the APZ code of this.
throw new IllegalStateException("APZCCallbackHandler::NotifyDefaultPrevented should be getting called, not this!");
}
@Override
public native void abortAnimation();
private native void init();
private native boolean handleTouchEvent(GeckoEvent event);
private native void handleMotionEvent(GeckoEvent event);
@Override
public native void destroy();
@Override
public native boolean getRedrawHint();
@Override
public native void setOverScrollMode(int overscrollMode);
@Override
public native int getOverScrollMode();
@WrapElementForJNI(allowMultithread = true, stubName = "RequestContentRepaintWrapper")
@ -89,6 +102,7 @@ class NativePanZoomController implements PanZoomController, GeckoEventListener {
mTarget.forceRedraw(new DisplayPortMetrics(x, y, x + width, y + height, resolution));
}
@Override
public void setOverscrollHandler(final Overscroll listener) {
}
}

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

@ -34,6 +34,7 @@ public class OverscrollEdgeEffect implements Overscroll {
}
}
@Override
public void setSize(final int width, final int height) {
mEdges[LEFT].setSize(height, width);
mEdges[RIGHT].setSize(height, width);
@ -65,6 +66,7 @@ public class OverscrollEdgeEffect implements Overscroll {
}
}
@Override
public void setVelocity(final float velocity, final Axis axis) {
final EdgeEffect edge = getEdgeForAxisAndSide(axis, velocity);
@ -79,6 +81,7 @@ public class OverscrollEdgeEffect implements Overscroll {
invalidate();
}
@Override
public void setDistance(final float distance, final Axis axis) {
// The first overscroll event often has zero distance. Throw it out
if (distance == 0.0f) {
@ -90,6 +93,7 @@ public class OverscrollEdgeEffect implements Overscroll {
invalidate();
}
@Override
public void draw(final Canvas canvas, final ImmutableViewportMetrics metrics) {
if (metrics == null) {
return;

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

@ -101,16 +101,19 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
private final SessionInformation previousSession;
private volatile SessionInformation session;
@Override
public void setCurrentSession(SessionInformation session) {
this.session = session;
}
@Override
public void recordGeckoStartupTime(long duration) {
if (this.session == null) {
return;
}
this.session.setTimedGeckoStartup(duration);
}
@Override
public void recordJavaStartupTime(long duration) {
if (this.session == null) {
return;
@ -164,6 +167,7 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
this.prefs = appPrefs;
}
@Override
public boolean isEnabled() {
return true;
}
@ -172,6 +176,7 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
* Shut down database connections, unregister event listeners, and perform
* provider-specific uninitialization.
*/
@Override
public synchronized void close() {
switch (this.state) {
case CLOSED:
@ -208,12 +213,14 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
EVENT_SEARCH);
}
@Override
public void onAppLocaleChanged(String to) {
Log.d(LOG_TAG, "Setting health recorder app locale to " + to);
this.profileCache.beginInitialization();
this.profileCache.setAppLocale(to);
}
@Override
public void onAddonChanged(String id, JSONObject json) {
this.profileCache.beginInitialization();
try {
@ -223,6 +230,7 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
}
}
@Override
public void onAddonUninstalling(String id) {
this.profileCache.beginInitialization();
try {
@ -243,6 +251,7 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
* #onEnvironmentTransition(int, int, boolean, String)} will be invoked on the background
* thread.
*/
@Override
public synchronized void onEnvironmentChanged() {
onEnvironmentChanged(true, "E");
}
@ -252,6 +261,7 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
* (e.g., because we're about to restart, and we don't want to create
* an orphan).
*/
@Override
public synchronized void onEnvironmentChanged(final boolean startNewSession, final String sessionEndReason) {
final int previousEnv = this.env;
this.env = -1;
@ -685,6 +695,7 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
* @param engineID the string identifier for the engine. Can be <code>null</code>.
* @param location one of a fixed set of locations: see {@link #SEARCH_LOCATIONS}.
*/
@Override
public void recordSearch(final String engineID, final String location) {
if (this.state != State.INITIALIZED) {
Log.d(LOG_TAG, "Not initialized: not recording search. (" + this.state + ")");
@ -824,6 +835,7 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
}
}
@Override
public void checkForOrphanSessions() {
if (!this.orphanChecked.compareAndSet(false, true)) {
Log.w(LOG_TAG, "Attempting to check for orphan sessions more than once.");
@ -854,6 +866,7 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
}
}
@Override
public void recordSessionEnd(String reason, SharedPreferences.Editor editor) {
recordSessionEnd(reason, editor, env);
}
@ -864,6 +877,7 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
* @param environment An environment ID. This allows callers to record the
* end of a session due to an observed environment change.
*/
@Override
public void recordSessionEnd(String reason, SharedPreferences.Editor editor, final int environment) {
Log.d(LOG_TAG, "Recording session end: " + reason);
if (state != State.INITIALIZED) {

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

@ -14,23 +14,37 @@ import org.json.JSONObject;
* nothing.
*/
public class StubbedHealthRecorder implements HealthRecorder {
@Override
public boolean isEnabled() { return false; }
@Override
public void setCurrentSession(SessionInformation session) { }
@Override
public void checkForOrphanSessions() { }
@Override
public void recordGeckoStartupTime(long duration) { }
@Override
public void recordJavaStartupTime(long duration) { }
@Override
public void recordSearch(final String engineID, final String location) { }
@Override
public void recordSessionEnd(String reason, SharedPreferences.Editor editor) { }
@Override
public void recordSessionEnd(String reason, SharedPreferences.Editor editor, final int environment) { }
@Override
public void onAppLocaleChanged(String to) { }
@Override
public void onAddonChanged(String id, JSONObject json) { }
@Override
public void onAddonUninstalling(String id) { }
@Override
public void onEnvironmentChanged() { }
@Override
public void onEnvironmentChanged(final boolean startNewSession, final String sessionEndReason) { }
@Override
public void close() { }
@Override

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

@ -85,10 +85,12 @@ class BookmarksListAdapter extends MultiTypeCursorAdapter {
}
public static final Creator<FolderInfo> CREATOR = new Creator<FolderInfo>() {
@Override
public FolderInfo createFromParcel(Parcel in) {
return new FolderInfo(in);
}
@Override
public FolderInfo[] newArray(int size) {
return new FolderInfo[size];
}

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

@ -822,7 +822,9 @@ public class BrowserSearch extends HomeFragment
if (engine == -1) {
return ROW_STANDARD;
} else if (engine == 0 && mSuggestionsEnabled) {
}
if (engine == 0 && mSuggestionsEnabled) {
// Give suggestion views their own type to prevent them from
// sharing other recycled search engine views. Using other
// recycled views for the suggestion row can break animations

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

@ -116,7 +116,7 @@ public abstract class HomeFragment extends Fragment {
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
if (menuInfo == null || !(menuInfo instanceof HomeContextMenuInfo)) {
if (!(menuInfo instanceof HomeContextMenuInfo)) {
return;
}
@ -161,7 +161,7 @@ public abstract class HomeFragment extends Fragment {
// between the activity and its fragments.
ContextMenuInfo menuInfo = item.getMenuInfo();
if (menuInfo == null || !(menuInfo instanceof HomeContextMenuInfo)) {
if (!(menuInfo instanceof HomeContextMenuInfo)) {
return false;
}

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

@ -189,10 +189,12 @@ abstract class PanelLayout extends FrameLayout {
}
public static final Creator<DatasetRequest> CREATOR = new Creator<DatasetRequest>() {
@Override
public DatasetRequest createFromParcel(Parcel in) {
return new DatasetRequest(in);
}
@Override
public DatasetRequest[] newArray(int size) {
return new DatasetRequest[size];
}
@ -629,10 +631,12 @@ abstract class PanelLayout extends FrameLayout {
}
public static final Creator<FilterDetail> CREATOR = new Creator<FilterDetail>() {
@Override
public FilterDetail createFromParcel(Parcel in) {
return new FilterDetail(in);
}
@Override
public FilterDetail[] newArray(int size) {
return new FilterDetail[size];
}

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

@ -363,6 +363,7 @@ public class RecentTabsPanel extends HomeFragment
super(context, null, VIEW_TYPES, LAYOUT_TYPES);
}
@Override
public int getItemViewType(int position) {
final Cursor c = getCursor(position);
final int type = c.getInt(c.getColumnIndexOrThrow(RecentTabs.TYPE));
@ -378,6 +379,7 @@ public class RecentTabsPanel extends HomeFragment
return ROW_STANDARD;
}
@Override
public boolean isEnabled(int position) {
return (getItemViewType(position) != ROW_HEADER);
}

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

@ -168,7 +168,9 @@ public class RemoteTabsExpandableListFragment extends HomeFragment implements Re
info.url = tab.url;
info.title = tab.title;
return info;
} else if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
}
if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
final RemoteClient client = (RemoteClient) adapter.getGroup(groupPosition);
final RemoteTabsClientContextMenuInfo info = new RemoteTabsClientContextMenuInfo(view, position, id, client);
return info;
@ -288,11 +290,14 @@ public class RemoteTabsExpandableListFragment extends HomeFragment implements Re
sState.setClientHidden(info.client.guid, true);
getLoaderManager().restartLoader(LOADER_ID_REMOTE_TABS, null, mCursorLoaderCallbacks);
return true;
} else if (itemId == R.id.home_remote_tabs_show_client) {
}
if (itemId == R.id.home_remote_tabs_show_client) {
sState.setClientHidden(info.client.guid, false);
getLoaderManager().restartLoader(LOADER_ID_REMOTE_TABS, null, mCursorLoaderCallbacks);
return true;
}
return false;
}
@ -358,6 +363,7 @@ public class RemoteTabsExpandableListFragment extends HomeFragment implements Re
}
}
@Override
public void onClients(List<RemoteClient> clients) {
// The clients listed were hidden and have been checked by the user. We
// interpret that as "show these clients now".
@ -443,9 +449,11 @@ public class RemoteTabsExpandableListFragment extends HomeFragment implements Re
return FirefoxAccounts.getFirefoxAccount(getContext());
}
@Override
public void onSyncStarted() {
}
@Override
public void onSyncFinished() {
mRefreshLayout.setRefreshing(false);
}

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

@ -284,7 +284,7 @@ public class TopSitesPanel extends HomeFragment {
ContextMenuInfo menuInfo = item.getMenuInfo();
if (menuInfo == null || !(menuInfo instanceof TopSitesGridContextMenuInfo)) {
if (!(menuInfo instanceof TopSitesGridContextMenuInfo)) {
return false;
}

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

@ -266,8 +266,7 @@ size. -->
(crashReporterSection.label) in en-US/chrome/browser/preferences/advanced.dtd.-->
<!ENTITY datareporting_crashreporter_title_short "Crash Reporter">
<!ENTITY datareporting_wifi_title2 "&vendorShortName; Location Service">
<!ENTITY datareporting_wifi_geolocation_summary "Receives Wi-Fi and cellular location data when running in the background and shares it with &vendorShortName; to improve our geolocation service">
<!ENTITY datareporting_wifi_geolocation_summary2 "Shares approximate Wi-Fi and cellular location of your device with &vendorShortName; to improve our geolocation service">
<!-- Localization note (pref_update_autodownload2) : This should mention downloading
specifically, since the pref only prevents automatic downloads and not the
actual notification that an update is available. -->

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

@ -24,7 +24,9 @@ public final class DirectBufferAllocator {
ByteBuffer directBuffer = nativeAllocateDirectBuffer(size);
if (directBuffer == null) {
throw new OutOfMemoryError("allocateDirectBuffer() returned null");
} else if (!directBuffer.isDirect()) {
}
if (!directBuffer.isDirect()) {
throw new AssertionError("allocateDirectBuffer() did not return a direct buffer");
}

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

@ -24,6 +24,7 @@ public class AddBookmark extends ShareMethod {
return Result.SUCCESS;
}
@Override
public String getSuccessMesssage() {
return context.getResources().getString(R.string.bookmark_added);
}

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

@ -148,6 +148,7 @@ public class SendTabList extends ListView {
builder.setTitle(R.string.overlay_share_select_device)
.setItems(dialogElements, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int index) {
listener.onSendTabTargetSelected(records[index].guid);
}

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

@ -440,6 +440,7 @@ OnSharedPreferenceChangeListener
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs);
}
@Override
public boolean isValidFragment(String fragmentName) {
return GeckoPreferenceFragment.class.getName().equals(fragmentName);
}
@ -1288,6 +1289,7 @@ OnSharedPreferenceChangeListener
prefSetter = new TwoStatePrefSetter();
}
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {
prefSetter.setBooleanPref(pref, value);
}

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

@ -36,7 +36,7 @@ class ListCheckboxPreference extends MultiChoicePreference implements Checkable
super.onBindView(view);
View checkboxView = view.findViewById(R.id.checkbox);
if (checkboxView != null && checkboxView instanceof Checkable) {
if (checkboxView instanceof Checkable) {
((Checkable) checkboxView).setChecked(checked);
}
}

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

@ -192,10 +192,10 @@ class MultiChoicePreference extends DialogPreference implements DialogInterface.
// user cancelled; reset checkbox values to their previous state
mValues = mPrevValues.clone();
return;
} else {
mPrevValues = mValues.clone();
}
mPrevValues = mValues.clone();
if (!callChangeListener(getValues())) {
return;
}

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

@ -159,6 +159,7 @@ public class IconGridInput extends PromptInput implements OnItemClickListener {
selected = obj.optBoolean("selected");
BitmapUtils.getDrawable(context, iconUrl, new BitmapUtils.BitmapLoader() {
@Override
public void onBitmapFound(Drawable d) {
icon = d;
if (mAdapter != null) {

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

@ -62,6 +62,7 @@ public class PromptInput {
mAutofocus = object.optBoolean("autofocus");
}
@Override
public View getView(final Context context) throws UnsupportedOperationException {
EditText input = new FloatingHintEditText(context);
input.setInputType(InputType.TYPE_CLASS_TEXT);
@ -100,6 +101,7 @@ public class PromptInput {
super(obj);
}
@Override
public View getView(final Context context) throws UnsupportedOperationException {
EditText input = (EditText) super.getView(context);
input.setRawInputType(Configuration.KEYBOARD_12KEY);
@ -115,6 +117,7 @@ public class PromptInput {
super(obj);
}
@Override
public View getView(Context context) throws UnsupportedOperationException {
EditText input = (EditText) super.getView(context);
input.setInputType(InputType.TYPE_CLASS_TEXT |
@ -139,6 +142,7 @@ public class PromptInput {
mChecked = obj.optBoolean("checked");
}
@Override
public View getView(Context context) throws UnsupportedOperationException {
CheckBox checkbox = new CheckBox(context);
checkbox.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
@ -169,6 +173,7 @@ public class PromptInput {
super(obj);
}
@Override
public View getView(Context context) throws UnsupportedOperationException {
if (mType.equals("date")) {
try {
@ -277,6 +282,7 @@ public class PromptInput {
mSelected = obj.optInt("selected");
}
@Override
public View getView(final Context context) throws UnsupportedOperationException {
if (Versions.preHC) {
spinner = new Spinner(context);
@ -321,6 +327,7 @@ public class PromptInput {
super(obj);
}
@Override
public View getView(Context context) throws UnsupportedOperationException {
// not really an input, but a way to add labels and such to the dialog
TextView view = new TextView(context);
@ -340,31 +347,35 @@ public class PromptInput {
public static PromptInput getInput(JSONObject obj) {
String type = obj.optString("type");
if (EditInput.INPUT_TYPE.equals(type)) {
return new EditInput(obj);
} else if (NumberInput.INPUT_TYPE.equals(type)) {
return new NumberInput(obj);
} else if (PasswordInput.INPUT_TYPE.equals(type)) {
return new PasswordInput(obj);
} else if (CheckboxInput.INPUT_TYPE.equals(type)) {
return new CheckboxInput(obj);
} else if (MenulistInput.INPUT_TYPE.equals(type)) {
return new MenulistInput(obj);
} else if (LabelInput.INPUT_TYPE.equals(type)) {
return new LabelInput(obj);
} else if (IconGridInput.INPUT_TYPE.equals(type)) {
return new IconGridInput(obj);
} else if (ColorPickerInput.INPUT_TYPE.equals(type)) {
return new ColorPickerInput(obj);
} else if (TabInput.INPUT_TYPE.equals(type)) {
return new TabInput(obj);
} else {
for (String dtType : DateTimeInput.INPUT_TYPES) {
if (dtType.equals(type)) {
return new DateTimeInput(obj);
switch (type) {
case EditInput.INPUT_TYPE:
return new EditInput(obj);
case NumberInput.INPUT_TYPE:
return new NumberInput(obj);
case PasswordInput.INPUT_TYPE:
return new PasswordInput(obj);
case CheckboxInput.INPUT_TYPE:
return new CheckboxInput(obj);
case MenulistInput.INPUT_TYPE:
return new MenulistInput(obj);
case LabelInput.INPUT_TYPE:
return new LabelInput(obj);
case IconGridInput.INPUT_TYPE:
return new IconGridInput(obj);
case ColorPickerInput.INPUT_TYPE:
return new ColorPickerInput(obj);
case TabInput.INPUT_TYPE:
return new TabInput(obj);
default:
for (String dtType : DateTimeInput.INPUT_TYPES) {
if (dtType.equals(type)) {
return new DateTimeInput(obj);
}
}
}
break;
}
return null;
}

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

@ -55,6 +55,7 @@ public class PromptService implements GeckoEventListener {
public void run() {
Prompt p;
p = new Prompt(mContext, new Prompt.PromptCallback() {
@Override
public void onPromptFinished(String jsonResult) {
try {
EventDispatcher.sendResponse(message, new JSONObject(jsonResult));

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

@ -261,7 +261,7 @@
<string name="datareporting_crashreporter_title_short">&datareporting_crashreporter_title_short;</string>
<string name="datareporting_crashreporter_summary">&datareporting_crashreporter_summary;</string>
<string name="datareporting_wifi_title">&datareporting_wifi_title2;</string>
<string name="datareporting_wifi_geolocation_summary">&datareporting_wifi_geolocation_summary;</string>
<string name="datareporting_wifi_geolocation_summary">&datareporting_wifi_geolocation_summary2;</string>
<string name="go">&go;</string>
<string name="search">&search;</string>

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

@ -21,6 +21,7 @@ public abstract class CredentialException extends SyncException {
super(e);
}
@Override
public void updateStats(GlobalSession globalSession, SyncResult syncResult) {
syncResult.stats.numAuthExceptions += 1;
}

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

@ -153,7 +153,7 @@ public class CryptoRecord extends Record {
if (timestamp == null) {
throw new RecordParseException("timestamp could not be parsed");
}
record.lastModified = timestamp.longValue();
record.lastModified = timestamp;
}
if (jsonRecord.containsKey(KEY_SORTINDEX)) {
// getLong tries to cast to Long, and might return null. We catch all

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

@ -16,7 +16,7 @@ public class EngineSettings {
public EngineSettings(ExtendedJSONObject object) {
try {
this.syncID = object.getString("syncID");
this.version = object.getIntegerSafely("version").intValue();
this.version = object.getIntegerSafely("version");
} catch (Exception e ) {
throw new IllegalArgumentException(e);
}

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

@ -224,7 +224,7 @@ public class ExtendedJSONObject {
return (Integer) val;
}
if (val instanceof Long) {
return Integer.valueOf(((Long) val).intValue());
return ((Long) val).intValue();
}
if (val instanceof String) {
return Integer.parseInt((String) val, 10);
@ -243,7 +243,7 @@ public class ExtendedJSONObject {
// This is absurd.
if (val instanceof Double) {
double millis = ((Double) val).doubleValue() * 1000;
double millis = ((Double) val) * 1000;
return Double.valueOf(millis).longValue();
}
if (val instanceof Float) {
@ -342,7 +342,7 @@ public class ExtendedJSONObject {
@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof ExtendedJSONObject)) {
if (!(o instanceof ExtendedJSONObject)) {
return false;
}
if (o == this) {

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

@ -1014,7 +1014,7 @@ public class GlobalSession implements HttpResponseObserver {
if (version == null) {
continue; // Don't want this stage to be included in meta/global.
}
engineSettings = new EngineSettings(Utils.generateGuid(), version.intValue());
engineSettings = new EngineSettings(Utils.generateGuid(), version);
} catch (NoSuchStageException e) {
// No trouble; Android Sync might not recognize this engine yet.
// By default, version 0. Other clients will see the 0 version and reset/wipe accordingly.

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

@ -98,6 +98,6 @@ public class InfoCollections {
}
// Otherwise, we need an update if our modification time is stale.
return (serverLastModified.longValue() > lastModified);
return serverLastModified > lastModified;
}
}

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

@ -46,10 +46,12 @@ public class JSONRecordFetcher {
return authHeaderProvider;
}
@Override
public String ifUnmodifiedSince() {
return null;
}
@Override
public void handleRequestSuccess(SyncStorageResponse response) {
if (response.wasSuccessful()) {
try {

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

@ -227,7 +227,7 @@ public class MetaGlobal implements SyncStorageRequestDelegate {
Integer version = engineEntry.getIntegerSafely("version");
Logger.trace(LOG_TAG, "Engine " + engineName + " has server version " + version);
if (version == null ||
version.intValue() == 0) {
version == 0) {
// Invalid version. Wipe the server.
Logger.warn(LOG_TAG, "Malformed version " + version +
" for " + engineName + ". Recording exception.");
@ -325,10 +325,12 @@ public class MetaGlobal implements SyncStorageRequestDelegate {
return authHeaderProvider;
}
@Override
public String ifUnmodifiedSince() {
return null;
}
@Override
public void handleRequestSuccess(SyncStorageResponse response) {
if (this.isUploading) {
this.handleUploadSuccess(response);
@ -355,6 +357,7 @@ public class MetaGlobal implements SyncStorageRequestDelegate {
this.callback.handleFailure(response);
}
@Override
public void handleRequestFailure(SyncStorageResponse response) {
if (response.getStatusCode() == 404) {
this.callback.handleMissing(this, response);
@ -363,6 +366,7 @@ public class MetaGlobal implements SyncStorageRequestDelegate {
this.callback.handleFailure(response);
}
@Override
public void handleRequestError(Exception e) {
this.callback.handleError(e);
}

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

@ -37,6 +37,7 @@ public class SyncConfiguration {
this.editor = config.getEditor();
}
@Override
public void apply() {
// Android <=r8 SharedPreferences.Editor does not contain apply() for overriding.
this.editor.commit();
@ -85,6 +86,7 @@ public class SyncConfiguration {
// Not marking as Override, because Android <= 10 doesn't have
// putStringSet. Neither can we implement it.
@Override
public Editor putStringSet(String key, Set<String> value) {
throw new RuntimeException("putStringSet not available.");
}
@ -160,6 +162,7 @@ public class SyncConfiguration {
// Not marking as Override, because Android <= 10 doesn't have
// getStringSet. Neither can we implement it.
@Override
public Set<String> getStringSet(String key, Set<String> defValue) {
throw new RuntimeException("getStringSet not available.");
}
@ -408,8 +411,8 @@ public class SyncConfiguration {
// Our history checkbox drives form history, too.
// We don't need to do this for enablement: that's done at retrieval time.
if (selectedEngines.containsKey("history") && !selectedEngines.get("history").booleanValue()) {
declined.add("forms");
if (selectedEngines.containsKey("history") && !selectedEngines.get("history")) {
declined.add("forms");
}
String json = jObj.toJSONString();

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

@ -171,8 +171,8 @@ public class AccountPickler {
Integer timestamp = json.getIntegerSafely(Constants.JSON_KEY_TIMESTAMP);
if (version == null || timestamp == null) {
Logger.warn(LOG_TAG, "Did not find version or timestamp in pickle file; ignoring.");
version = new Integer(-1);
timestamp = new Integer(-1);
version = -1;
timestamp = -1;
}
Logger.info(LOG_TAG, "Un-pickled Android account named " + params.username + " (version " + version + ", pickled at " + timestamp + ").");

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

@ -55,13 +55,13 @@ public class ConfigurationMigrator {
Object value = entry.getValue();
if (value instanceof Boolean) {
to.putBoolean(toKey, ((Boolean) value).booleanValue());
to.putBoolean(toKey, (Boolean) value);
} else if (value instanceof Float) {
to.putFloat(toKey, ((Float) value).floatValue());
to.putFloat(toKey, (Float) value);
} else if (value instanceof Integer) {
to.putInt(toKey, ((Integer) value).intValue());
to.putInt(toKey, (Integer) value);
} else if (value instanceof Long) {
to.putLong(toKey, ((Long) value).longValue());
to.putLong(toKey, (Long) value);
} else if (value instanceof String) {
to.putString(toKey, (String) value);
} else {

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

@ -33,6 +33,8 @@ public class Crypto5MiddlewareRepository extends MiddlewareRepository {
this.repository = repository;
this.outerDelegate = outerDelegate;
}
@Override
public void onSessionCreateFailed(Exception ex) {
this.outerDelegate.onSessionCreateFailed(ex);
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше