Keep deleteIntent when copying Notification attributes

Ensures that any previously registered deleteIntent is retained after a call
to Notification.setLatestEventInfo().

Currently, a call to setLatestEventInfo() effectively erases a previously
registered Notification.deleteIntent, which results in the app never being
notified when the user dismisses the notification.

This issue is described in detail in #73720:
https://code.google.com/p/android/issues/detail?id=73720

Change-Id: Ie58bf6a310058d40beb0d1af6506e9e1f4324b37
Signed-off-by: Sean Barbeau <sjbarbeau@gmail.com>
[ActivityManager] Avoid system server crash due to package removed

Symptom:
When application is not responding, an ANR dialog will shown.
In certain timing, user uninstall the application when the ANR
occurs, but before ANR dialog shown. The system server will crash
when looking up the errorReportReceiver because the package is removed.

Here shows how the exception occurs.
java.lang.IllegalArgumentException: Unknown package: app.package.name
 at com.android.server.pm.Settings.getInstallerPackageNameLPr
 at com.android.server.pm.PackageManagerService.getInstallerPackageName
 at android.app.ApplicationPackageManager.getInstallerPackageName
 at android.app.ApplicationErrorReport.getErrorReportReceiver
 at com.android.server.am.ActivityManagerService.startAppProblemLocked
 at com.android.server.am.ActivityManagerService.makeAppNotRespondingLocked
 at com.android.server.am.ActivityManagerService.appNotResponding

Change-Id: Iced4287bd44dc25b1db2c1e3a583892eb6c041a2
RRO: reintroduce lost ResTable insert of assets

With the recent introduction of AssetManager::appendPathToResTable,
overlay packages were not properly added to the AssetManager, and once
added, were not properly inserted into the ResTable.

Bug: 17765434
Change-Id: Ie21f227c654c98730f74a687d0e16ee2b80e747e
RRO idmap: pad with 0xffffffff, not 0x00000000

In the new idmap format (version 0x1), 0x00000000 no longer represents a
non-existing entry: 0xffffffff should be used instead.

Bug: 17765434
Change-Id: If2c7e09feba2224eeafe88fd9230e6392d81b9a7
Consider RTL layout in DPAD navigation in AbsSeekBar

Changes the behavior of onKeyDown for DPAD_LEFT/RIGHT when in RTL
to move the progress in same direction as the DPAD key suggest.

Change-Id: I776a48711571884a10ef9315de78bf4ebffd6e4b
[ActivityManager] Ensure provider external access count will be released.

Sympton: Oom-adj of provider process will be always 0.

Root Cause: Exception happend in openContentUri
may not call removeContentProviderExternalUnchecked.

Flow:
application [MediaPlayer.setDataSource(Context context, Uri uri)]
    uri is invalid, IOException will be caught and below log will appear:
    "Couldn't open file on client side, trying server side"
    Continue to call setDataSource(String path, Map<String, String> headers)
 ->mediaserver [MediaPlayerService::Client::setDataSource]
    setDataSource(httpService, url, headers) calls openContentProviderFile
 ->system_server (ActivityManagerService) [openContentUri]
    Increase externalProcessNoHandleCount for media provider.
    Call [openFile] to media provider.
 ->android.process.media [check permission for openFile]
    enforceReadPermissionInner
 ->system_server [checkComponentPermission]
    Use mediaserver's uid to check READ_EXTERNAL_STORAGE
      -> not granted due to it is pure native process, not a known package.
    Throw security exception then the flow of openContentUri is broke.
    And externalProcessNoHandleCount is unable to decrease.

Application sample code:
 String invalidId = "54321";
 Uri externalUri = MediaStore.Files.getContentUri("external");
 Uri uri = Uri.withAppendedPath(externalUri, invalidId);
 mediaPlayer.setDataSource(mContext, uri);

Solution: Move removeContentProviderExternalUnchecked to finally block.

Change-Id: I75eec1f9631e9c6bb18449946d707d51ac21e8a7
Added Razer USA, Ltd serval

