Revert "HeadsUp: Clean up."

This reverts commit 0d34f3a00b072fdc8f4fb1e3eeac3b69b19c15c2.
Revert "SystemUI: Expose heads up."

This reverts commit 2703ce04ead56d15e950eaf951929e474f4df67e.
Revert "GEL Integration (1/3)"

This reverts commit 55217dd2b72d62217e2e01cab1fe921f7fadffc1.
Wifi: Use bss->age identifier for wifi scan results

This value will be used as "timestamp" and Google Play Services
uses this value for identifying sane wifi scan items.

The current timestamp (tsf=) has a different meaning, which causes
the Google Location Resolver to ignore all wifi scan entries and
therefore no location can be resolved.

This solution is already done on batched result parsing, but
missing on the traditional scans.

Change-Id: I36a1aeb666379e6a010298f09161e971012db83f
MountService: Handle UUID in list response

Change-Id: Ifee8905ae01c17c79b218ec131650c25f6e977d6
Revert "Add UUID (re-)scan support for vold-mounted volume (1/2)"

This reverts commit 6758b062d272cb09e8014115865e2e7cf7a9b79b.
PackageManager: Add option for single threaded dexopt

* Execute all dexopt invocations on the main thread instead of using the
  ExecutorService when persist.sys.dalvik.multithread is set to false.

Change-Id: I3b8499d5af5091ad7abcddf006f8f2837943903b
Themes: Use first asset entry for lockscreen wallpaper

The current implementation assumes the wallpaper will be named
either wallpaper.png or wallpaper.jpg.  If this is not the case
the wallpaper is not applied.  This patch implements the lockscreen
wallpaper the same way that the regular wallpaper is done.

Change-Id: I9f3dd299c1e61158fa53c163f7e42e21e2f9b1dc
Themes: Use default_wallpaper for HOLO lockscreen wp

Change-Id: I9c7fd29c99d13e811993eb9b3b045010431ccad0
Implement DocumentsProvider.createDocument and deleteDocument

Fixes AOSPA-431
This is needed to delete and create files/folders in DocumentsUI.
Some open questions are:
1. Are the methods implementented according to their description?
E.g I'm not sure whether deleteDocument should be able to delete folders, too.
2. I first didn't want to modify public API, but deleting files from within DocumentsUI somehow doesn't work - file.canWrite() always returns false
3. So is modfying the API this way OK?

Change-Id: Ie3a9d1888decaa0f08de1a5183ffd23760be15b9
BatteryStatsImpl: Avoid memory corruption due to Parcel Recycling

While processing batterystatsfile, in present code there is a race where a parcel
might be recycled while it is being written to disk in another thread.

The write process is done in 2 steps:
- write into a Parcel (memory block)
- then write this Parcel to disk using Journaled API.
The Journaled API ensures robustness against file-system issues due to power cut.
The writing is done in batch using a thread running commitPendingDataToDisk().
This function writes the parcel to disk but this parcel is a global variable
initialized by writeLocked(). If the writing takes too long time and two write
threads are launched, the parcel is freed by the second writeLocked() call;
which could cause the memory corruption.

Hence, change global Parcel variable by a Parcel parameter to commitPendingDataToDisk()
and only this function will be allowed to recycle the parcel.

Orig-Change-Id: I0e76441399f1ce74b83566edb8cf4f977dce58bf

Change-Id: I1884141d7d9c61601e2c8e07523a6e9aa6709afc
Signed-off-by: Pavan Kumar S <pavan.kumar.s@intel.com>
Signed-off-by: Jian Luo <jian.luo@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 47466

Conflicts:
	core/java/com/android/internal/os/BatteryStatsImpl.java
NsdService: Fix retrieving the client id

SparseArray.indexOfValue() doesn't work properly on Integer
objects, because its doing an Integer == Integer comparision.
This works for the first 127 client id's due to the boxing
implementation having static Integer objects from -128->127,
but fails on the 128th.

Walk through the clientInfo.mClientIds array manually instead.

This fixes exceptions in NsdManager of the pattern:
FATAL EXCEPTION: NsdManager
java.lang.NullPointerException
     at android.net.nsd.NsdManager$ServiceHandler.handleMessage(NsdManager.java:367)
     at android.os.Handler.dispatchMessage(Handler.java:99)
     at android.os.Looper.loop(Looper.java:137)
     at android.os.HandlerThread.run(HandlerThread.java:61)

due to the client id/listener being -1.

Change-Id: I02a5392fb81f37f5da32f6e7d4619ace1ea6a0ef
Fixed VM memory leak in AudioSystem JNI interface

The function android_media_AudioSystem_error_callback from AudioSystem
JNI interface is using FindClass function but does not delete the
reference created by VM in this function.
By doing this call, VM will add a local reference in IndirectRefTable
and it's the caller's job to delete this reference.
By not doing this, everytime this callback is called, a new reference is
added and never deleted.
The effect is crashing the VM running system_server:

