Live Volume Steps [1/2]

Change-Id: I1f50a68f5e361976f463b2497e2fea765144e5a1
Add date to statusbar [1/2]

Change-Id: I1f21effd80ea49c118345914241b800d0f46fac8
Signed-off-by: kecinzer <kecinzer@gmail.com>
[ActivityManager] Fix a bug: unable to start activity after starting activities during screen off.

Symptom: Unable to start any activity.
Root Cause: ActivityStack.mPausingActivity() points to a destroyed activity of a died process, so that ActivityStackSupervisor.allPausedActivitiesComplete() always returns false.
Solution: Set mPausingActivity to null in ActivityStack.cleanUpActivityLocked().
Reproduce steps:
    a. Turn screen off.
    b. A background service starts an activity X (in process X).
    c. A background service starts a no-history activity Y (in process Y), but the main thread of Y was blocked.
    d. A background service starts Y 3~4 times --> this causes am_failed_to_pause on X.
    e. Main thread of Y is freed finally --> this causes Y crash for android.view.WindowManager$BadTokenException.
    f. Turn screen on, X is shown on screen, but neither back key nor home key can work because mPausingActivity is Y.

Change-Id: I320b3db407e2d4cc745c8ca22a6e548742234242
[ActivityManager] Ensure consistency behavior when a background activity brings another existed activity to front.

Symptom: ANR occurs on previous activity.
Root Cause:
In KK, when a background activity starts another existed background activity (bring to front),
if current focused stack is not the same as the stack of target starting activity,
it will still resume the top of target stack, even the top activity on the target stack may not the same as target activity.
And it will result incorrect focus, press back key will send to previous stack's top then popup ANR on previous activity:
"Reason: Waiting because no window has focus but there is a focused application".

By original code comment, it looks 'bring to front' should not happen in this issue case.
// If the target task is not in the front, then we need
// to bring it to the front...  except...  well, with
// SINGLE_TASK_LAUNCH it's not entirely clear.  We'd like
// to have the same behavior as if a new instance was
// being started, which means not bringing it to the front
// if the caller is not itself in the front.

If the caller and target are in the same stask, it will just deliver new intent without changing task order (the same behavior as JellyBean).
So the patch concept is just to avoid to use target stack to resume top when caller and target are in different stack.

Solution: Do not allow to resume another stack top if non-top activity try to bring existed activity to front.
It may not be a good solution, just a reminder for the issue case.

Reproduce steps:
Assume A, B, C are different app tasks.
When the application stack is like:
  Top C
      B
      A

 #Case 1: Home is foreground
  A starts B with NEW_TASK, C will resume, focus still stays at Home, and window order does not update.
  Then press back key or volumn key will result ANR on Home.

 #Case 2: App is foreground (Resumed activity is C)
  A starts Home, Home will resume, focus still stays at C, and window order does did not update.
  Then press back key or volumn key will result ANR on C.

Change-Id: If05070123b248e2335791e43a4d4ddee6db11d84
Reduce warning verbosity in aapt

- Attributed source of problems to the correct file.
- Only verify string localizations against valid
  locales.
Bug:13140015
Change-Id: I9dabc5efa0510649caee8af0c8ebb803d6f48269
Do not show Home behind full screen activity

When ensureActivitiesVisibleLocked goes through foreground activity
stack and reaches non-fullscreen activity, it sets showHomeBehindStack
variable to true.

If there is a fullscreen activity behind, showHomeBehindStack remains
unchanged, which causes Home application to be displayed anyway.
In this case user will see a fullscreen activity and Home activity
simultaneously.

To fix the issue we set showHomeBehindStack to false when we reach
fullscreen activity in the activity stack.

This was made visible by the following commit:
446ef1de8d373c1b017df8d19ebf9a47811fb402

Change-Id: I535c1283a4e26f5cf606375b837d4b7195324af0
Keyguard: fix transparent lockscreen

Change-Id: Icdd8bc5605dd352b03772880764b5ca39d74a3e5
Signed-off-by: Dirk Rettschlag <dirk.rettschlag@gmail.com>
Merge "Add date to statusbar [1/2]" into kitkat
Merge "Keyguard: fix transparent lockscreen" into kitkat
GlobalActions: Fix Airplane Mode on/off issue

Issue: Unable to turn off Airplane mode from power button
       after phone reboot

Fix: Initialize mHasTelephony before the PhoneStateListener is
     registered to the TelephonyManager so that correct value
     of mHasTelephony is reflected when onServiceStateChanged
     callback is called.

Bug: 13697360
Change-Id: Ide8afd9c16ea90b98b5912dbff440c5fd67b178d
Fix problem where PhoneWindowManager waits for keyguard to draw

