Fix smart pulldown clearable notification

Thanks cristianomatos
Fix indirect misuse of $(my-dir).

Change-Id: I20a98a8e1378da3a53e6a6d599c8fc0100f7f87a
ActivityManager: Update timeline debug statements

Update the timeline debug messages so that
'ActivityManager' is not used as the tag in log
messages as it interferes with some CTS tests.
CRs-fixed: 628703

Change-Id: I18c04eb47263246b6cf293210ba603127be99bd9
Don't register methods when there's nothing to register.

Change-Id: I6d0233f79bb90089426d702b4076ec5750e82475
Lockscreen Notifications: some fixes
WallpaperCropper: Fix crash when set .gif as wallpaper

It returns an equivalent scaled cropBounds as true
crop bounds, then it set the rounded rect by rounding
"out" the true crop rect, this make the rounded crop
rect may out range of the original bitmap, then an error
will happen.

We change to check the rounded crop rect, if it is out
the range of original bitmap, we set the original bitmap
bounds as rounded crop bounds.

CRs-Fixed: 622582

Change-Id: I215ef2a0165adaaadb05c62dee741a8ea6926144
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
Lockscreen Blur: Disable if music is playing

Some apps don't employ full screen album art.
In that case album art doesn't override wallpaper & content behind screen is clearly visible.
This fixes that issue.
[video] : added mime-type for mov files

- Added video/quicktime mime type for mov files in
  MediaFiles.Depend on the mime-type it decides
  to show either in gallery or music app

CRs-fixed: 515036

Change-Id: Ieab6c15d78d2d140158833905e8e387643f1157a
Improve detail message for X509TrustManagerExtensions argument validation

Bug: 13728564
Change-Id: I03d08babcdc0d11baff5e76a339b4285e92edee8
Don't make isSafeMode a field on the Zygote class.

This field is written and read exclusively by the system server,
and should therefore belong to the SystemServer class.

Change-Id: I2708a9a45c0c9cd1a6f563e8cc5844bd8c424bf7
Restore pre-KitKat permissions to external sd for all apps

Change-Id: Ib3ff52bcc47fd36e8f3fc5aefeaae4e56180e7c6
Avoid SystemUI crash due to NPE

BaseStatusBar.createNotificationViews() returns null
when it reports handleNotificationError(), leading to
a forced crash of the misbehaving app. However, it
should not add a null object of Notification.Entry
since it will also crash SystemUI (crashing at compare).

Change-Id: I86678c8024e931420b0fbab1f36b330e7e75d581
Fix a system crash due to orphan HandlerThreads

In SeekBarVolumizer class a HandlerThread is
instantiated that is not halted after the object
is garbage collected. The final consumer of
this class is volumes adjustment dialog in Settings.
If the user invoke the dialog several times, many pipes
are opened in Settings process that it finally exceeds
the maximum permitted number and the system crashes.

Change-Id: Ifd777365b5779f5db92c605413eb0254a53c8b00
Keyguard: We need to ensure that keyguard is showing as well to set the token

Google fix

https://github.com/SlimRoms/frameworks_base/commit/021806ec33f5f59567f3bb3af135b2a1d88c0951

fixes what it is meant to fix.

But still we need to ensure if the keyguard eg is disabled by 3rd party
apps or the keyguard is not showing due of other reasons to inform PhoneWindowManager over the token
not to wait to draw for the Keyguard and go ahead.

Fix:
Just check for isShowing in addition to the check if KeyGuard is disabled

Change-Id: I5f017a6ccebf12dc717fb6d44802a1c1fee15abc
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
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
Avoid AsyncTask ThreadPool leak in RecentTaskLoaser

In MTBF test, if “Press KEYCODE_HOME” is simulated quickly and frequently,
ThreadPool overflow would be triggered, which would crash systemui.

When pressing hardware KEYCODE_HOME on the phone repeatedly, upon key down,
systemui will preload recent task list; upon key up, it will cancel the
request for preloading. During preloading, two AsyncTasks (mTaskLoader
and mThumbnailLoader) will be started. Both of them will use
executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR) to run.

Cancel predloading means we don't need mTaskLoader and mThumbnailLoader
any more, so we'd better use cancel(true) to interrupt these two AsyncTasks
and catch this InterruptedException to return directly.

If we use cancel(false) it won't interrupt these two AsyncTasks and
mThumbnailLoader may be blocked in blocking queue "tasksWaitingForThumbnails"
whcih will cause ThreadPool overflow.
There is situation that mThumbnailLoader’s thread runs before mTaskLoader’s.
Just at this moment, cancelPreloadingRecentTasksList tries to cancel
both mTaskLoader and mThumbnailLoader. Then mTaskLoader was cancelled
directly as it didn't start, mThumbnailLoader could not stop and blocks
on "tasksWaitingForThumbnails" forever. At last, many AsyncTasks for
mThumbnailLoader are not cancelled but left in waited state.

Change-Id: I62bef320a62f28a442117f7d2c8160ea49e1a1fe
Signed-off-by: jshe32X<jianchunx.shen@intel.com>
Signed-off-by: Guobin Zhang<guobin.zhang@intel.com>