Augment SELinuxMMAC functionality.

* No longer support a package name stanza outside of
  a signature tag. Package names, by themselves, have
  no security associated with them in Android and thus we
  should not be allowing or encouraging this
  type of policy.

* Allow for nested package name stanzas inside
  signature stanzas. There are cases where a finer
  distinction needs to be made among apps signed with
  the same cert. New code allows a different seinfo
  tag to be assigned to the listed package names
  signed by the parent cert. When a determination needs
  to be made concerning seinfo assignments, the inner
  seinfo tag takes precedence over the outer seinfo
  labels which are assigned to just the signature.

* Temp structures are now used to parse new policy files
  until the entire xml file is parsed and deemed correct,
  at which time the temp structures are copied over to the
  permanent class structures. This ensures that any structural
  errors with the policy will not result in partial loads.

* Valid stanzas look like the following with the inner
  package piece being optional.

   <signer signature="">
     <seinfo value=""/>
     <package name="">
       <seinfo value=""/>
     </package>
   <signer>

   <default>
     <seinfo value=""/>
   </default>

Change-Id: Ia204d71211776dcf9b2dcc86ad6d77c4ad39dc25
(cherry picked from commit 5ecf1d281b5e320d66bc0cc5653d0028a57467fa)
Allow PMS to restorecon directories under /data.

This change applies a relabel to both /data/data and
/data/user directories on boot. Not every boot will
apply this relabeling however. The appropriate
seapp_contexts is hashed and compared to
/data/system/seapp_hash to decide if the relabel
should occur.

Change-Id: I05e8b438950ddb908e46c9168ea6ee601e6d674f
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
(cherry picked from commit cff6c5cb6f332cc941626afe974b6be5eee2f4b2)
Convert all selinux_android_restorecon and _setfilecon calls to new API.

libselinux selinux_android_restorecon API is changing to the more
general interface with flags and dropping the older variants.

Also get rid of the old, no longer used selinux_android_setfilecon API
and rename selinux_android_setfilecon2 to it as it is the only API in use.

Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
(cherry picked from commit 3faa02e435dbfb02eb924efbfe77efaae22299ec)
Frameworks: Fix linked volume does not persist after reboot.

The controling boolean value must be set before updateStreamVolumeAlias
is called first time. Otherwise updateStreamVolumeAlias will assume
it is always false till user toggle it in settings again.

Change-Id: I53455249909fa6ad69fa0ea6930f9065e5a14fdf
(cherry picked from commit c86c83e1b2db05254851fee9328c2e9b9979097b)
NsdService does not clean up after exiting clients

When a client of the NsdService exits, NsdService should
clean up the requests it has sent to the mDNS daemon:
cancel any pending resource-discovery and resource-resolution
queries, and remove any services registered by this client.

If this isn't done, several bad things happen. The daemon will
continue to run unnecessarily, will report service discoveries
that can't be forwarded on to the client, and will continue to
advertise service ports for an application which is no longer
running until the device is rebooted (mDNS pollution).

Bug: 9801184
Change-Id: I0aa7311480322aefcff16f902fbbf34f50985d38
(cherry picked from commit d095e28af053a20f63ea83cf7a275894e551539f)
Fix WifiHandler for MSim

Commit 7c26a5cce74332bc48da9e894a835f2fe795431c attempted to fix
this issue by adding back the old code, but it needs to be a method
that can be called by MSimNetworkController. So sync it back to caf
to fix the merge issue.

Change-Id: Ifc721cbf372ec50810924d7ac6d55f54663458a1
(cherry picked from commit 12a94922cb11a9ef23035763a01bbb183edc2808)
msim: Add support for H+ icons

Change-Id: I9e0cb93b0414f55c51aea7425ab8e02ef5f12095
(cherry picked from commit 86617fccd26d99b83c6550019f7bbd96074f2062)
Fix CYAN-3555 bug

This commit fixes typo which is in AOSP tree.
I hope it's possible to merge it.

Change-Id: Ifdf9c5d90b9850b6112ee11a9b1aa3b1576348a0
Signed-off-by: jereksel <jereksel@gmail.com>
(cherry picked from commit 1955a35774723080271674187ca99ae066b70eee)
Core/Keyguard: Cleanup CAF additions

Change-Id: I12619aedc459ffed514b1eb2c19dd57e6f535522
(cherry picked from commit cbad5ffad121df8047048c31eea8a9c77db00d2a)
Revert "Update the GPS tile to use the appropriate location modes"

This reverts commit 5b230a8016746e5e24b044f1559e611a6c3ebc68.

(cherry picked from commit 5bb86b8af4810634404150a1524722957fc46754)
QS: let's welcome LocationTile to 4.4

we already modified to use the basic 4.4 location mechanism. Still
it was very basic. Now using the same attempt like in Settings to
controll location mode (high accuracy, battery saving, device only) and on/off state

longpress switches between the states. Normal click turns it on/off
Compared to settings turning on will recover last state where it was turned off. As
well it respects the sharing location warning dialog either when you switch on into
a mode which use it or you switch into a mode which uses it and it was not confimed.

Slight corrections to original AOSP code to reflect the changes in LocationController
even though this code is non operational

PatchSet:
- moved the complete handling into the LocationController. Way better
  to have in centralized. Who knows for what we will use it later.
PatchSet:
- cleanup

PatchSet:
- added drawables from kroz :)

Change-Id: I4638cb21303cf91288c08ff83e9217f23de4d403
(cherry picked from commit 603cbf9249192d6a847525ab7777635ee911d4c7)
Location tile: Add a label for all states

Change-Id: I70545942de8d39f27478033d76c526895914eb74
(cherry picked from commit 193f3d661f38dda813cecd16bf7d84922571cafd)
Update RU translation for v56 (Frameworks)

(cherry picked from commit 924acd1d2a2dfdf75efec76726e8838115df5863)
Avoid collision with RIL constant 1138, used in some Samsung devices for RIL_UNSOL_TETHERED_MODE_STATE_CHANGED.
Needs http://review.cyanogenmod.org/#/c/61292/
Thanks to iptux on XDA for pointing out the change in constants between
CM-10.2 and CM-11.0.

Change-Id: I64011408f4cce9aeb1b56e325226f8e649eff2b6
(cherry picked from commit f086b87467758118a57e135e246148fe32ea02df)
SystemUI: Update RU translations

(cherry picked from commit 744c7d82983ed87f1a9f383b2bd36bac1d8635d3)
Update morning contextual header pics

(cherry picked from commit 2295d1e9912ec8bcee004ac2992f6632e4bd9c0c)
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
(cherry picked from commit 4e6f8f05dae1ae2671653029e51ae1a9b32b4fb4)
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
(cherry picked from commit ec5654f76074f8b6de57a0c1122bda4813daf35d)
Frameworks: fix possible NPE + and missing expandable panel correction

Thanks Jorge for pointing it out. This version is way nicer.

Change-Id: I7a65a05ef533c90cbfc68d4de996eae7a0ff66b7
(cherry picked from commit 340e15dc0c9d321485dd40acbbdb241f57ada61f)
Update PR-BR translations

(cherry picked from commit 0d5e33db48b305f0d273688d90de8f173395b451)