E/dalvikvm( 3071): JNI ERROR (app bug): local reference table overflow (max=512)
W/dalvikvm( 3071): JNI local reference table (0x732da288) dump:
W/dalvikvm( 3071):   Last 10 entries (of 512):
W/dalvikvm( 3071):       511: 0x42a90008 java.lang.Class<android.os.Parcel>
W/dalvikvm( 3071):       510: 0x4381fd90 android.view.KeyEvent
W/dalvikvm( 3071):       509: 0x439b9808 android.view.KeyEvent
W/dalvikvm( 3071):       508: 0x42d2fe18 java.lang.Class<com.android.server.input.InputManagerService>
W/dalvikvm( 3071):       507: 0x42ad4298 java.lang.Class<android.media.AudioSystem>
W/dalvikvm( 3071):       506: 0x42ad4298 java.lang.Class<android.media.AudioSystem>
W/dalvikvm( 3071):       505: 0x42ad4298 java.lang.Class<android.media.AudioSystem>
W/dalvikvm( 3071):       504: 0x42ad4298 java.lang.Class<android.media.AudioSystem>
W/dalvikvm( 3071):       503: 0x42ad4298 java.lang.Class<android.media.AudioSystem>
W/dalvikvm( 3071):       502: 0x42ad4298 java.lang.Class<android.media.AudioSystem>
W/dalvikvm( 3071):   Summary:
W/dalvikvm( 3071):       510 of java.lang.Class (3 unique instances)
W/dalvikvm( 3071):         2 of android.view.KeyEvent (2 unique instances)
E/dalvikvm( 3071): Failed adding to JNI local ref table (has 512 entries)
...
E/dalvikvm( 3071): VM aborting

In this case, PID 3071 is system server.

Change-Id: I0c113eb72256984854d59a3ccef11a8d23f96e79
Signed-off-by: Robert Chiras <robert.chiras@intel.com>
Ensure to add persistent apps to LruProcess list on app restart

This change will ensure to add Persistent Apps to mLruProcesses
if not already present while restarting.Previously, on some
occasions, the process was not getting added to the list
resulting in SecurityException as this process was not found
in the mLruProcesses.

Change-Id: I26813a794e01aae316dffd3cf2bb38ab66ac69a9
Set an enough dirty rect for a magnification's boundary line

When using accessibility mode magnification gestures inside
a video artifacts are left on the screen when magnification
is shrunk. It's caused by an incomplete dirty rect.

1. Turn on magnification gestures (in accessibility menu)
2. Play a movie
3. Tap on the bottom of the screen 3 times to zoom.
4. Tap screen once.

The menu buttons will appear, but they will have artifacts from
zoom rectangle drawn on top of them.

The dirty rect is lacking 1 px when a width of the boundary
line is an odd number. It's calculated by the round-off half
of the boundary width.

This change solved the lacking 1 px.

Change-Id: I87f705f239babdb60a5029fd69107501bbab949a
Fixing parcel leaks to avoid virtual memory leak

Client has to call recycle() on parcel object after its usage
otherwise native layer of binder won't clear the resources of
parcel which were allocated for IPC

Change-Id: Ib31ddcc92aa4ebd80bb66729922b9133692e9c9e
[Asset Manager] Fix memory leakage bug

Symptom: memory leakage
Root Cause: new SortedVector but not free it in native cpp
Solution: free the SortedVector
Project: AOSP
Note:

Change-Id: Iab5a7f2e8d8509631301e7231427927d4797c856
Remove some pointless code.

Unnecessary disk reads for values that are never
used (and cached elsewhere, so that optimization is
rendered pointless).

Change-Id: Ic14a8b53a96908bb03eae28759d7be2c217e8125
update parameters in uploadToTexture() for GLES20

Google optimized the uploadToTexture with GLES3.0+,
This allows us to upload a sub-rectangle of texture,
but this has compliance issue with GLES 2.0.

With OpenGL ES 2.0 we need to copy the bitmap in a
temporary buffer if the stride doesn't match the width,
and then upload entire temporary stripes.

Change-Id: I8987cd8347913c61b7fa45bd47be1189aa6bdb05
Signed-off-by: Shenghua Lu <shenghua.lu@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Guobin Zhang<guobin.zhang@intel.com>
Fix the texture ID reuse issue in HWUI.

Issue: When the layer of previous frame is destroyed, it doesn't clear the
texture id in mBoundTextures[mTextureUnit], so in the next frame, if
glGenTexture returns same texture ID of the previous frame,
the new texture is not bound.

CRs-fixed: 671736

Change-Id: Ifc5fd2115fb1863b3c006ab14b0faabeaeb4eab4