base: IPV6 tethering support

Added two APIs addUpstreamV6Interface and removeUpstreamV6Interface,
required to pass the interfaces to use to the Router Advertisement
Proxy.
Added a dun entry to the networkAttributes value in
res/values/config.xml.
This is to allow tethering to work with the dunRequired property.
Added dun to allowable tether upstream type.
Enabled debug flags for debug logging inside framework components.
Regardless of MOBILE_TYPE_DUN APN being available, if dun_required
flag is not set, fall back to HIPRI as a preferred APN for the
embedded data call.
Debug logging was enabled by default which was causing security
vulnerabilities. This patch disables debug logging.

CRs-fixed: 555006
Change-Id: Idb0971449473554bcd749d478563db7ba351d55d
Acked-by: Subash Abhinov Kasiviswanathan <subashab@qti.qualcomm.com>
(cherry picked from commit 43bac130e4bab1c12792d29042f85c6a10372553)
(cherry picked from commit be8491aa9d82177c200eab1af713244a7bbbdcfc)
Bluetooth: Add Get/Set socket option to the Bluetooth Socket

Introduced Get/Set socket option to the Bluetooth Socket.
For these APIs it will directly call the APIs of Adapter
Service.The corresponding APIs have been implemented in
the Adapter service of native Bluetooth APK.

CRs-Fixed: 557180
Change-Id: Ic49b66599fb3c4c500e52295895d708dbc172cc7
(cherry picked from commit 80a5a8d9f465458c5417e532cc98970951f2c675)
(cherry picked from commit 5b4c228467074d2b71e02cd36c220584dba818fe)
Bluetooth: DUN: Add framework changes to support DUN

Bluetooth DUN profile APIs added to the framework APIs.
As DUN server supports only disconnection of DUN profile
level connection this API is implemeted along with other
APIs.

It registers bluetooth state changed callback with the
adapter service,once there is a change in the bluetooth
state,it will bind/unbind the DUN service which is
implemented in BluetoothExt.APK.

DUN service, and other DUN Application layer are mplemented
in BluetoothExt.APK.

CRs-Fixed: 557180
Change-Id: I6ce1204ac6138e28ad7486f2855f0f7444ad3886
(cherry picked from commit 2e60ff9becce9db20d1714786f74cb29b9ad9c74)
(cherry picked from commit ff766d48a4f6eb1b2efeaefa30f8467deefccfa1)
Fixing Compilation issues.

Change-Id: I3934dc861454f245a61c34a2cbd8dbd31147dfb2
(cherry picked from commit bb239ed63fe95c799c634109614c27c71ccfa544)
(cherry picked from commit 4143b7c7a3beb6835f673404bc13cddd22e1c298)
frameworks/base: move the traces file to avoid data loss.

If an ANR comes just after the framework reboot, the traces for
the framework reboot will get over-written with the ANR traces.
So, We are missing the traces for the framework reboot which
makes debugging the framework reboot difficult.

This patch will rename this trace file for the framework reboot
once the ActivityManager collects the traces.

Change-Id: Iee07b13ba02d8aab9cc43567aa5df131cc43c737
(cherry picked from commit 93348d7b1f48f1b3f6759bcff73153dce5709ded)
(cherry picked from commit 1c7cad9ce8b66eebe556c76c01a9396d449411cf)
frameworks/base: creating sperate files for ANRs traces

If an ANR comes just after the framework reboot, the traces for the
framework reboot will get over-written with the ANR traces. So, We
are missing the traces for the framework reboot which makes debugging
the framework reboot difficult.

Even for multiple ANRs in different apps, we will get the traces for
the last ANR.

Most of the time traces show that the call is stuck in some native call
and we do not have any info about the native call stack becuase we do
not collect the tombstones for teh ANR.

This patch will create one trace file for each application in case of ANR
and the filename would be traces_<app_name>.txt and the traces for
framework reboot will be stored in traces.txt

Change-Id: I5b78ce62b26f25d3dc14097e2988ba12c2d77826
(cherry picked from commit ea06416e430a85bef7cd21367e5948251f17c225)
(cherry picked from commit d678e40d53f0788b2883aa7c524da666ac2a8b4d)
BootReceiver: Skip subdirectories inside tombstones scan

Properly handle (vendor-specific) subdirs under tombstones
directory by skipping over them.

CRs-Fixed: 407529
Change-Id: I0cecd9fa629fad35d62d508ddaf13968c2e46f93
(cherry picked from commit 1440830e6ea3097278bc74762f09a21854d1b416)
(cherry picked from commit e042bd6f036a6dd3af4924b9a9111d9499259ae4)
p2p: Flush the p2p scan result on group remove event

Flush out p2p scan results on receiving group removal event.
p2p scan window will be updated on next p2p scan.

Change-Id: I3bcfed355574478bda2cac688b7df956c2701683
CRs-Fixed: 504022
(cherry picked from commit eaeecac20b125ffff8fea7a12b514999fff6bf5f)
(cherry picked from commit 3541e2cb0768865ecc312ead33f48c673e177ac3)
Tethering: add missing imports

Signed-off-by: Whitehawkx <xxwhitehawk@gmail.com>
IPV6 tethering: Check info for null before removeUpstreamV6Interface

