Monitor device storage directly in /data/data

The DeviceStorageMonitorService watches over /data, and when things get
full, starts deleting app cached files.  The app caches are actually
under /data/data, which on DINC is its own mount.  This means the
monitor did not notice when app cache grew too big, as it only saw the
size of /data proper.

This patch makes the monitor look at /data/data instead.  For DINC, this
means it can properly manage app cache, but it won't notice if the upper
/data partition is getting full.  That's not as common as /data/data
filling up though.  For the Samsung devices that mount a /datadata and
then symlink to /data/data, it should also work, as statfs dereferences
links first.  For all other devices with only /data, reading statfs on
/data/data still yields the total/free sizes of the /data partition.

(cherry picked from commit fc99763ade87f9943b2fbfb2e81fb3401998cd2d)

Change-Id: I85ed6486c1085c4de2f5a7e825709f01d8cc8cba
installd: Delete cache properly for devices using datadata partition

The java side already checks /data/data for free space but installd
still checks /data causing it to never reap the cache (because it
thinks that enough free space is available.)

Change-Id: I191f3ceb84df1101ab2918ec0038213d72ec1ce2
frameworks/base: Increase the buffer size to hold the whole content of the file.

When we have more cpufreq steps and cpufreq's time_in_state stats file
can grow beyond 256.

This buffer size was not enough because the file has more than 300
characters. So it read part of the file and the parsing failed.
This runs from ActivityManager, so when the ActivityManager dies
framework reboots.Increasing the buffer size will help use to get
the whole file into the buffer.

Change-Id: I3f95dc7534fdaf5e139966c0d1be8d79d6413a0f
Extended Power Menu: Initialize reboot reason to the first reason

Without doing this, the string "null" will be sent to the reboot command
and can cause the reboot recovery pre-command to get confused on devices
that use it. (On Galaxy S, it will default into booting into recovery)

Change-Id: Ic928043b1c32fa844d63a20a021867ae048f6111
fw/base: enable pwr btn instant lock settings for slide lock type (2/2)

  *companion commit in Settings

Change-Id: Idf07fa620c74ebfcf60bedcb1af336c9f65babc5
Adjust kernel data stack TCP parameters to optimize performance

Enhance Android MobileDataStateTracker class to identify technology
EVDO rev B separate from earlier releases.  This permits use of
separate TCP buffer size for higher bandwidth technology.

Change-Id: Ib8dfa315c4485c36c66b2c66950c42ccb81fe9e5
CRs-Fixed: 260740
Separate configuration of auto-brightness for button/keyboard backlights.

