[1/2] Make App Switch Delay userdefineable
SystemUI: Fix Removed USB Storage Notification

If you have connected a OTG USB Storage to your device an disconnect it
the Notification "Removed USB Storage" appears. But you can't swipe it
off, because the Notification intent is set with FLAG_ONGOING_EVENT and
not with FLAG_AUTO_CANCEL!
In my fix I changed the boolean function variable 'dismissable' from
"false" to "true" and so the Notofication will gets the flag
FLAG_AUTO_CANCEL, now the Notification can be swiped off.

Bug: https://paranoidandroid.atlassian.net/browse/AOSPA-191

Change-Id: I01713dbcbc025d0dd2df3e6d4359507e0e31a23f
Signed-off-by: Matthias Freund <matthias88freund@gmail.com>
Parallel shutdown

Decrease shutdown time by doing some shutdown tasks in parallel.

There are two threads executing during the shut down: the ShutdownThread
and a separate thread for the radio shutdown. However, the execution is
done in serial, as the ShutdownThread immediately joins on the radio
thread.

This commit will move the shutdown of the radio to the beginning of
shutdown and execute it in parallel to the shutdown of the rest of the
system.

The flow of the two threads during shutdown is now:

Radio Thread
  * Start shutdown of the radio
  * Wait for radio off or time out
  * Notify that the radio is done