When tethering on dual stack networks such as verizon wireless and
sending or recieving MMS you get an null pointer exception and hard
reboot.

It starts to go wrong here:
10-14 19:11:51.375: E/Mms/smil(28035): Failed to parse SMIL document.
10-14 19:11:51.375: E/Mms/smil(28035): org.xml.sax.SAXParseException:
expected start tag notEND_DOCUMENT null@1:1 in java.io.InputStreamReader
@4192ada0

And then:
10-14 19:11:55.559: E/AndroidRuntime(23125): java.lang.NullPointerException
10-14 19:11:55.559: E/AndroidRuntime(23125):    at com.android.server.
connectivity.Tethering$TetherMasterSM$TetherModeAliveState.processMessage
(Tethering.java:1573)

Which is line 1573 of:

https://github.com/CyanogenMod/android_frameworks_base/blob/cm-10.2/services/java/com/android/server/connectivity/Tethering.java#L1573

CMD_UPSTREAM_CHANGED's message.obj can be null (line 776).

Change-Id: I13d531d398f2e33a828c6e81f25f4b2a27518d34
Fix FindBugs issues

IntProperty: Infinite recursive loop
SQLiteSession: Null pointer dereference
UsbStoreActivity: Null pointer derefence
LocationManagerService: No relationship between generic parameter and method argument
ActivityManagerService: Call to equals() comparing different types
ChooseAccountTypeActivity: Possible null pointer dereference
RuimRecords: Possible null pointer derefence

Change-Id: I9d631c50c30eb98e32cca5a5085513b6904db676
simplify and improve BOARD_USE_LEGACY_TOUCHSCREEN

in addition to converting ABS_MT_TOUCH_MAJOR to ABS_MT_PRESSURE, it also converts ABS_MT_WIDTH_MAJOR to ABS_MT_TOUCH_MAJOR.

also add 2 workarounds for some touchscreen driver which
 1. has BTN_TOUCH feature but it doesn't send BTN_TOUCH event
 2. sends multi-touch event for not-in-use pointer

Change-Id: I0c1c6f9a27c2dbc5e3beddda1a7f297e76c40841
reference: http://source.android.com/tech/input/touch-devices.html
wifi: Set the mode at native layer

 * Set normal/AP mode so that the HAL can specify correct module
   arguments when loading the driver.

Change-Id: I6eee2cc53b5f1e70306e252e52c909833f220515

Conflicts:
	core/jni/android_net_wifi_Wifi.cpp
	wifi/java/android/net/wifi/WifiNative.java
	wifi/java/android/net/wifi/WifiStateMachine.java
Wi-Fi: Ping the driver for wifi-only devices

Wifi-only devices are not capable to find APs with hidden SSID unless a DRIVER COUNTRY command
will send to wifi driver. This change has:

- Send DRIVER COUNTRY command to ping the driver (to correct the seek of hiddens SSIDs)
- Save mCountryCode as uppercase because the wifi_countrycode_values array is in uppercase.
  Otherwise the preference will not be found.

Patchset 7: Rebase
            Do not set mCountryCode if country is null

Change-Id: Ie0f838aef07eaf683b713f7f0e46ff3c751523ab

Conflicts:
	wifi/java/android/net/wifi/WifiNative.java
	wifi/java/android/net/wifi/WifiStateMachine.java
frameworks/base: Fix to avoid crash when the tab is not set from app

As the current tab is not set from application, getChildTabViewAt
returns Null value. Added a condition which checks whether mSelectTab
is set to first Tab.

(cherry picked from commit 9be6755efb149b22c36aa3eb7cc4ffe7e765e08a)

Change-Id: I11c77ca96333e2663d28db1b5fdb46602bd9e745
CRs-Fixed: 321176
Wifi: Enable Ad-Hoc (IBSS) network configuration

This adds two public but hidden variables to WifiConfiguration: isIBSS and
frequency. These are used for configuring IBSS mode.

WifiConfigStore is exended to get and set these variables to wpa_supplicant
(via WifiNative).

Change-Id: Iab02c3d738c05c2de036350ea77b78789213e357
Wifi: Add IBSS supported method

Add method isIbssSupported() to WifiManager and related classes to query wether
the driver supports IBSS mode. The query is answered by wpa_supplicants new
command "get_capability modes".

It will only return a correct result after WIFI_STATE_ENABLED has been
reached.

Change-Id: I93aa2fdff94cd897c91ec3beb7e58940d1de7b72
Wifi: Get the list of supported channels

Get the list of supported channels/frequencies from wpa_supplicant and provide
them thru WifiManager.getSupportedChannels();

One channel is represented thru the class WifiChannel which includes channel
number, frequency in MHz and a flag if IBSS mode is allowed on this channel.

Like isIbssSupported() we can only expect a result after WIFI_STATE_ENABLED has
been reached.

Change-Id: I9fc34642b9a0047f6871b180a3a7a69d47b7e2ff
Replace SEAndroid with SELinux.

Change-Id: Ibbe544a9f025d71ad416bc01cee2145b62d7b2d4
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Fix SELinux.java doc errors

This fixes five errors when building the Java docs. It also
removes two obsolete lines.

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
Change-Id: I814411cbc8d16eaed99a1389f5487529e36e647b