frameworks/base: Fix the random UI corruption

On low memory device, when a view goes to background. Its HW layer cache
will be destroyed to release memory. There is a very rare case that the
hardware render is not valid when destroy the layer, so the layer is not
destroyed and reused when the view comes to foreground. But the GL
context has changed, so the view is not rendered correctly due to its
HW layer cache. To fix this issue, destroy the layer in a safelyRun. Make
sure the layer is destroyed correctly.

Change-Id: I1c714e1d53db7353d5169e874a7cd0f527c3f67b
CRs-Fixed: 623239
ActiveDisplay: fix possible add>remove>add(nothing happens) condition

Change-Id: I7bb444eced5de0856f60dda7804ee4864546bc9d

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
Revert "Avoid duplication of AppWindowToken in created Task"

Hunting for the cause of a fairly recent ANR

This reverts commit ee1acd0e71e19106ea04ee068c303e90eb7ae9c5.

Change-Id: I98133c59e3989c89f090a8e94b253db2007a874b