ShutdownThread
  * Broadcast ACTION_SHUTDOWN as a parallel broadcast. (The receivers
    will get as much time to handle onReceive as it takes execute the
    rest of the tasks in the shut down flow. If they are not done in
    that time, we don't care.)
  * Shutdown ActivityManager
  * Shutdown MountService
  * Wait for MountService and radio to notify done
  * Vibrate
  * Low level shutdown

Change-Id: Ifdd8a9c75337fd9d00148a0d2b9917e10fa60634

Conflicts:
	services/java/com/android/server/power/ShutdownThread.java
Add TYPE_MAGNIFICATION_OVERLAY to InputWindowInfo::isTrustedOverlay()

This fixes a bug where a View with filterTouchesWhenObscured will have
all touches filtered when in magnification accessibility mode. This is
due to magnification being a separate Window over top of the running
Activity. The method onFilterTouchEventForSecurity in View will then
always return false when filterTouchesWhenObscured is enabled on the
View. By adding the magnification Window to the list of Trusted Overlays
we can ensure that touches will work properly with this property enabled.

Change-Id: I07706588a625682d05da5cb19f401139eb08a54c
Fix spelling error in Pm.java

"w ith" -> "with"

Change-Id: I8e45b971cd767326d35696276d2ab73634ffce34
Tunning max allowed background services

The serialize running of background services feature
delay some services startup when system bootup, and
lead some abnormal behaivor at the early of system startup.
Tunning will be disabled after system complete bootup.

Change-Id: I834607d9156253bee13848586a8136e24760fdf4
AndroidRuntime: reduce logcat debug spam

this ought to prevent log messages similar to:
D/AndroidRuntime(12391):
D/AndroidRuntime(12391): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(12391): CheckJNI is OFF

Change-Id: Ie6948daf552d138c97ade941bedb8714f03145a3
Always call super.onCreate().  Always.

Bug 12991134

(cherrypick of commit 9d6376a1d88ab5b3a41ee4400e3aaa4c4ee69e2a)

Change-Id: Ife16ef93408253e3318a06dc0206ab4b88c7f367
Don't register methods when there's nothing to register.

Change-Id: I6d0233f79bb90089426d702b4076ec5750e82475
Wifi: Adjustments for sleep policy

   The wifi sleep policy "When screen turns off" will switch
off wifi although the USB tethering is active.With this
patch, the sleep policy is removed when the usb tethering is
active.The WifiService maintains a local status variable in
according with the wifi tethering (on,off).If the usb tethering
is on, the alarm, to switch off the wifi, is cancelled.If the
device in unplugged after turning off the display while still
not connected, it's better to directly turn off wifi in order to
reduce power consumption.So when unplugged while screen is
already off, request to go in idle (and so turns off wifi) if
wifi is not connected.
   When USB tethering is enabled, don't care about sleep policy:
- first because DUT is powered by USB
- secondly because DUT is used as wifi card and so used by PC

Signed-off-by: Paul Naoumenko <paulx.naoumenko@intel.com>
Signed-off-by: Cedric IZOARD<cedricx.izoard@intel.com>
Signed-off-by: chenxi2x <xiaolongx.chen@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Change-Id: Ic1af2367a2f73965c32d300450ee76cf5593af78
Add Environment call: get config dir for some user

This returns a read-only directory accessible to any app running as the
same user, containing various configuration files written by the system.

Change-Id: I635de184fc285b8fef166b782bbc1ac79f8f0687
Add support for NETWORK_TYPE_GSM

Add support for NETWORK_TYPE_GSM in TelephonyManager and
corresponding mapping in ServicState.java so that when
application queries for getVoiceNetworkType() and currently
camped rat is GSM, they get network mode as GSM instead
of network mode unknown.

Change-Id: Ibe4672b04a5044710d63499c4cf2b6ebe91444bf
Add missing character combinations for international layouts

Czech: add missing capslock for numbers and shift+ralt
mappings.
Slovak: fix wrong ralt mappings, add missing ralt mappings
and fixed wrong PLUS key character.
US intl: add missing capslock+ralt support.
Swiss French and Swiss German: add missing ralt mapping for key
numbers 4 and 5, and add missing capslock and capslock+
shift for SEMICOLON and APOSTROPHE.

Change-Id: I02c94bf13d5268d5d1e648c96b7251cb7564f233
Signed-off-by: Olivier Gay <ogay@logitech.com>
Signed-off-by: Manuel Carthoblaz <mcarthob@logitech.com>
Signed-off-by: Mathieu Meisser <mmeisser@logitech.com>
Fix the API compatibility of "UriMatcher#addURI"

The previous patch (ef23bf19 Allow leading slash in path...) made
a single slash path unmatchable.
To solve it, this patch stops removing a slash character if the path
only has a slash character.
Now, a single slash is a matchable path for a URI without path string.

Change-Id: I90b357aa48be1a3e0cf36e75ed2a9d6532908972
Freeing frame map

FileMap memory is never released until application exit

Release it now as the texture is already loaded and the memory
used for the packed resource can be released.

Change-Id: Id08a1e466337b3a0179684eb6a444e18147ee343
Use Runtime.gc instead of System.gc for DDMS.

System.gc doesn't always do a GC unless to attempt to run the
finalizers after you call System.gc.

Bug: 14325353
Change-Id: Iebed7fad5576d610cea13a86e7d3d46652c67478
Cast CallVoidMethod's size_t parameters to jint

offset and size variables are passed to set method
of MediaCodec.BufferInfo java class. The corresponding
actual parameters of set method are of int type in java.

These variables are expected to fit in jint as they
indicate the offset and size of data in a media codec
buffer.

The variables are cast to jint, prior to passing to
java method, to avoid problems caused by automatic
type promotion of parameters when passed to a
variadic function, CallVoidMethod.

Change-Id: I39e202306f1b7122448c947f6d275f00251bb33a
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
core/jni: Clean up and optimize build flags
Fix for native leaks in YuvToJpegEncoder.cpp

Objects allocated by Get<object>ArrayElements function,
should be released. Add a fix to release this objects
in error cases.

Change-Id: Idf834523d93bb2dfd6b872e3b2179b7f1bba38f3

Conflicts:
	core/jni/android/graphics/YuvToJpegEncoder.cpp
WallpaperManager: add NULL pointer check for getCropAndSetWallpaperIntent

Originally the api 'getCropAndSetWallpaperIntent' does not check
whether the parsed parameter is a NULL pointer, as leads to the
whole app crash if it call this api with a null parameter accidentally.
A null pointer check logic is added into its original parameter check
logic, so that this API will throw an IllegalArgumentException if it
is parsed with a null pointer

Change-Id: Ib7de40e571419d09e1a744edc969eb7162766b75