Remove broadcast from QH toggles

Change-Id: I0d4c81b425a93e7a7410eb9404ee1962d6ba124c
Signed-off-by: scott <scott@ubuntu>
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
Proper security labeling of multi-user data directories.

This patch covers 2 cases. When an app is installed
and the resulting data directory is created for all
existing users. And when a new user is created and
all existing app data directories are created for
the new user.

Change-Id: Iaba7c40645bc7b6cc823d613da0c3782acf6ddd5
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
Merge "frameworks/base: forward port DC-HSPAP support from cm-10" into cm-11.0

Signed-off-by: scott <scott@ubuntu>

Conflicts:
	packages/SystemUI/res/values/cm_strings.xml
	telephony/java/android/telephony/ServiceState.java
	telephony/java/android/telephony/TelephonyManager.java

Change-Id: If043b7c9ebf3433787d57ecdab60c67360daf193
Squash: Memory leaks, NPEs, races and optimizations for fw/base

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/////////////////////////////////////!
Author:                             /!
Yongyi Li <yongyi.li.cn@gmail.com>  /!
/////////////////////////////////////!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

This is a combination of 13 commits.

The first commit's message is:

Fix a programmatic smooth scroll bug

Bug: smoothScrollToPosition() stops at child view of which height is
higher than list view itself.

Signed-off-by: Yongyi Li <yongyi.li.cn@gmail.com>

This is the 2nd commit message:

Fix infinite recursive loop

There is an apparent recursive loop at IntProperty.java
in method set(Object, Integer)

This method unconditionally invokes itself. This would seem
to indicate an infinite recursive loop that will result in a stack overflow.

This was brought over from out original JB branch.  Somehow, this got
overlooked, and never made it into JB42.

This is the 3rd commit message:

Rework thumbnail handling

Since ids of media file are usually not continuous, the original file of thumbnail are
sparse. When there are big numbers files on ex\
ternal storage, the size of this file will be horrible.
Ex, when the id is 20000, then the .thumbnails/.thumbdata3-xx file will be 50000*10k = 488.28M.
Can refer http://stackoverflow.com/questions/12396715/android-huge-thumbdata4-file-in-dcim-folder
Because after 4.0, MediaProvider will scan any files, this will be a big problem. So I modify MiniThumbFile.java to avoid this.
According to the id, we now produce an index file. In this index file, one id will use BYTES_PER_MINTHUMB_INDEX(8) bytes in offset (i\
d+1)*BYTES_PER_MINTHUMB_INDEX. The data of these 8 bytes is the index of thumbnail file. The first BYTES_PER_MINTHUMB_INDEX bytes kee\
p next available index. And when you need insert a thumbnail, the index increase by 1. In this way, the block data in thumbnail file \
will be continuous. And thus unnecessary zero paddings will not be saved.

This is the 4th commit message:

frameworks/base: Fix for the race in Wallpaperservice

Wallpaperservice has a race among message handler of
DO_DETACH and service's onDestroy. In certain cases,
the engine kept track in mActiveEngines is removed by
message handler of DO_DETACH and service's onDestroy
doesn't get a entry in mActivieEngines and isn't able
to invoke detach. This keeps the broadcast receiver,
mReceiver active and is unregistered by the framework
and a corresponding leak is reported.

  Later, the message handler of DO_DETACH continues
and invokes detach on mEngine, which attempts to
unregister mReceiver and framework throws an exception
"Receiver not registered: android.service.wallpaper.
WallpaperService$Engine$1@40874580" and causes the
framework to reboot.

  In case of system_server, WindownManagerPolicy and
android.server.ServerThread contest for access of
shared members, mActiveEngines and mEgine. Fix is to
protect the critical section via synchronized block.

This is the 5th commit message:

Make EntropyMixer mix in output of Hardware RNG into Linux RNG.

On devices with Hardware RNG (HW RNG), this makes EntropyMixer
periodically (every three hours) read 512 bytes from HW RNG and mix
them into the Linux RNG.