This fixes a problem where PhoneWindowManager times out waiting
for keyguard to draw when it's disabled.  Instead, we pass a null
token back which allows PhoneWindowManager to continue.

Fixes bug 11190932

Change-Id: I041ea1d88dca681476d9477a3aab54559976b312

Conflicts:

	packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java
Fixed a possible infinite loop in JsonReader#skipValue()

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

Change-Id: Idaa0e75fc5612550c4b9ccb9afa5535ea5b189df
Catch the NameNotFoundException and return to avoid null pointer when updating package in AMS.

Change-Id: I26cf200cc84639e1261085b6905a567320cbb0a9
Author: Bing Deng <bingx.deng@intel.com>
Signed-off-by: Bing Deng <bingx.deng@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 63612
Fix SSLCertificateSocketFactory.getDefaultCipherSuites.

The method was returning all supported cipher suites instead of the
default ones only. The default list of cipher suites actually used by
sockets created by this factory is not affected by this issue.

Change-Id: I2e4d7c6547fcb29ff7a0943bc8791706cc8d22bc
ANR caused by incorrect cleanup in BroadcastQueue.

Two broadcasts could be sent to the same app simultaneously:
one foreground, one background. For example, LOCALE_CHANGED
and PACKAGE_CHANGED are delievered to com.android.vending
at the same time.
1. AMS started new vending process to handle LOCALE_CHANGED.
   And set app.curReceiver = LOCALE_CHANGED.
2. Before LOCALE_CHANGED is handled by vending process,
   PACKAGE_CHANGED was delievered to vending process too.
   AMS set app.curReceiver = PACKAGE_CHANGED. Bad!
3. Vending process finished handling LOCALE_CHANGED.
   AMS clear app.curReceiver = NULL. Bad!
   And Vending process  killed itself without handling
   PACKAGE_CHANGED.
4. AMS known vending process has died, but didn't know that
   BgBroadcastQueue was still waiting for finish message
   for PACKAGE_CHANGED.
At last, BgBroadcastQueue reported ANR for PACKAGE_CHANGED.

This patch adds protection before clearing app.curReceiver,
only set to NULL if the finishing receiver = app.curReceiver
So handleAppDied would know that PACKAGE_CHANGED was not
finished yet, it will abort the broadcast and continue.

Change-Id: Ic4f31b35e21823d4a3c27712391ecbede213a494
Signed-off-by: Guobin Zhang <guobin.zhang@intel.com>
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>
Null pointer exception in FileRotator.java

Sometimes a null pointer exception is thrown when examining files
managed by the file rotator.

The logs from the test show that the Wifi state is changed a large
number of times. On every state change, a write operation is
initiated on the file system. This will eventually result in out
of memory and the call to mBasePath.list() in the maybeRotate(...)
method in FileRotator.java will return null so the iteration will
throw a NullPointerException.

Change-Id: I5d5980d9593bc9ec75281169ca27ee591809903f
Prevent a duplicated registration of Observers

If same Observer and same URI are registered, the callback functions are called multiple times
when data identified by a given content URI changes.
It makes system slow and it cause ANR sometimes.
And When run unregisterContentObserver(), just one deleted
but others are remained in mObservers.
So add prevent code to avoid to duplicated registraion of Observers

Change-Id: I5c7845deb682db289ff0d53150ef012174859767
Signed-off-by: muzbit.kim <muzbit.kim@lge.com>
Avoid duplication of AppWindowToken in created Task

When WindowManagerService creates a new Task, it passes atoken to the
Task constructor. In this case atoken is added to mAppTokens list by
the Task constructor and then it is added manually again by calling
newTask.mAppTokens.add(atoken). As a result, the same atoken is present
in mAppTokens list twice.

When another window token is added to the list, it may be placed in
beetwen duplicated tokens and corresponding window will be hidden from
the screen by corresponding duplicated windows.
From user perspective it means that some windows will not be displayed
on the screen.

The issue is fixed by avoid adding atoken to mAppTokens list manually
when it was added already in Task constructor.

Change-Id: I10628e68186160fffdde07beb7d84ab3cecb7051
Harden NsdManager against null-dereference crashes

Due to race conditions or programming errors, the NsdManager
can attempt to process an asynchronous status message (and issue
a callback to the listener) after the listener has already been
removed from the NsdManager state.  This causes dereferencing of
null objects, and a crash.

Split out the three async-queue message cases:  these are ones
in which message.arg2 does not hold an NsdManager array index
and the code should not interpret this field as if it were.

Add an explicit check for "null listener" (the array index in the
message has already been released), log a warning, and exit early.

Safeguard accesses to the "NSD service type" string from a (possibly
null) NsdServiceInfo object... return a constant "?" string rather
than crashing.

Bug: 9016259

Change-Id: I40aabdfc65d86fdd0eaac7a1e7e56e6ff69796cf