wallpapercropper: OOM issue while opening *.bmp image

This change manages setting of large images as
wallpapers without encountering OOM.

CRs-fixed: 619815
Change-Id: I3a32ec4b42050b146076f0adf6b6e65afd6fae4e
Always call super.onCreate().  Always.

Bug 12991134

(cherrypick of commit 9d6376a1d88ab5b3a41ee4400e3aaa4c4ee69e2a)

Change-Id: Ife16ef93408253e3318a06dc0206ab4b88c7f367
Don't allow MemoryFiles of negative length.

Prevents us from converting a (signed) jint into an
(unsigned) size_t and having horrible things happen.

Change-Id: I0f04e2eb9852ae7fc49b435fd0974f56e86751a4
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>
WallpaperManager: add NULL pointer check for getCropAndSetWallpaperIntent

Originally the api 'getCropAndSetWallpaperIntent' does not check
whether the parsed parameter is a NULL pointer, as leads to the
whole app crash if it call this api with a null parameter accidentally.
A null pointer check logic is added into its original parameter check
logic, so that this API will throw an IllegalArgumentException if it
is parsed with a null pointer

Change-Id: Ib7de40e571419d09e1a744edc969eb7162766b75
MetadataRetriever: Check null pointer to avoid tombstone crash.

When the app's vm-heap is not enough, memory allocation for big
object like bitmap may failed.

This patch add protection for bitmap creating to avoid segment
fault error in the following GetIntField function.

Change-Id: I63977dc602f4ed395afd11004a0ed027173fb685
Signed-off-by: wang, biao <biao.wang@intel.com>
Signed-off-by: TingX Li <tingx.li@intel.com>
Signed-off-by: Wang LiangX <liangx.wang@intel.com>
Fix a NPE when putting a null-Bundle in an Intent

Happens frequently e.g. with GoogleAccountAuthenticator

Change-Id: I284bf153f40ee9cc3e70bce6efcc3b9e6706361b
Fix error checking in MemoryFile.

mmap returns MAP_FAILED on failures, not 0 (NULL).
Also, convert some C style casts to C++ since they
make intent clearer.

Change-Id: I367993c73e9ee576f11ebe76e530d2c2f27c662d
[ActivityManager] Reduce report ANR on wrong activity.

Symptom: ANR report on wrong activity.

Root Cause:
  KK changed resume behavior that will not update focus when only resume,
if the activity blocked, it may report ANR on previous focus.
  By original concept, it will try to correct the ANR target,
but the stack of waiting(waitingVisible=true) activity may
different with current top stack.
  If it gets key dispatch timeout, mResumedActivity and mPausingActivity
of its stack will be null becuase it is not top stack.
Then it is unable to change ANR target to the real no response activity.

Solution:
 Use focused stack to get the real culprit.

Reproduce steps:
1.Launch an Activity X from launcher, press home key.
2.Launch X from launcher again, X blocks(sleeps 15sec) in onResume, press back key in the beginning of blocking duration.
3.ANR dialog shows launcher is no response.

Change-Id: I99416ad91e349096f995990f2240a97616fbaf28
Keyguard: Move test app translations to the correct place

Google messed up again with translations.
This change is needed because it interferes with our translations
which happen to use same string names as the Keyguard test app.

Change-Id: I593ab5f004f09e1b33c5ba7ef3d1bb19ffc643b4
Fix IMMERSIVE_MODE_CONFIRMATIONS registration

The changes of IMMERSIVE_MODE_CONFIRMATIONS are not observed
since the SettingsObserver doesn't register it correctly.

Change-Id: I538012a7c0058103d1c9096d76e5c24c0eddea6a
audio: no notification sound when adjusting volume bar twice.

Notification sound won't take effect when the previous track hasn't
finished.
Need explicitly stop the previous ongoing track to alow the current one.

Change-Id: Ib344a8b14ecc47a5c8fdd9c11ae48a3541ea9a55
CRs-Fixed: 652236
Update Volume state for Unmounting Phase.

This change will update the state of volume
to "unmounting" when the volume is in Umounting Phase
It will prevent apps from getting wrong state when state
of volume is queried on receiving MEDIA_EJECT broadcast.

CRs-Fixed: 642047

Change-Id: Idce0569e076c9d64f2022e86ad995bc5428e2fbc
DocumentsUI: The title disappears after rotation

The onItemCheckedStateChanged() method in DirectoryFragment.java
called the setTitle() of ActionMode to modify the title of the
action bar. But this change is not redone after the activity is
recreated. Therefore, when the orientation is changed, the change
in title will be lost.

Set the android:configChanges for DocumentsActivity to avoid
recreating this activity.

CRs-Fixed: 641604

Change-Id: I768422b63a07fcb3ac2c8fa5c6007e49965ff713
DocumentsUI: Fix the issue of download status was displayed incompletely

The layout arrangement of date, size and summary are unreasonable.
Text was ellipsized when summary has too much characters.

Reconfigure "layout_weight" of date, size and summary can fix this
issue.

CRs-Fixed: 619201

Change-Id: I0c00d08d4793a38b80988378b4b510bdb3bf8720
Fix Javadoc link for getModifierBehavior()

Change-Id: I571db5147a081fcd7190483ba9e7a45b46db224d
Cleanup
- Remove duplicate DeviceUtils
Fix crash when clicking a file from recents or downloads

Change-Id: I6e1693d1d9f433b6baf25d3033245a56817ec16a
UserTile: Fix displaying user information for multi-user devices

In commit 89ab0eb097322ac8eec40159b888dfb03b9413e9, we improved
the handling of single user devices but appear to have also
entirely deleted the name / avatar for multi-user devices.

This commit restores the deleted code for multi-user devices.

This fixes CYAN-4023.

Change-Id: I69fe1504da2b32cd5bf0fdc87f8f78c960e9c77f