This is done without increasing Linux RNG's entropy estimates to
avoid having to trust the quality of the HW RNG. This approach cannot
reduce the quality of the Linux RNG output, but may increase it.

This is the 6th commit message:

build core/jni with fstrict

This is the 7th commit message:

Reduce EntropyMixer seed size from 4096 to 512 bytes.

The suggested seed size from Linux drivers/char/random.c is 512 bytes
rather than the 4096 bytes currently used.

This is the 8th commit message:

frameworks/base/: Fix black wallpaper issue when home pressed.

In the specified usecase, there is a completely new set of
windows that appear on the screen during rotation. And the
existing code in the framework ignores the drawstate of the
hidden windows.

Wait till the drawState is ready for the hidden windows also.

CRs-Fixed: 521758

This is the 9th commit message:

Fix to NullPointerException when activity is relaunched

When ChooseTypeAndAccountActivity is relaunched and resumed
by ActivityManager a call is made to onActivityResult without
first triggering onResume. This leads to mAccounts object
still being null.

Fixed by properly setting mAccounts object if it is null prior
to use after function onCreate has been called.

This is the 10th commit message:

Remove possible leak when exception occurred.

nameUtf8 is not released after exception.
In addtion, Fix code going down after ThrowException.

This is the 11th commit message:

frameworks/base: Fix to remove exception in tonegenerator

- Framework reboot happens, if tonegenerator fails to create
  a track in audioflinger.
- The cause for framework reboot is, an exception thrown by
  tonegenerator if fails to init.
- Fix is to remove the exception and delete the tonegenerator
  instance.
CRs-fixed:466491

This is the 12th commit message:

framework: packageinstaller :fix logical error in size calculation

fix logical error in available size calculation.

This is the 13th commit message:

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.

Patchset 2: Made commit message easier to read

Signed-off-by: pcarenza <pcarenza@gmail.com>

Conflicts:

	core/jni/Android.mk

Change-Id: Ic91414f5ca8b8ead5b3dd6eebdf9085cbcc9ef03

Conflicts:
	core/jni/Android.mk

Signed-off-by: pcarenza <pcarenza@gmail.com>
Signed-off-by: hany <hany.alsamman@gmail.com>
Base: Fix for the race in Wallpaperservice

Wallpaperservice has a race among message handler of
DO_DETACH and service's onDestroy. In certain cases,
the engine kept track in mActiveEngines is removed by
message handler of DO_DETACH and service's onDestroy
doesn't get a entry in mActivieEngines and isn't able
to invoke detach. This keeps the broadcast receiver,
mReceiver active and is unregistered by the framework
and a corresponding leak is reported.

  Later, the message handler of DO_DETACH continues
and invokes detach on mEngine, which attempts to
unregister mReceiver and framework throws an exception
"Receiver not registered: android.service.wallpaper.
WallpaperService$Engine$1@40874580" and causes the
framework to reboot.

  In case of system_server, WindownManagerPolicy and
android.server.ServerThread contest for access of
shared members, mActiveEngines and mEgine. Fix is to
protect the critical section via synchronized block.

Change-Id: I2d96a45feb0eb356da2de1db53cfe2431f124388

Conflicts:
	core/java/android/service/wallpaper/WallpaperService.java

Signed-off-by: hany <hany.alsamman@gmail.com>
add "Turn Wi-Fi off" action to the "open networks available" notification

Signed-off-by: Roman Birg <romanbirg@gmail.com>
Signed-off-by: scott <scott@ubuntu>

Conflicts:
	core/res/res/values/strings.xml
	services/java/com/android/server/WifiService.java

PS2: Adapt to 4.3 changes
PS3: Adapt more to 4.3

Change-Id: Idaed26320a2ff2e6ada448fa6deb95a76d2b86d2

Conflicts:
	core/res/res/values/strings.xml
Revert "Base: Fix for the race in Wallpaperservice"

This reverts commit 3e92dda6ad2e89c92ea3a8a9ed540c0e27fcd5f9.