Replacing FloatMath native implementation with calls to Math

On modern versions of Android running in AOT mode
FloatMath is slower than Math. Calls to Math.sqrt(),
etc. are replaced by intrinsics which can be as small
as a single CPU opcode.

When running in interpreted mode the new
implementation is unfortunately slower, but I'm
judging this acceptable and likely to be improved
over time. This change saves a small amount of native
code.

Example timings:

Mako AOSP AOT:

Method: Original / New / Direct call to Math
ceil: 596ns / 146.ns / 111ns
sqrt: 694ns / 56ns / 25ns

Mako AOSP interpreted:

Method: Original / New / Direct call to Math
ceil: 1900ns / 2307ns / 1485ns
sqrt: 1998ns / 2603ns / 1788ns

Other calls Mako AOT:

Method: Original / New
cos: 635ns / 270ns
exp: 566ns / 324ns
floor: 604ns / 150ns
hypot: 631ns / 232ns
pow: 936ns / 643ns
sin: 641ns / 299ns

The advice to use Math directly, in preference to
FloatMath, is still good. FloatMath will be deprecated
separately.

Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: If07fcbd78543d13bc6d75f9743f999860e8d58d7

Conflicts:
	core/jni/AndroidRuntime.cpp
Fix memory leak in nativeDecodeFileDescriptor

Fix memory leak in nativeDecodeFileDescriptor:
SkFILEStream::kCallerRetains_Ownership is used to keep
life cycle of file in Java,so fclose is not called when
destruct SkFILEStream because ownership not belong to
native here, while when file is closed in Java, close
is called instead of fclose,that means buffer allocated
by malloc in fseek, when create SkFrontBufferedStream
with this filestream, will not be freed, because this
buffer will only be freedin fclose.
To fix this issue: duplicate this fd, and use
SkFILEStream::kCallerPasses_Ownership for SkFILEStream,
means Java and native manage file life cycle separately.
CRs-Fixed: 718738

Change-Id: I1c664551ab8d381db2e1f948a2207bc6fb7a11f9
Tethering: Enable NAT only when tether and upstream ifaces are different.

When enabling WIFI hostspot, chooseUpStreamInterface will choose WIFI
interface as it is still up. It will result in both tethered and upsteam
interfaces are same one. netd will reject this command and tethering
will fail this time.

This fix will not send NAT command to netd when it found these two
interfaces are same one. Later when the real upstream interface is
brought up by ConnetivityService, Tethering.java will continue the NAT
procedure.

CRs-Fixed: 692285
Change-Id: I1ecd700ad64748c3745fffc76b7ac0e7d7b9b96b

Telephony: Avoid Infinite loop problem in Tethering

1. Whenever data is enabled we will try to establish the tethered
call (USB tethering enabled case) for 5 fixed number of retries.
After reaching maximum number of retries we are turning off the
upstream connection. whenever the CONNECTIVTY_ACTION received
(because of USB cable disconnected and then connected case or
some changes), it can try to bring up the dun/hipri PDP again.

2. There is no retry in case of data disabled case.

Change-Id: I16af4d2983a8bf9ce0ce904877f86169bca549b4
CRs-Fixed: 401829
(cherry picked from commit 4c923c8537fdc49ef491b964adc1871c77bfd730)
(cherry picked from commit 3135e6a89ac14008df04fe6e068bd8dd95b4ee40)
(cherry picked from commit 137b7004f716a559c7249be20e25544fe10330b6)

Broadcast tethered client inteface along with upstream interface name

On change in tethering upstream interface for IPV4 of IPV6 address,
broadcast an intent with both tethered client interface as well as
upstream interface name, ip address type and update type.

Change-Id: I2f23e2b8ec125339bedd454446accb23e33cacae

base: Add P2P interface "p2p0" to tethering support list

Dnsmasq is running as singleton pattern, P2P GO start DHCP server fail
if dnsmasq has been started by USB tethering. Tethering management
feature in Tethering.java just support soft AP and USB tethering. Add
P2P interface "p2p0" to tethering support list.

CRs-Fixed: 719930
Change-Id: If3a07e6cac1678dfedf361abf99f52bc12a2f697

base: Fix for wifi tethering crash

Pass network info along with CMD_UPSTREAM_CHANGED
Added a NULL check for Network info in CMD_UPSTREAM_CHANGED

CRs-fixed: 562910
Change-Id: I98bd37205255d9d4025cfb95b0688c68bce3c9bd

Tether: fix the retry issue in Tethering

Since StartUsingNetworkFeature will always return success, it's
not a good place to set retry. With this modification, the retry
will work.

Change-Id: Ia2ea489ea57f99617004093bfedc8e7e6dba46ed
CRs-fixed: 667865
 MTU should be 1358 as per 3GPP standards, especially for LTE radio interfaces.

Change-Id: I5d3601b05a41d4c59cff3b39ddfb66d00cb23c45
Signed-off-by: Stacy Devino <swylie@oceusnetworks.com>
Lemon Squash: Revert CM Bluetooth changes

Revert "MAP: Support MAP Server role on Bluedroid with javax.OBEX lib."

This reverts commit c85e6132e0714cfdc79e3a5adb6b95f4079634d5.

Revert "Bluetooth: Add Total track number."

This reverts commit be57e2d6b92b0245deb36aa63759d06552bcf64b.

Revert "Bluetooth: pause music player on A2dp service disconnect"

This reverts commit 46515507030f9e478c97bda0a9c446220dd68103.

Revert "Bluetooth: use  virtual sco calls for VOIP"

This reverts commit 953f32915e816aea19f0c557616d39bb5382c765.

Revert "Bluetooth:Settings:Handled ACTION_STATE_CHANGED intent at boot time"

This reverts commit 5dde14f165c292308612fd1d8d5141830d07e789.

