base: MediaScanner behavior on boot (1/3)

Lets you enable/disable/ask (with a notification) media scanning on boot.
Can speed up boot and reduce initial boot lag from MediaScanner

Change-Id: I634ae96b1dcb493b966b4653589cd97523b63da7
Prevent MediaScanner infinite loop with invalid path

including double slash  "/storage/sdcard0/xx//xxx/xxxx"

Change-Id: I112a70c88b5ec662482b79c3151310b9b9b52e40
[Revert] Change density on the fly

Change-Id: Ic2c81a4f8fbdb6bc775faa25d24d8bc3a7d85d2f
fb: TRDS 3.0 and new theme engine preparation (1/4)

For the one who do not know this feature see as reference
the first two versions here:

https://github.com/SlimRoms/frameworks_base/commit/b330fde28306286572ba390e451a72539c0c3576

https://github.com/SlimRoms/frameworks_base/commit/3194015737b7944b4185fca007b8d167a0675cd8

we got now over a year now a lot experience how to handle the qualifier fallback
as well how to theme it and how to handle other apps. Based on this knowledge we
redid some parts of TRDS engine with following new features/additions and fixes
to have now a final perfect working TRDS

- compared to the old versions where it was needed on some apps to restart them
  in background this is not needed any more. All is handled about the internal
  AOSP resource handling and on qualifier change the caches are cleared
  and the apps get an onconfigurationchanged to restart the activity
  like it is doing on orientation change eg
- inverted folder is now depreciated and the new folders are holodark
  and hololight which allows on the one hand a dark theme (at least
  how TRDS started) and a light based theme hololight
- This name change is mainly because of the new theme engine which
  will come which uses this as base to add 2 external themes at the same
  time and give the user the ability to switch between them. But this is
  still in early stages and this commit is just the preparation for it
- Two new automodes are now integrated. User can enable the twilight modus
  which enables/disables holodark/hololight depending on the daytime...means
  on the evening it switches to holodark on normal day it is hololight.
  The other automode is based on light conditions....means that if it is
  dark outside it switches to holodark....if we have bright light conditions
  it switches immediatelly to hololight. Due of the resource cache handling now
  this happens immediatelly for the user and feels completly system integrated
  and happens without delay. A bit comparable to some navigation tool for cars
  which can switch automatically from dark to light and back
- currently the auto modes as well the manual mode switches between holodark
  and hololight. Due that we do not have currently anything hololight themed
  in the source hololight = stock theme. We will give the user the ability
  later when done to choose between which modes the user want to switch
  (stock/holodark/hololight). But this does not make sense at the moment.
  As soon as we have done the light theme or theme engine (lets see what
  comes first) we will open the ability to choose it. This is only a small code change
- a lot small tweaks and fixes went as well into the new version

Whatever this commit as usual adds the support for it. The themeing is done in the
other commits by kroz which is as well way more extended then on the older versions

cheers

PatchSets:
- minor code cleanup

PatchSet5:
- use one value for auto modes

PatchSet6:
- kill resource caches on configuration change

PatchSet7:
- register settings observer lol

PatchSet8:
- fix not assigment of config mode change (typo lol)

PatchsSet 9 -11:
- playing around aosp qualifier is not that flexible then I thought
whatever back in most parts to original implementation handling

PatchSet 12:
- now no restarts of any application needed any more like it was on 4.3...yeaaah
- fix wrong shifting in native adapter
- fix wrong call of twilightmode
- disable debug
- cleanup

PatchSet 13:
- fix lightsensor

Patchset 14:
- no need currently to recreate the navbar we can do if a theme needs it

Patchset 16:
- synchronize on sending config change
- only send if system is ready
- fire first update when system is ready

-rebase

Change-Id: I12f0900090f1ec3ed002d63d4260a8080aec077e
fb: TRDS dark base theme

Change-Id: Ie25abfbf5258ac479ca8bc91033f6892bbbc6741
fixup

Change-Id: I2453718ea8bb198815c2bab187cda852d46a8bb0
TRDS: Dark DocumentsUI

for Downloads app

PS:
- fix settings

Change-Id: I87d49e97b8a0a67bd4d85f0137eb0960155428cb
Improve AOSP Download/Upload animation

This increases the number of png required for a full download/upload animation cycle.
These new png makes the animations much smoother.

Change-Id: I7120d757782e797809bc97747127c6a0cc36f2fe
Fix to NullPointerException on move back in ActivityStack.

In ActivityTask.moveTaskToBackLocked NullPointerException may occur
when moving back with only current Activity in stack. This due to a
condition that may trigger despite a TaskRecord being null and then
attempt accessing the TaskRecord.mOnTopOfHome variable.

TaskRecord task may be set to null when no resumed activity remain.