Presently, light-sensor based automatic brightness
(config_autoBrightnessLevels) controls both button and keyboard backlights
in addition to the screen backlight.  Unfortunately auto-brightness for
button/keyboard backlights doesn't work well on devices (e.g., epicmtd)
with neither (i) dimmable button/keyboard backlights (so when they're on,
they're very bright even if the screen backlight is relatively dark) nor
(ii) identifiable surface features on capacitive buttons (so they can't be
found if the backlights are permanently turned off).

For these devices, the non-auto-brightness behavior of button/keyboard
backlights, whereby they turn on during screen-on events and user activity
and timeout-to-off shortly thereafter, is preferable.  Thus, this commit
adds a config option, config_autoBrightnessButtonKeyboard (defaults to
true), that when disabled allows for automatic brightness control of the
screen backlight, but retains the timeout-based behavior for button and
keyboard backlights.

Also addressed is a bug that disables the button and keyboard backlights on
screen unlock, and reenables the backlights on touch events so that
capacitive keys may be located.

Additional fixes for button/keyboard backlight auto-brightness.

- Use sensor-determined brightness values when the button and/or keyboard
  lights are on, even if button/keyboard auto-brightness is disabled, since
  users may want to specify a custom brightness setting that disables the
  button/keyboard backlight entirely in low-ambient light situations.

- When button/keyboard auto-brightness is disabled, don't update button and
  keyboard brightnesses immediately if ambient light (the sensor) changes,
  as this may reactivate these lights after they've turned off in absense of
  user activity.  This is a particular problem when watching video or other
  circumstances when the lights are not expected to reactivate.

Change-Id: Idb26aa907ce4b04fb1f52a884e4e5bcb40fe695f

Conflicts:

	core/res/res/values/config.xml
	core/res/res/values/public.xml
Prevent empty overflow popup when there are no overflow items.

On a device with a hardware menu key, an empty overflow window can be displayed
if there are no items in said overflow menu. This leads to the next user touch
being swallowed in the action of dismissing the invisible window.

Change-Id: I9191e4b2e1ed4888e4bc7261e8b3f095a272a9b5
Possible NullPointerException in restorePanelState

curFeatureId is just an index in a cycle and can not be used for getting an object. May get null that will cause NullPointerException. Solution is to use key to get an object from icicles.

Change-Id: I61d5c6bd1c3226a993f60efa74872995ba0e42ac
Fix off-by-one error when filtering application UIDs

A filtering check in writeLPr() mistakenly includes the first application UID
(10000) with the result that the package with UID 10000 is missing from
packages.list. This patch fix the error.

Change-Id: I3651beb346290db8e09317391b95a77aed1946b6
Signed-off-by: Magnus Eriksson <eriksson.mag@gmail.com>
Fixed group and child view caching in SimpleExpandableListAdapter.

Now the adapter reports the correct type count and type for group and child
views by overriding the respective methods from the base class. Each group
view has two types, one for expanded views, one for collapsed views. Each
child view has two types, one for the last view within a group, one for the
other views within a group.

Change-Id: I117b2c0f7e98fb7fe2fdd35c15f7d1f9dc06674f
Signed-off-by: Georg Hofmann <georg.hofmann@gmail.com>
Build overlay packages just like regular packages.

Previously, building overlay packages required passing aapt its -o flag.
This commit decouples the idmap generation code from the effects of the
-o flag.

Since this commit renders the -o flag obsolete, support for the flag was
removed from aapt as well.

Change-Id: Ied2e0ab8cb800e49623f0a2044b06cd4935473d5

Conflicts:

	libs/utils/ResourceTypes.cpp
Runtime resource overlay: clean-up.

This is a combination of three minor clean-up tasks:

- Generate correct idmap even if name lookup fails:

  Any resources following a resource with a spec but no actual values
  would receive an incorrect ID in the idmap due to an accumulating offset
  error. To combat this, a dummy value is inserted in the idmap whenever
  a resource with a spec but no values is encountered.

- Optimize pruning of padding zeroes in idmaps:

  Earlier, trailing zeroes were iteratively popped from the end of each
  type block of an idmap. This commit instead tracks where to make the
  cut, and does so with a single function call.

- aapt: warn about resources which lack values:

  The resource framework assumes every resource to have a value for
  at least one valid configuration. However, if multiple resource
  directories are used (several -S options to aapt), the list of
  configurations is limited by dpi (-c option to aapt) and a resource
  is only available in discarded dpi configurations, aapt will create
  a resource entry where each configuration lack an actual value. This
  commit lets aapt emit a warning whenever this has happened.

Change-Id: Ic7451b7f4adfef5bfa6b0d7e64e057f317a2cdaa

Conflicts:

	libs/utils/ResourceTypes.cpp
Improve robustness of resource overlay test suite.

Test runner will now create directory /vendor/overlay/framework, if
missing.

Also, move wallpaper from drawable to drawable-nodpi for it to actually
take effect on ICS code.

Change-Id: I7615345e847c5fca91aedc459f6aa3316a45aab5
String on Toast notification does not aligned to center

If length of the string being showed on Toast is short (less than 8 chars),
it is aligned to left rather than to center.
Added attribute android:layout_gravity="center_horizontal" on the TextView where Toast's message are shown to fix issue.

Change-Id: I77669fd8a11d1ec8f6b082348eb818671ce158bb
Signed-off-by: Taeho Kim <jyte82@gmail.com>
Wipe the user data out in any case.

When the external storage is not mounted, the android system won't
wipe out the user data (i.e. "/data") if wipeData() is called with
the flag WIPE_EXTERNAL_STORAGE.

We think that the user data should be wiped out in any options and
also wipeData(int) method currently supports also for a external
storage. So we will also change the API reference comment.

If we should care about backward compatibility of this method behavior
with the option WIPE_EXTERNAL_STORAGE, then we would add an another
bitmask something like a ALWAYS_RESET.

Change-Id: Id7bf673c722bacc0480d32e46553b9a348513879
MountService: unlink death notification when unregistering listeners

Change-Id: I09045cfe67f7da84bc68a50fc5440ea2c6b754e5
Fix dumpPowerState method

dumpPowerState method shows the current power manger service state but,
BUTTON_BRIGHT_BIT is omitted.

Add a routine of checking BUTTON_BRIGHT_BIT
Signed-off-by: jaiyoung.park <jaiyoung.park@lge.com>

Change-Id: I00484fb384963bafdc58ce89b3251a1f5585d992
Performance: Activity manager perf unnecessary recalc of oom_adj

If an activity has bound servicesor content providers,
updateLruProcessInternalLocked will be called recursively with
the oomAdj flag set, resulting in several recalculations of oomAdj
with unchanged data. Doing it at the end of the top level call to
updateLruProcessInternalLocked should be sufficient.

Change-Id: I95e27011e1d3519f256a9bd756cbb18d43e8db29

Conflicts:

	services/java/com/android/server/am/ActivityManagerService.java
Fix Force Close when enable airplane mode

In GSMPhone handler for message EVENT_RADIO_OFF_OR_NOT_AVAILABLE,
the for loop was trying to remove all pending MMI code starting
from the index 0 of the ArrayList mPendingMMIs. When mPendingMMIs
has more than 1 item in the list, after the 1st one in the list was
removed, the rest in the list were shifted. The 2nd one became 1st.
Assume the list size is 2, if now the for loop goes to index 1,
access to mPendingMMIs.get(1) will result a null pointer access,
and cause a Force Close.

To fix it, make the for loop to begin with the last one in the
ArrayList mPendingMMIs.

Change-Id: I3e60086186851b1d6c10fefdb086aa0ae3e16048