Fix PackageManagerService WTF in systemReady()

This resolves the following error:
F/SystemServer(31979): BOOT FAILURE making Package Manager Service ready
F/SystemServer(31979): java.lang.SecurityException: Unable to find app for caller android.app.ActivityThread$ApplicationThread@42171630 (pid=31979) when registering receiver android.app.LoadedApk$ReceiverDispatcher$InnerReceiver@420d1130
F/SystemServer(31979):  at com.android.server.am.ActivityManagerService.registerReceiver(ActivityManagerService.java:13157)
F/SystemServer(31979):  at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1506)
F/SystemServer(31979):  at android.app.ContextImpl.registerReceiverAsUser(ContextImpl.java:1481)
F/SystemServer(31979):  at com.android.internal.content.PackageMonitor.register(PackageMonitor.java:84)
F/SystemServer(31979):  at com.android.server.pm.UserManagerService.systemReady(UserManagerService.java:237)
F/SystemServer(31979):  at com.android.server.pm.PackageManagerService.systemReady(PackageManagerService.java:11305)
F/SystemServer(31979):  at com.android.server.ServerThread.initAndLoop(SystemServer.java:1022)
F/SystemServer(31979):  at com.android.server.SystemServer.main(SystemServer.java:1372)
F/SystemServer(31979):  at java.lang.reflect.Method.invokeNative(Native Method)
F/SystemServer(31979):  at java.lang.reflect.Method.invoke(Method.java:515)
F/SystemServer(31979):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
F/SystemServer(31979):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
F/SystemServer(31979):  at dalvik.system.NativeStart.main(Native Method)

TODO: Revisit this in the future when Google updates AOSP for multiple
system contexts.

Change-Id: I74be7a7a3ba1ede55a8ccae7c86e7650b27f435e
PackageManager: Fix logic around upgrading text display

* This code has all threads writing into the integer keeping track of
  the number of packages at once.
* Make this integer an atomic one, preventing all threads from racing
  when updating it.

Change-Id: I727306f8ab20edb7ec2a955ca20e6de0146c7737
settings: Enable the status bar double-tap to sleep gesture

Change-Id: Ibe4f1d0c864f261211d7ded418abfe45633e1392
Themes: Use INSTALL_LOCATION_INTERNAL_ONLY for legacy icon packs

If an icon pack is currently applied and is installed using forward
locking, the system will crash when the pack is updated.  Several
applications can have the pack attached to their resources and this
causes the system to crash because it cannot unmount the asec container
to finish the post install process.  Installing these packs to internal
storage without forward locking alleviates this issue.

This is done with theme packs as well, including legacy themes.

Change-Id: I155fc0bd671f3f9baaf2565d1c4d654a0a5348dc
base: properly check that quickboot is enabled

Change-Id: I0c9e54ee2cdf4efb5097cd101a0fa274f493d816
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Implement DocumentsProvider.createDocument and deleteDocument

Fixes AOSPA-431
This is needed to delete and create files/folders in DocumentsUI.
Some open questions are:
1. Are the methods implementented according to their description?
E.g I'm not sure whether deleteDocument should be able to delete folders, too.
2. I first didn't want to modify public API, but deleting files from within DocumentsUI somehow doesn't work - file.canWrite() always returns false
3. So is modfying the API this way OK?

Change-Id: Ie3a9d1888decaa0f08de1a5183ffd23760be15b9
StatusBarView: Ensure to not overload in/out animations

- Post animate call in main thread, thanks @David96
- Handle animation checking current view visibility

Change-Id: Ic8a422d1089c5d147e31b5a1f33e11a82a023253
Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Signed-off-by: David L.-W. <xD_e-mail@gmx.de>
ExpandHelper: Improve one finger expanding forced handling

Instead of force returning false if view is null, setup a boolean
to force it with custom views like hover. Cherry-picked from CM.

Also request disallow intercept on drag started.

Change-Id: Ie0043744fa7df6a15814c663add807e75399c2d7
Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
StatusBarView: Avoid unnecessary calls to mHandler.post()

Change-Id: Iefefaf4ccfcb0a6ce88e0974aabd4dd894c8c06a
Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Signed-off-by: David L.-W. <xD_e-mail@gmx.de>
HOVER: Match notification width on tablets too

Change-Id: I3d45c8014dbe0a7697c176f3fc71356ccb731593
Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
HOVER: Ensure to clear after reparenting all notifications

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: I8d3735836952394942f044ebd067d7cc7a82bc2e
HOVER: Fix notification content not being updated

Change-Id: I6f5e95cfff9b78cdabd1d9aa00e0577b0ab78508
base: don't show global actions if shutdown sequence was started

Change-Id: Icd77aa7529faf438dcc80e45434826465a11aab8
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
accounts: don't remove accounts while device is in safe mode

Userspace apps are not available in safe mode, so authenticators are not available when
the system starts and checks all accounts. Just ignore these accounts and not add them
to the list of accounts.

JIRA: CYAN-4074
Issue: https://jira.cyanogenmod.org/browse/CYAN-4074
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Change-Id: I9cac5084c29fe33a0215ab4a9e693f58712438ac
Show notification on adb over network too

Screenshots - http://goo.gl/TgsRI6

Change-Id: I9ddc0aa9a4f330a06ab5d97a8645d1b31bb6f299
Fix frontOfTask assignment.

If all activities of a given stack were finishing, no activity was
marked as front-of-task. This confused ActivityManager, so make sure
there's always exactly one activity marked as front-of-task.

Change-Id: I087cbe10280d4a60aa5ccfaefe24a223523fb3f2
Theme IME switcher alert dialog

Change-Id: I5344e9ddbacb1520080532d9cc1a7a5f5428e131
Signed-off-by: Dirk Rettschlag <dirk.rettschlag@gmail.com>
keyguard: force marquee effect for carrier text

This allows to make rooms for languages with long carrier text descriptions.

Change-Id: I8a3f69d186e79971c66c4977d258b2bda48ceeff
JIRA: CYAN-4356
Issue: https://jira.cyanogenmod.org/browse/CYAN-4356
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Keyguard: fix NPE setting lockscreen wallpaper

After boot the view might not be laid out and so getWidth() and
getHeight() return 0 and will cause a NullPointerException in
createBitmap().

Change-Id: Ibacf4199a69709dc34d21695732c2a5360533a23
Signed-off-by: Dirk Rettschlag <dirk.rettschlag@gmail.com>
Activity chooser "Always" button is not working

When ResolverActivity is created with a custom list of matching
applications (rList) as in NFC case, and the alwaysUseOption is
set to true, the prferredActivity is not saved even if the user
presses the "always" button.

When a list is provided the variable mBaseResolveList will be
!= null. This will set mOrigResolveList = null.

When an activity is choosen and one of the buttons are pressed
onIntentSelected is called. The first thing this method does
is to check mAdapter.mOrigResolveList != null, however in this
case mOrigResolveList is always null, and the value is not
saved as PreferredActivity.

This problem was introduced in
6d8dfbd8149942f25f2b9643a12f1fb38f3be834.

Change-Id: I9eac41b7861b5e68ad3978af0dc0285f2a34eb88