Revert "Bluetooth: Unbind only in case of OFF state"

This reverts commit 8d643f9f22b9465eef9829bb4d53d74f177fbef2.

Revert "Bluetooth: Disable bluetooth only if BT Sevice is connected"

This reverts commit 7d9698cd28141cdf98f01e4afab80448f82bf310.

Revert "Fix MAP SDP record generation [2/3]."

This reverts commit 5e1d8f8df6b43162882dec737e5d26cd8ce7cb47.

Revert "Bluetooth: Add Power apply enable event handling"

This reverts commit 1cd2a68a95c57800c7f503c188b67286c84ccdf1.

Revert "[1/3]frameworks/base: add "Accept all files" option for incoming files via Bluetooth"

This reverts commit 0dbba5a28f5d9fc3fa0638dd5a0ed14e91c45e2f.

Revert "Bluetooth-OBEX: Fine tune OBEX Tx MTU for better performace/power"

This reverts commit 7901bde4f5d06db8f4bd6c0cd33d3292c17446ee.

Revert "Bluetooth-OBEX: Reduce the MTU size if default OBEX MTU > 8k"

This reverts commit 5375cb2b8621d054ee6e8717c3e2cbeaf149a068.

Revert "OBEX: Reduce Obex MTU size for A2DP or SCO concurrency"

This reverts commit f74a2ff0d615d2837a4b345c180c00d12fddc5db.

Revert "Bluetooth: Avoid fd leak for Bluetooth server socket connections"

This reverts commit 87e051d3af5570f4f5f27f82befdf4a3b2ab2169.

Revert "Bluetooth: Fix to avoid object leaks during BT OFF"

This reverts commit 0f1080df5a5ae8c87d43b5eb6e1e9434e77c1b0e.

Revert "BT: HF: Control verbose logging at runtime."

This reverts commit 443b2388f885b8591eb3224a43433c91ef7e23ff.

Revert "Bluetooth: Adds check to verify Bluetooth adapter state"

This reverts commit 3f1cbf8db9f60f70ff053d9e113900cd79cd5dc5.

Revert "Bluetooth: Adds check to verify Bluetooth adapter state"

This reverts commit 62ac8dac1f85d0c5c063b1d06742d811b87d0ed5.

Revert "Bluetooth: Added new key to store last connected A2dp Sep type"

This reverts commit 948c9221276f093f33899b81370743cb211f0f09.

Revert "Bluetooth: Fix for FileDescriptor leakage causing ANR"

This reverts commit 7a1e344b65ae09db4f44c7b5c41e20c5ed65a296.

Revert "Bluetooth: Handle exceptions for bluetoot socket read"

This reverts commit a7ecf8e89116fd536d40a4f22b2b650e80d744eb.

Revert "Bluetooth: Add SDK apis for Wipower and Peripheral feature"

This reverts commit caddde5993478a04ba82cd7d9baa98cfa05460d9.

Revert "Bluetooth: Fix PXP LPP app link loss reconnection"

This reverts commit aaab4b3ebdfb61f71faef85fd24ff7d961d9d01c.

Revert "Bluetooth: Validate input parameters of gatt characteristics"

This reverts commit 37d5c634eeff930987069bea94ce45817920e8d3.

Revert "Increases Gatt connection timeout value to be 30 secs"

This reverts commit 29c1294e7313b435b789528a7b950f0bbe26062a.

Revert "Bluetooth: HID-C: Add support for error parameter for reportError"

This reverts commit f8cb06a4002fa24c3be8b4ea0038e2da9cb4b1ae.

Revert "Bluetooth: Fix to avoid framework reboot during monkey."

This reverts commit f1c3f0138648789bd5f82d3ca65b8c67fa8c3357.

Revert "Bluetooth: Fix to avoid framework reboot during monkey."

This reverts commit a23e9dbf58c150a5f95a42a80bbcfdd42a695e44.

Revert "Bluetooth: Cleaning up sap service object to avoid serviceRecord leaks"

This reverts commit b17b960b945cb409fca82d5f952c70f0dd2a09f1.

Revert "Bluetooth: Changes for LPP and extended LE scan"

This reverts commit 84b61bd55409561e6134a9cb1cee161ca42e1f2a.

Revert "Bluetooth: HID: Add support for HID Device Role"

This reverts commit 870a3c92d307ec64974a76033faba073d8aa8e37.

Revert "Fixing Compilation issues."

This reverts commit 34ea47edca3526ac5da62d54f5132b8ef6d5c45f.

Revert "Bluetooth: DUN: Add framework changes to support DUN"

This reverts commit 962aee13221caa1a0d1afc9d062fb1f3366a7b5e.

Revert "Bluetooth: Add Get/Set socket option to the Bluetooth Socket"

This reverts commit af5754d272caaadfba408446e466202a343bd9c3.

Revert "Bluetooth: Support  HFP Client role on Bluedroid."

This reverts commit bf0d4300987672fa826d2818a242c12fe41c5eb7.

Revert "Bluetooth: SAP: Add framework changes to support SAP"

This reverts commit 44b799a29ac4f5c2807d272b8c6491c8a11ffc12.

Revert "Bluetooth: Changes to support AVRCP 1.5"

This reverts commit a5287a5d5634680a76343d8ca053b3d6c62147f3.

Revert "OBEX: Implementation of MAP and PBAP client role on Bluedroid."

This reverts commit 2ad72aab0912bb31646810cb5718b9f7577f3f5c.

Revert "Bluetooth: Add trust device feature."

This reverts commit 5b818964cf01b3472c303b0b3aec7023d0679139.

Revert "Bluetooth: HID: Add support for Set Idle and Get Idle Commands"

This reverts commit b56e191183f445a6ab909b964b90b6863b0df53d.