AssetRedirectionService: Check for permissions before running dump()

Fix android.security.cts.ServicePermissionsTest failure

Change-Id: I9d629d19f3ff231db477d156c8bf557d4b8ee861
Fix ringer mode being unneededly changed by setting ringer mode volume
to 0.

When having set the ringer mode to silent on a device with vibrator and
calling setStreamVolume() for the ringer stream again (e.g. in one of
the volume control dialogs in the settings app), the ringer mode is set
to vibrate, although there's no reason to do so.

Fix that by remembering the last non-normal (that is, either silent or
vibrate) ringer mode and using that when setting the stream volume to 0.

Change-Id: I27f1c75a0fef52bd63ac20f4101042808ce2c458
JIRA: CYAN-1403
Lockscreen : Fix widgets disabled

Currently, when keyguard widgets are disabled via the DevicePolicyManager,
a default widget if specified via widget_default_package_name/widget_default_class_name
is added on the main screen, and if not successful the default status widget is added.
However in its current state, each cycle of the lockscreen alternates between the two widgets.
Reason is, the default app widget is constantly recycled on screen power cycles, and in such events,
when checkAppWidgetConsistency() fails to add the widget (since the id is no longer valid), it toggles
back to the default status widget, and resets the stored id. Next cycle a new id is allocated and it works
and so on ...
This patchset addresses this issue by not removing the default status widget if not necessary, hence
preserving its id and fixing the toggling issue.

Signed-off-by: igio90 <giovanni.rocca.90@gmail.com>