Resolved by assuring that flag mOnTopOfHome is instead set to false
for current TaskRecord in case where there are no remaining activities
above home.

The above bug has already been corrected in the following commit,
ada62fca51d314cefe2c5da4e007df5b9abf320d, but it does not set the
cottect value to mTopOfHome for the current taks, see below.

Variable mOnTopOfHome will not be set to false in situations where
stack is of size 1 or less and task is null, perhaps from already
having finished current activity.

To avoid current TaskRecord maintaining value mOnTopOfHome to true
after launching Home this variable is set to false.

Impact should not be major due to correction earlier that makes sure
that there is always a TaskRecord.mOnTopOfHome set to true above Home
activity but if not correctly set for current task still gives a
possibility of bad behavior.

Change-Id: Ie86ad99c188aaa05b0de9d58eaa16c42b6fc4341
MediaDrm#mNativeContext is a long, not int.

Therefore, we must use SetLongField and not SetIntField.

Change-Id: I2a805dd6b7c8e4905e742d8632d941f381a05930
audio: Set slient persist property according to ringer mode

Update the persist.sys.silent property when setting ringer mode.
This property could be used by the native layer application.
Example:
Bootanimation could check this property to decide whether
background music is needed.

Change-Id: I64311fcac9d4c3729b38fc2b597dc478d6de4d7c
NetworkPolicy: Validate policy templates before updating

Ensure all the policies to be added are validated, otherwise
this service will throw IllegalArgumentException and cause
system crash when updating network template after receiving
ACTION_NETWORK_STATS_UPDATED.

Change-Id: I3faef0ac2a2fcea64ba5dde9c9256f6714280e2e
CRs-Fixed: 561490
Network stats: use number formating based on android code

Uses logic from Formatter.formatFileSize

Change-Id: I9008df0e90fbaf8d733cfd853dc1ef6160cf67f5
Signed-off-by: Dirk Rettschlag <dirk.rettschlag@gmail.com>
Don't show Netstats when there's no traffic

Change-Id: Ie90caabd52dcfb6889cf26da37d7c57974993ffb
Merge in a lot of VANIR fixes and improvements

Thank you guys a lot you're awesome!

