Always call super.onCreate().  Always.

Bug 12991134

(cherrypick of commit 9d6376a1d88ab5b3a41ee4400e3aaa4c4ee69e2a)

Change-Id: Ife16ef93408253e3318a06dc0206ab4b88c7f367
mSurface was reset and lost initialization.

mSurface got reset and lost initialization when the developer call
setSurfaceTexture() in onSurfaceTextureAvailable().

Change-Id: If07260e3897e99b96e7a9d86ee5bc1528fb30ab4
Signed-off-by: ChaoJun Xue <xdtq47@motorola.com>
[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
Merge "Always call super.onCreate().  Always." into android-4.4
Merge "[ActivityManager] Reduce report ANR on wrong activity." into android-4.4
Customizable Low battery pop-up warning (1/2)

Change-Id: Idcd26b4b111f853853adeaf900c762313aa3e056
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
Frameworks: Slimrecents: cover bad 3rd party apps behaviour

Recent app screen as well the original AOSP one needs a proper preloading.
We discovered due of reports that a lot apps (launcher etc) just call over
the SystemUIService some even with reflection :/ just the toggle and no
preload at all.

Whatever we cover this behaviour due that we do not want to break 3rd party
apps. If someone calls the toggle without proper preload we preload them first before
the recent starts animating. Listener takes already care on it for low end devices. We
just use this now and let the taskloader in this case decide when the recent app screen
can be shown.

As well this commit disables the logcat spam lol. Forgot to disable debug on the relase
commit

PS:
- fixed code style issue
- go on out animation down in the runable delay. Not needed to be that long at all

PS:
- add another safety check

PS
- another one

Change-Id: I43a47185da446b9ecaec114c1835ecfd20c3ac73
Frameworks: SlimRecents: go more inline with AOSP and add menu + new googly shortcuts

This commit changes the longpress behaviour. Like on stock aosp longpress opens the menu with this options

1. App info (like stock)

2. Play Store link to the app

3. Amazon store link to the app

Note: the store links are only shown if the app has the info that it was installed by one of this
stores. So stock apps (installed by system) or sideloaded apps do not show this link.

As well some backup apps break this entry on restore lol.

As well a bit cleanup on here and there and remove the close panel call on cancelPreload. Not needed

PS
- disable debug

PS
- set correct style
- disable one default debug

Change-Id: I29769f48ce6073acb6105f5590b93c671d6fc0d4
Frameworks: SlimRecents make it RTL/LTR aware + scaling + lefty mode (1/3)

This commit adds several features:

- Make it fully RTL/LTR aware. Means it shows up on the oposite side if an RTL
  language was choosen. As well icon, textposition, menu etc follows RTL direction.
  So like AOSP guidelines suggest it is fully compatible now for all locals

- Add scaling mode....user can scale the overall size down (especially for the
  user with stock dpi requested)

- Add lefty mode. Recent panel shows up on the left edge instead of the right edge

As well this commit unlinks the construct of the card with the update of the content. This
reduces one update call on construct and gives a tight faster loading.

Change-Id: I4c5105f86644a08da81861851da7e0e347c26244
Frameworks: add favorite mode

Allow user to set favorite apps in recent task list. User can set them with
longpress on the app icon. This apps are always shown in the task list above
the first default one (on phone the first 2 which always show the last 2 active
tasks). Favorites are shown in order of last time they were called. Favorites
settings are saved permanently till the user removed it from favorites.

As well this commit fixes the wrong icon if an package has more then one
activity to call (eg Google+ and Google Photo).

Using for all now a unique identifier.

Change-Id: I3cd7dd6600389c73e678f382377b441612902833
Frameworks: notify arrayadapter early that data has changed on clear all

Recent clear all. Current behaviour is that we do not update the array adapter at all
due that it gets rebuild on next reload. But in very rare cases it happens that getView
want to update shortly after all is cleared althought the view is not visible anymore.

Whatever just call notifyDataSetChanged after List is cleared to work against it.

Change-Id: I61ca25358ebe164336ba349565459537861c5495
Frameworks: do not kill favorite recent apps

Due of a lot user requests and I basically like the idea (not a fan of clear all apps at all
due that it does not make sense android wise) we ehance the favorite recent apps feature.

This commit basically does not remove the apps from the task list which were marked from the user
as favorite.

3 possibilities:

- No favorites are in the task list - clear all behaves like it was before - all tasks cleared and panel closes

- favorites and non favorites are in the task list - clear all removes all non favorite tasks and favorite tasks stay.
  Yes without fancy animations....we want to be fast ;) - panel stays open

- only favorites are in the list - pinch to zoom out is blocked due that nothing is there to clear all.

single clear of a task with swipe behaves in all cases normal like it was before this change

Change-Id: Ia05562e0f59dfb023aa65ec3a40dd951594dc88e
SlimRecents: Adress the 50ms touch unsresponsive issue

User reported that if the screen is fully animated in that the touch
detection is not working for about the first 50ms. For user who are working
fast this is indeed an issue. Especially due that the recent screen speeds
up the workflow much already.

Problem is our third loading stage due that after the recent screen animates in
it calls getView on all elements which rebuilds the touch listeners and cause to
the slight timeframe where it is unresponsive.

Well the third loading stage was a left over from the first optimizations when
we started to develop this feature. Other optimizations are into place now so we
do not really need the third loading stage at all. So instead of handling now
the fix in the getView implementation of the arrayadapter we simply just remove the
third loading stage completely.

PS:
- small other optimization

Change-Id: Ibf46fbe393de4f9d6b867e6bdb9c331dff1dd38e
Fix RTL

Change-Id: Ib0352272068b00f584253e40aa59c2961cfb010b