Null pointer exception in FileRotator.java

Sometimes a null pointer exception is thrown when examining files
managed by the file rotator.

The logs from the test show that the Wifi state is changed a large
number of times. On every state change, a write operation is
initiated on the file system. This will eventually result in out
of memory and the call to mBasePath.list() in the maybeRotate(...)
method in FileRotator.java will return null so the iteration will
throw a NullPointerException.

Change-Id: I5d5980d9593bc9ec75281169ca27ee591809903f
Frameworks: Advanced low battery indicator options (1/2)

Based on a idea I saw on Liquid and from CR3C0 (thanks guys) which we
modified to an extended version

This commit introduces following new SlimBean modes to indicate low battery

     * 0 = show dialog + play sound (default)
     * 1 = fire notification + play sound
     * 2 = show dialog only
     * 3 = fire notification only
     * 4 = play sound only
     * 5 = none

Due that notification is a unique SlimBean feature some words on it. Notification
behaviour is the same as Pop-up. User can dismiss it manually or it is
dismissed automatically if charger is connected, click on notification opens
PowerUsageSummary. Also you get a status bar ticker message about the notification
and notification is always on first place of list. And last if vibration is enabled
notification vibrates.

Patchsets:
 - codestyle corrections

Patchst
 - add PowerUsageSummary intent

cheers

Change-Id: I2097afad8a090d2557a1e545cf978c87ca77d6c1
Add OpenCnam paid account settings keys

Change-Id: I895b5f2b2a8a8de568e5aa1cea5d66ba490985fc
Frameworks: Incoming Call in Background (3/3)

Patch ported from 4.2 which was done by our lovely HCP. A
very popular one so we bring it back and adapt it to 4.4

Allows user to set that Incoming Call UI will remain in background
if screen is on. Instead, a notification is added to StatusBar, which
can be used to bring up the Incoming Call UI. Ringtone and vibration
still occur as per system settings.

This has the same effect as apps marked as "immersive". It prevents
the incoming call from backgrounding the current activity.

Change-Id: I1eb0ae6b10ba02c3f1df95265d26a6c61db74aab

Conflicts:
	core/java/android/provider/Settings.java
Add zh-rCN Translation

Change-Id: If3a92da037d942d320ba6093b2c96f55ccfb5e41
Updated czech translation
frameworks/base: Fix the random UI corruption

On low memory device, when a view goes to background. Its HW layer cache
will be destroyed to release memory. There is a very rare case that the
hardware render is not valid when destroy the layer, so the layer is not
destroyed and reused when the view comes to foreground. But the GL
context has changed, so the view is not rendered correctly due to its
HW layer cache. To fix this issue, destroy the layer in a safelyRun. Make
sure the layer is destroyed correctly.

Change-Id: I1c714e1d53db7353d5169e874a7cd0f527c3f67b
CRs-Fixed: 623239
frameworks/base: Fix change propagating issue

destroyLayer() function has been modified in kk. It is not correct
to propagate the UI corruption fix from jb to kk without considering
the new changes made in kk. This change is to make it align with
the new code in kk.

Change-Id: I34d11b230b9390fe8a989ab6f9c7d3a48d586205
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
Signed-off-by: houst0nn <houstonn@gmail.com>
NULL previous background bitmap upon changing wallpaper

Step to reproduce it on Nexus 10 with 4.4.2(KOT49H):
1. Long press on home screen.
2. Choose wallpaper from Wallpapers.
3. Select new wallpaper and set it.
4. Repeat step 1-3 several times.
See black background instead of the wallpaper.

There are two binder objects who hold reference to the
ImageWallpaper$DrawableEngine, which keeps the big chunk
bitmap from being recycled.
One is WallpaperService$IWallpaperEngineWrapper. The client
references went away slowly, maybe several minutes after
changing wallpaper. Then the finalizer has to been executed
to GC it.
The other one is WallpaperService$Engine$BaseIWindow. Don't
know who still held reference to it even after the window
was removed.
Anyway, let the bitmap be GCed first.

Change-Id: I27f6971a3edd26472b69e59b542b27fd7c8e7b90
Signed-off-by: jshe32X<jianchunx.shen@intel.com>
Signed-off-by: Guobin Zhang <guobin.zhang@intel.com>
Signed-off-by: houst0nn <houstonn@gmail.com>
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
Signed-off-by: houst0nn <houstonn@gmail.com>
GlobalActions: Fix Airplane Mode on/off issue

Issue: Unable to turn off Airplane mode from power button
       after phone reboot

Fix: Initialize mHasTelephony before the PhoneStateListener is
     registered to the TelephonyManager so that correct value
     of mHasTelephony is reflected when onServiceStateChanged
     callback is called.

https://android.googlesource.com/platform/frameworks/base/+/c3b7e6fd44593c3974e989d8ccf2097b4471b2b7

Bug: 13697360
Change-Id: Ide8afd9c16ea90b98b5912dbff440c5fd67b178d
Signed-off-by: houst0nn <houstonn@gmail.com>
Always call super.onCreate().  Always.

Bug 12991134

Change-Id: Ife16ef93408253e3318a06dc0206ab4b88c7f367
Add explicit close of Scanner input

The UsbDeviceManager is using a Scanner to identify
the ALSA card/device numbers to use for USB Gadget
audio, with a FileInputStream as its input.

Since FileInputStream implements the Closeable interface
it provides a close() method that should be explictly
called in order to close the stream source and release
any system resources that it might hold.

Change-Id: Ia0ff86d1f3cdf8916becec9c8603915dcbf4d2c8
Signed-off-by: houst0nn <houstonn@gmail.com>
Release DrmManagerClient resources

Call release for DrmManagerClient to avoid resource leaks

Introduced by following commit (5d143ad4a8f...),
"Media scanner support for FL(Forward Lock) DRM file types"

https://android-review.googlesource.com/#/c/91081/

Change-Id: Ic3c458579f4e99b3b072a2e13362d1996b982589
Signed-off-by: houst0nn <houstonn@gmail.com>
Launch floating notifications from notification panel (long click)

 * Status bar - long click on notification select 'floating mode' option

fix derp in floating notification launch

Notification long press fix
On-the-spot preference dialog: Switch back to notifications if user denies quick pulldown

Change-Id: I360ae8a64f28b0b25a4dbebbba2470f5b90eae2f
Signed-off-by: Parthipan Ramesh <parthipan.ramesh@gmail.com>
Framework: Update IT Translation

Change-Id: Ifd1bfb0411f449388515ba919c9a78fb9bb9a551
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
Signed-off-by: houst0nn <houstonn@gmail.com>
Fix crash when clicking a file from recents or downloads

Change-Id: I6e1693d1d9f433b6baf25d3033245a56817ec16a