eb605813aae3058ef8d111722c5584a867de1df3 improve rotation handling
ed2e8f9ff28a329d4cdb56d49437db3495aa22a2 Forward compatibility fixes
6eb657f2882478f1f327f4ec8ebc945022d4f924 Forward compatibility fix
9ce50c5d886c3d012002699ded8f85380b02d3a6 Missing break in switch statement
5f48acfdd1b3dd0ba9ae41b3a10ac60de267f98c Prevent nullPointerException by updateBondedBluetoothDevices
d9d59b2e1c82f8683e559539501059850ba65f4c Fix to NullPointerException when activity is relaunched
dcd7f57582c39d1eab60408d54a80e1636711ede make WidgetView observer private
0f48310bdb6c8e8d4801c7cc7bdae27a63d6c223 Fix for NullPointerException in HTML5VideoViewProxy
98871cb5a3a1863bacf221589799e0d699265fc2 Selectively restore non-stupid parts of stuff we had before a patented nuclear decrapificating
1cdfaee436b9e38039e8c6a4e92fa6f026886029 build core/jni with fstrict
a7ea71d7b05432ecbcb2b50ba39796d6dabbdb4d services: make sure to recycle set args
6384e8636d55b59e7e6e3e3e6e55eaeeeb5c703a potential GraphRunner leak in camera effects
c2e8755decaf0f9b6b3e5ad4e499388385a2b873 Fix unresponsive home key after waking device with a long press
bed41b9bf1864b8c7e2c3e48dce3cf1cda46e198 Hide traffic on lights out
eb605813aae3058ef8d111722c5584a867de1df3 improve rotation handling
ed2e8f9ff28a329d4cdb56d49437db3495aa22a2 Forward compatibility fixes
6eb657f2882478f1f327f4ec8ebc945022d4f924 Forward compatibility fix
9ce50c5d886c3d012002699ded8f85380b02d3a6 Missing break in switch statement
5f48acfdd1b3dd0ba9ae41b3a10ac60de267f98c Prevent nullPointerException by updateBondedBluetoothDevices
d9d59b2e1c82f8683e559539501059850ba65f4c Fix to NullPointerException when activity is relaunched
dcd7f57582c39d1eab60408d54a80e1636711ede make WidgetView observer private
0f48310bdb6c8e8d4801c7cc7bdae27a63d6c223 Fix for NullPointerException in HTML5VideoViewProxy
98871cb5a3a1863bacf221589799e0d699265fc2 Selectively restore non-stupid parts of stuff we had before a patented nuclear decrapificating
1cdfaee436b9e38039e8c6a4e92fa6f026886029 build core/jni with fstrict
a7ea71d7b05432ecbcb2b50ba39796d6dabbdb4d services: make sure to recycle set args
6384e8636d55b59e7e6e3e3e6e55eaeeeb5c703a potential GraphRunner leak in camera effects
68dfb6b493863aba26074c862e44f3af10f2f61f DeviceKeyHandler squash
c2e8755decaf0f9b6b3e5ad4e499388385a2b873 Fix unresponsive home key after waking device with a long press
35bc0f31e5967b59c7c83a33238a22e611c077a0 PhoneWindowManager: Hardware key handling fixes and cleanup
838f7ebfabc91f4ab2065af46a40cc6c9167a5a5 Fix hardware home key behavior on wake-up
a73132ad1635267886d4969e410723ab18dbb846 Fix ordering of home keypress handling
f84f26bb91c387762cf3048dc2a85dbd59703027 statusbar: performance and fixups
cc104e3cccf3901da2b2040f77fe0f08706c2ed5 interrupter: Use LOCAL_LDLIBS rather than LOCAL_LDFLAGS
44dfffa26e14aee1a9d12c1edc211d40467a4124 Don't unnecessarily recycle things.
d24d56509fcbf88a3bba0177c3721ad253ccad34 Correcting NULL pointer when callerApp is not set
05a382390cde82461d8f53f63d0cb12ce7c55dbd l'oops: fix inputservice ANRs
fa7bd7f869cef7534ed8b6616c5874afbd4b72a5 don't register a content observer if the device is already provisioned
bf0b5c820243ffa101e9f43fa319570fd72d8d03 Privatize PhoneWindowManager
f53da810731f654fa712487f2f468c5b81b816a5 Reduce EntropyMixer seed size from 4096 to 512 bytes.
1f734ecc9714c2e5ee56b6f17c9a35598dab5c0d frameworks: squash of leak & race fixes
97d08382cd97756c4497389baaed89575810a78e Make ActivityManagerService.systemReady thread safe
c5f90b9bd64a99ffc49fc96b1a066a675069899b Don't ANR when no windows are touchable.
95552ef44afb48052c97dd3b76eb020ff8319700 Avoid IndexOutOfBounds Exception in ActivityManagerService
13b6f23037905ad6cb8538490fcdd47e7bcc26cf Scroll: modified velocitytracker
3ea66792ae162eeafeecc50c858cbe4162248297 recycle TypedArray calls in F_B
4ae81b789e309bf14ae8b8851e5e2df51d12a98d privatize keybuttonview
148ec969b96ea67de9fa2d27b4f5c0298cd74d8c If frameworks wants ASCII casing, it should explicity ask for it.
0ccacb22858eb47946a8f4cda0f50d0dcb17bb65 onSavePassword dialog can leak when WebViewClassic is destroyed.
ac7d546dc6ff67d325a205599edb12bb9cd23bd8 Fix issue #10226007: Reset apps restores most of the changed settings...
63aa94ff65d5ce93c23502136e154fa10db516e2 base: App crash when select suggestion's length more than specified.
560ab7cb9c53739df53c1869350bf78312ffe9c2 Remove useless import statement
3851a0951ea20c64164f5fa9c08ab7476c7d7a45 aapt: set interlace handling for png_read_update_info
ea15b65b7eadd1f769a90f517244f7f45d0f1068 Memory leak: parseObbFile.footer
0d32d6d57709b329eeae965c4badd3df44d60946 GlobalAction dialog ref not set to null
60293f9c8fa23ea8d42ac4b9d74b78ca9a386c5a Follow convention for localizing DB and NET strings
6df4d75495677f8e8e86d8b17877d6d2acf7a8fa Restore previous ViewConfiguration constants

also fixed the traffic meter on lights out

and updated the phone windows manager to match cm their custom keys system

Change-Id: I205a2add9f226913b16d6e8f04335819dda05e29
services: don't clear wallpaper when SystemUI
disconnects.

When we restart SystemUI (or the user), sometimes
the wallpaper would get cleared. This patch just
captures its originating component and
if that is our SystemUI component, ignore the event.

Change-Id: I3e159dc2c013e7d7e552e3c0cef55e3ab970ca87
Signed-off-by: Roman Birg <romanbirg@gmail.com>
fix possible buffer overrun and memory leak

Use snprintf instead of sprintf and fclose() before return.

Change-Id: I3ed193464cc0dc90e9935ae19162667ad367628b
frameworks: Smooth background gradient

Credit to UBER for the images

Change-Id: I3655e9917610348100fa6cb5cede66a63ca82538
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
Remove Slims Wallpapers

Change-Id: I6c7db61c89c9a4efaad9bb65552cd0799ff10c51
Signed-off-by: Lokesh Chamane <lokesh.c703@gmail.com>