Change-Id: I76b7c36068c3d10ab4acb3123550ef115db0d3d2
Add tests about annotations and enum.

For reproduction of https://code.google.com/p/android/issues/detail?id=78144

Bug: 18385117

Change-Id: I23be53a0ae481a501d13adc8abf518ac664a772f
Avoid overwriting EGL14.EGL_NO_SURFACE

(This is an update after the generator update.)

Both EGL14 and EGLExt have the same initialization codes for
EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT and EGL14.EGL_NO_DISPLAY.
Since EGLExt is initialized later, they are overwritten by EGLExt's
initialization codes.
Therefore, EGL_NO_SURFACE returned by methods in EGL14 is not
actually EGL14.EGL_NO_SURFACE object and it makes several problems in
handling error cases.
For instance, "Let's fish" game application cannot be run on L.

To solve the problem, this patch makes EGL14.EGL_NO_SURFACE,
EGL14.EGL_NO_CONTEXT and EGL14.EGL_NO_DISPLAY initialized just once.

Change-Id: Icce878164ff0b715ad2b5a2cd038a9616c7cf1e9
Prevent showing immersive confirmation unexpectedly

By design, if the user presses the power key twice within 5 seconds
(panic), it will show immersive confirmation again at the next time
entering immersive mode.

But there is a bug on calculating the time between pressing the power
key. The time get from event.getDownTime() will stop when the device
is sleeping without being charged.

So here uses SystemClock.elapsedRealtime() instead.

https://code.google.com/p/android/issues/detail?id=80772

Change-Id: I4dca9dc260904f1c5b60464834781e2a82a9bcf4
Prevent calling GL functions with an invalid surface

When destroying CanvasContext, the surface can be invalid
state. So the surface should be updated to null prior to
destroying GL resources to ensure that GL functions
are not called with an invalid surface.
Some GL implementation makes an error if GL functions
are called with an invalid surface. (Adreno 3xx)

Change-Id: Ie6f6ea081ec931fc9df30b2c3ed066ec1ae9d294
Prevent EntropyMixer from registering with service manager.

EntropyMixer is designed to be triggered in two ways, as either the
result of a self-set timer or of one of three system broadcasts.  It is not
meant to be triggered in any other way, so exposing it via servicemanager
is undesirable.

Bug: 18106000

Cherry-pick of commit: 9287e0dd272b85b475e33bcbd7d868517a0f98f9

Change-Id: I9aeb35e7ffde75090f4234ea193514fb883b1425
Reset killedByAm flag at attachApplicationLocked

ActivityManager reuses a process record object that killed
by him under some situation. That reused process record inherits
a killedByAm flag unexpectedly.
The killedByAm flag must be reset otherwise ActivityManager can't
judge the process can be killed or not.

Change-Id: If95137d91939cc44882ad2813131bcde0edd0c1b
Add keylayout for Logitech RedHawk Gamepad

Change-Id: Iad03de3384052b360d6b9d887ca9540de68cd21e
Fix pointer index out of range exception

Avoid pointer index out of range error if return value is -1 of
findPointerIndex() when there is no data available for that pointer
identifier.

Change-Id: I2a08f04c678164e220852094baa124ba157e2e42
Signed-off-by: tingna_sung <tingna_sung@htc.com>
[ActivityManager] Prevent provider from been created twice.

Root Cause:
If a process which contains provider is starting but not
from accessing provider, e.g. service/activity/receiver,
its providers' will be created during handleBindApplication.
And before the process complete publish provider to
ActivityManagerService, if there is an access call to
process provider before the process completes publishing
providers to ActivityManagerService, then the providers
will be created again.


Solution:
Don't schedule install provider if the provider record
already exist and will be published later.

Change-Id: Ic200ceae042c014c86e7edee0acd013b513af334
Merge "Prevent showing immersive confirmation unexpectedly"
Merge "Reset killedByAm flag at attachApplicationLocked"
Merge "[ActivityManager] Avoid system server crash due to package removed"
Merge "Fix pointer index out of range exception"