Only start one WifiClientScanner

*) Fixes unexpected soft reboots.
E/AndroidRuntime(18586): *** FATAL EXCEPTION IN SYSTEM PROCESS: WifiClientScanner
E/AndroidRuntime(18586): java.lang.IllegalStateException: Cannot execute task: the task is already running.
E/AndroidRuntime(18586):     at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:576)
E/AndroidRuntime(18586):     at android.os.AsyncTask.execute(AsyncTask.java:535)
E/AndroidRuntime(18586):     at com.android.server.connectivity.Tethering$WifiClientScanner.handleMessage(Tethering.java:596)
E/AndroidRuntime(18586):     at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(18586):     at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(18586):     at android.os.HandlerThread.run(HandlerThread.java:61)

*) Remove unnecessary mDoScan class member variable.

Change-Id: I17ab368366b9a3456a625974c461783c428efec2
Revert "Avoid collision with RIL constant 1138, used in some Samsung devices for RIL_UNSOL_TETHERED_MODE_STATE_CHANGED."

Later Qualcomm RILs will use the STK_CC_ALPHA_NOTIFY message, and this
causes the radio to parse the parcel in a very incorrect manner.

This reverts commit 8e3fee66ff3a1d55f1aa69df7b52fdcab33f1f82.

Change-Id: I94e2867f130b88c4c9eff17293edd0b64dda516a
Update SET_ACTIVITY_WATCHER protection to signature|system

Change-Id: Iabf8ad2fc4b298e96b494917a140e0e4ea4e26e2
PackageManager: Add optional prelaunch check step

This ability is protected by config overlays.

Conflicts:

	core/java/android/content/pm/IPackageManager.aidl
	services/java/com/android/server/pm/PackageManagerService.java

Change-Id: I0c80bd9ec6bda3d21557aaa9503f05ff86adf434
Provide non-interactive APIs to BackupManagerService

- Add return codes for backup and restore in FullBackupRestoreObserver
- Add non-interactive backup and restore methods in BackupManagerService
- Add per-file filters for backup in BackupAgent

Change-Id: Ic1dfd5d144507263baad76f7088a52eab2fb283a
Support full size application screenshots

Add optional width and height parameters for
ease of capturing entire application screenshots

Change-Id: I6d154f6b33bfb8ec90e3757a40382c1dc6feaad3
extmediaplayer: miscellaneous fix

Fix for issue 20936 reported by KW.

Change-Id: I512657696d99bbe64edfffa0ad7c687651a31acc
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
AudioService: Fix monitorRotation for landscape applications

Current implmntation only sends rotation updates on orientation
changes, so does not handle direct 0<->180 or 90<->270 transitions.

Update rotation based on an OrientationEventListener instead of
Intent.ACTION_CONFIGURATION_CHANGED

Bug 17606902

Change-Id: I01dfcd1c587f5b2e8a96365c2389782ad77936ef
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
lowmemorykiller: Overwrite LMK parameters for low-tier devices

LMK parameters calculated by default algorithm were not optimal for
low-tier devices. Values mentioned here were well tested and
evaluated w.r.t memory and performance for such setups.

lowmemorykiller: fine-tune LMK parameters for low-tier devices

LMK parameters for low-tier devices are fine-tuned for better
concurrency. Values mentioned here were well tested and
evaluated w.r.t memory and performance for such setups.

Conflicts:

	services/java/com/android/server/am/ProcessList.java

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

Change-Id: I5d3601b05a41d4c59cff3b39ddfb66d00cb23c45
Signed-off-by: Stacy Devino <swylie@oceusnetworks.com>