framework-res: Remove gingerbread scrolls

Change-Id: I135c37a6631694d96bd059cfd8c1f7cfe50c3400
Volumepanel: always show option icon

Change-Id: I702b1e47bd01adb06e72ade1ad2e02c17c4ae747
Signed-off-by: Dirk Rettschlag <dirk.rettschlag@gmail.com>

Conflicts:
	core/java/android/view/VolumePanel.java
base: allow to choose CRT animation by default

Since Android 4.4 Electronbean is the default screen-off-animation.
<bool name="config_animateScreenLights">true</bool> seems not to work
as it should at the moment. It will only disable the option to choose
a different screen-off-animation. It will not force to fade-off,
set it to "false" will add the option inside Settings -> Display
to choose between the different animation. At the moment we need
<bool name="config_animateScreenLights">false</bool>
inside the device overlay to make that option visible.

Change-Id: I5c341ae79efddbafb7996dfc1239cbc0b5aadab2
Increase wallpaper crashtime

Change-Id: Id640ca2b7b889e718c9f5acb71da97c5f3dbbc05
Fix STE OMX
Fix STE "OK Google"

Thanks @C457 and @Meticulus
Fix problem where PhoneWindowManager waits for keyguard to draw

Keyguard: We need to ensure that keyguard is showing as well to set the token
Suppress String resources build warnings

warnings suppressed are:
aapt: warning: **** string '%s' has no default or required localization for
aapt: warning: string '%s' has no default translation in

Patch Set 2: move ifdef and only suppress warnings for packages that
             define NO_DEFAULT_TRANSLATION_WARNINGS and/or
             NO_LOCALIZATION_WARNING

Patch Set 3: by default do not show warnings unless
             SHOW_DEFAULT_TRANSLATION_WARNINGS and/or
             SHOW_LOCALIZATION_WARNINGS

Change-Id: I50ef2a623959a1cc53053b446328df8e34cc99e8
Restore pre-KitKat permissions to external sd for all apps

Change-Id: Ib3ff52bcc47fd36e8f3fc5aefeaae4e56180e7c6
Don't make isSafeMode a field on the Zygote class.

This field is written and read exclusively by the system server,
and should therefore belong to the SystemServer class.

Change-Id: I2708a9a45c0c9cd1a6f563e8cc5844bd8c424bf7
Sometimes property service is slow to respond.

Upon boot-up, telephony service will update the system property for
timezone and send out broadcast.The property service won’t handle
the update immediately if the init process was doing something
time-consuming. Meanwhile StatusBar(one broadcast register) may get
the outdated value by reading from system property, because the
update is not handled yet. Then wrong time will be displayed on
status bar.

Change-Id: Ic29b7940b58e01651da4e0bafa7a88b902164bd0
Signed-off-by: Gao,KunX <kunx.gao@intel.com>
Signed-off-by: Guobin Zhang <guobin.zhang@intel.com>
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>
Fix progress of VolumePanel never refresh

On some occasions when disconnecting a headset it is possible for
the volume slider to enter a state where it is no longer updates.

The cause was that ProgressBar enters a state where a call to
doRefreshProgress no longer updates the progress.

The solution was to make sure mRefreshIsPosted is set to false
when mRefreshProgressRunnable is removed.

Change-Id: I1929e4916a582d09a7ec4911eb4f0052ad7a51ba
NsdService does not clean up after exiting clients

When a client of the NsdService exits, NsdService should
clean up the requests it has sent to the mDNS daemon:
cancel any pending resource-discovery and resource-resolution
queries, and remove any services registered by this client.

If this isn't done, several bad things happen. The daemon will
continue to run unnecessarily, will report service discoveries
that can't be forwarded on to the client, and will continue to
advertise service ports for an application which is no longer
running until the device is rebooted (mDNS pollution).

Bug: 9801184
Change-Id: I0aa7311480322aefcff16f902fbbf34f50985d38
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>
Fix to memory leak leaving WallpaperCropActivity.

After running wallpaper cropper serveral times it crashes with
an OutOfMemotyException.

When leaving WallpaperCropActivity all textures are leaking until end
of process lifetime. This is due to a missing call to function
TiledImageView.destroy which in turn assures TiledImageRenderer
releases held resources.

Resolved by assuring WallpaperCropActivity calls TiledImageView.destroy
from WallpaperCropActivity.onDestroy. In case where onDestroy is not
called resources will be released anyway by process being brought down.

Change-Id: I016b1b9da5f4db8d2b14767edb59fe742415e074
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
WindowManager: Turn on slow screens way faster

This has been tested on several devices, and many (like the Galaxy Note or Optimus 4x HD) woke up from deep sleep way faster than before.

Change-Id: I1b829f43db9147647e85ae45bb6bcaa0b6eccb29
Fix null check for BaseObj.equals.

Change-Id: I4f060697db175cbf0b5617c1220db853bbe53f1f
Avoid duplication of AppWindowToken in created Task

When WindowManagerService creates a new Task, it passes atoken to the
Task constructor. In this case atoken is added to mAppTokens list by
the Task constructor and then it is added manually again by calling
newTask.mAppTokens.add(atoken). As a result, the same atoken is present
in mAppTokens list twice.

When another window token is added to the list, it may be placed in
beetwen duplicated tokens and corresponding window will be hidden from
the screen by corresponding duplicated windows.
From user perspective it means that some windows will not be displayed
on the screen.

The issue is fixed by avoid adding atoken to mAppTokens list manually
when it was added already in Task constructor.

Change-Id: I10628e68186160fffdde07beb7d84ab3cecb7051