[1/2] User configurable safe headset volume

* Add a user configurable option to
    enable/disable safe headset volume.
* Add restore volumes after boot and when a headset is plugged.

[1/2] 用户可配置的安全耳机音量

* 添加一个用户可配置的选项
    来启用/禁用安全耳机音量.
* 添加耳机插入时, 设备启动后恢复音量.

[2/2] in platform_packages_apps_Settings

Thanks to CyanogenMod for the original implementation.
感谢CyanogenMod原创实现此功能.
Add [core] zh-rCN translation by @silverhoo1124

添加来自 @silverhoo1124 的[core]部分简体中文翻译
Two-line layout for status bar date

通知栏日期双行样式
Prevent lock/unlock sound during music playback

Lock/unlock sound mixes in with music and causes
lag and distortion.

在播放音乐时阻止播放锁屏/解锁声音

锁屏/解锁声音和音乐混在一起会造成卡顿和失真.
[1/2] User configurable (un)plug wake/nofitication

Add a user configurable option to enable/disable
* Wake the display when charger power is connected/disconnected.
* Play notification sound when charger power is connected/disconnected.
* Vibrate when charger power is connected/disconnected

[1/2] 用户可配置的(断开)连接唤醒/通知

添加一个用户可配置的选项来启用/禁用
* 充电电源连接/断开时唤醒屏幕.
* 充电电源连接/断开时播放通知声.
* 充电电源连接/断开时震动.

[2/2] in platform_packages_apps_Settings

Thanks to CyanogenMod for the original implementation.
感谢CyanogenMod原创实现此功能.
Add [SystemUI] zh-rCN translation by @silverhoo1124

添加来自 @silverhoo1124 的[SystemUI]部分简体中文翻译
[1/2] Slim recent panel

* Add Slim recent panel.
    Dependency repo: platform_frameworks_opt_cards
* Add user configurable expanded mode.
    Allow user to choose between the following mode:
    * Auto (default)
    * Always expanded
    * Always collapsed
* Add lefty mode.
    Allow recent panel to show up on the left edge
    instead of the right edge for left handed people.
* Add scale mode.
    Allow user to scale recent panel size down.
* Add favorite mode.
    Keep favorite tasks in the task list when clear all.
* Fix recent thumbnail click/dismiss animation.
* Fix random FC on pinch.
* Add always show translucent decor on recents panel.

[1/2] Slim最近应用面板

* 添加Slim最近应用面板.
    依赖repo: platform_frameworks_opt_cards
* 添加用户可配置的展开模式.
    允许用户从以下模式中选择:
    * 自动 (默认)
    * 总是展开
    * 总是折叠
* 添加左利手模式.
    允许最近应用面板从左侧出现(而不是从右侧),
    方便左利手用户操作.
* 添加缩放模式.
    允许用户缩小最近应用面板尺寸.
* 添加星标模式.
    清除全部任务时保留加星标的任务.
* 修复最近应用面板缩略图 点击/清除 的动画.
* 修复捏合手势时的FC.
* 添加最近应用面板始终显示半透明装饰栏(即通知栏和导航栏).

Kudos to SlimRoms for the awesome original implementation.
向SlimsRoms对此功能的原创实现致以崇高的敬意.

[2/2] in platform_packages_apps_Settings

Reference commits:
参考commits:
SlimRoms/frameworks_base@a1b3aa9eb2a74c4c7c167906e5c8c3081db1ccdb
SlimRoms/frameworks_base@9c1c3c0955d51adc589ec6fbb667a0ae482de24e
SlimRoms/frameworks_base@3fd2bf959f8279ebfb65c55e157c19f72526c751
SlimRoms/frameworks_base@72ce3bbd3a117572e85a9837eceaaca191c86f3a
SlimRoms/frameworks_base@fb32d4cb2303e354fadb5ecc3d12d223edf40c3b
SlimRoms/frameworks_base@0347f610f048699157af5b958729a76dcc8f09c7
SlimRoms/frameworks_base@c6deddcaa57de4b418f8e1eee607b45b99c1671d
SlimRoms/frameworks_base@d0f982c4a9d551a9b76c55a7c8e9150cb650c085
SlimRoms/frameworks_base@247961e595003c7b62f8acd5d1074585b5421b03
SlimRoms/frameworks_base@64f9878a99b7574cb9130bf17b50ffd24213a59f
SlimRoms/frameworks_base@d2a76f297efe0285ac53e8fc63c45fbad131d2a4
SlimRoms/frameworks_base@189127bceed4e8295241328ed6ae046cd606ad25
SlimRoms/frameworks_base@4d10958b149a99bf6fb76f904b7f2f14dfd68aaa
SlimRoms/frameworks_base@9398710a50b9dd78ba70064b8b699e6c87e2f86f
SlimRoms/frameworks_base@cc525c326f61f741917af841041f736992028405
SlimRoms/frameworks_base@6c7aa01ec52ec527fd7b0fba64edbe065993c9d3
All You Need is Dark & so long #33B5E5

There's nothing you can do that can't be done
Nothing you can sing that can't be sung
Nothing you can say but you can learn to play the game
It's easy

There's nothing you can make that can't be made
No one you can save that can't be saved
Nothing you can do but you can learn to be you in time
It's easy

All you need is dark
All you need is dark
All you need is dark, dark
Dark is all you need

-----------------------------------------------------

Oh and btw, so long #33B5E5.
Add Google location provider

Fix the location service.

添加Google位置提供

修复位置服务.
Fix backup transport service

修复备份传输服务
All You Need is Dark & so long #33B5E5 [Part II]

This part is for Documents (and also Downloads),
while the previous part is for global UI.

这部分是针对"文档"(以及"下载")的,
而先前的一部分是针对全局UI的.

There's nothing you can do that can't be done
Nothing you can sing that can't be sung
Nothing you can say but you can learn to play the game
It's easy

There's nothing you can make that can't be made
No one you can save that can't be saved
Nothing you can do but you can learn to be you in time
It's easy

All you need is dark
All you need is dark
All you need is dark, dark
Dark is all you need

-----------------------------------------------------

Oh and btw, so long #33B5E5.
[3/3] Incoming call in background

****
This feature prevents the incoming call from backgrounding
the current activity. Which is different from the
"non-intrusive incall ui" feature.
****

Add a user configurable option to keep the incoming call
UI in the background when screen is on.
Instead, a notification will be added to notification bar,
which can be used to bring up the incoming call UI.
Ringtone and vibration still occur as per system settings.

Also, the notification added to status bar contains
decline and answer call action. This allows user to
take action directly within the notification without
having to enter the incoming call UI. As well useful
for declining or answering a second incoming call.

[3/3] 后台来电

*****
此特性可阻止来电强行插入前台而将前台正在进行的活动挂入后台.
与"非侵入式来电UI"并不一样.
*****

添加一个用户可配置的选项从而在亮屏时将来电UI置于后台.
同时, 会有一条通知被添加至通知栏, 可点击调出来电UI.
铃声及震动(根据系统设置)不受影响.

另外, 添加至通知栏的通知包含接听和挂断按钮. 允许用户直接
在通知栏里进行操作而不用调出来电UI. 同时对于通话过程
中处理新的来电也很有用.

[1/3] in platform_packages_apps_InCallUI
[2/3] in platform_packages_services_Telephony
[3/3] Flip to mute/decline incoming call

Add user configurable options to flip the phone in order to
0: mute call
1: decline call
2: do nothing (default)

[3/3] 翻转以 静音/挂断 来电

添加用户可配置的选项来翻转手机以
0: 静音来电
1: 挂断来电
2: 啥也不干 (默认)

[1/3] in platform_packages_apps_InCallUI
[2/3] in platform_packages_services_Telephony
Parallel shutdown

Decrease shutdown time by doing some shutdown tasks in parallel.

There are two threads executing during the shut down:
the ShutdownThread and a separate thread for the radio shutdown.
However, the execution is done in serial,
as the ShutdownThread immediately joins on the radio thread.

This commit will move the shutdown of the radio to the
beginning of shutdown and execute it in parallel to the
shutdown of the rest of the system.

The flow of the two threads during shutdown is now:

Radio Thread
  * Start shutdown of the radio
  * Wait for radio off or time out
  * Notify that the radio is done
ShutdownThread
  * Broadcast ACTION_SHUTDOWN as a parallel broadcast.
    (The receivers will get as much time to handle
    onReceive as it takes execute the rest of the tasks
    in the shut down flow. If they are not done in
    that time, we don't care.)
  * Shutdown ActivityManager
  * Shutdown MountService
  * Wait for MountService and radio to notify done
  * Vibrate
  * Low level shutdown

并行双线程关机

通过并行一些关机任务来减少关机时间.

关机时会执行两个线程: ShutdownThread和一个独立的线程来
关闭通信基带. 但是, 这个执行是依次执行的. 在通信基带关闭后
ShutdownThread的任务会立刻接上去.

而这条commit将关闭基带的任务移至关机任务最开始的位置,
并将其与系统其它部分的关闭同时执行.

现在关机的双线程流程如下:

通信基带线程
  * 开始关闭基带
  * 等待基带关闭或延时
  * 提示基带已关闭
ShutdownThread线程
  * 将ACTION_SHUTDOWN的Broadcast Action以并行broadcast的方式
    发出. (这样接收方就有和完成余下的关机流程同样多的时间来
    处理onReceive. 如果他们届时没有完成, 我们也不受影响.)
  * 关闭ActivityManager
  * 关闭MountService
  * 等待MountService和基带提示已关闭
  * 震动
  * 底层关机

Original commit in AOSP
AOSP中的原commit
https://android-review.googlesource.com/83597/
Some improvements on strings

-- core --
* Replace "your tablet/phone" with "your Nexus"
    in shutdown dialog, to make it consistent with
    our reboot dialog.
* Delete reboot_system strings which are already dead.

-- SystemUI --
* Replace "Sleep" tile label with "Power button"
    which makes more sense since longpress the
    tile opens the power menu.

一些strings的改进

-- core --
* 替换关机对话框中的"您的平板电脑/手机"为"你的Nexus",
    以保持和重启对话框的一致性.
* 删除reboot_system的strings, 他们已经死了...

-- SystemUI --
* 替换"锁屏"磁贴标签为"电源按钮", 这样更合理一些
    因为长按这个磁贴会打开电源菜单.
Fix volume adjustment with headset connected

Issue Description:
When headset connected, the system/voice call stream volume
can't be adjusted from volume bar.

Root Cause:
Currently adjustStreamVolume is applied to stream type
alias and the device for the stream alias.
So when headset connected and adjust volume for SYSTEM_STREAM,
the operation will be applied to RING_STREAM
(which is aliased by SYSTEM_STREAM) and speaker.
As headset is returned from getDeviceForStream(SYSTEM_STREAM),
but speaker for RING_STREAM.

Solution:
Change the adjustStreamVolume to apply volume to the stream
alias and the device for the stream type exactly.

修复耳机插入时音量调节的问题

问题描述:
当耳机插入时, 系统/通话音量无法通过音量栏调整.

问题根源:
目前adjustStreamVolume被应用在streamTypeAlias上,
同时device也采用streamTypeAlias.
因此当耳机插入时, 调整SYSTEM_STREAM则会被应用到RING_STREAM
(被SYSTEM_STREAM别名)和扬声器上.
由于耳机从getDeviceForStream(SYSTEM_STREAM)返回,
而扬声器从RING_STREAM返回.

解决方法:
修改adjustStreamVolume从而让音量应用在streamAlias上,
而device为streamType. 从而精准应用, 不采用别名.
[1/2] QuickSettings quick pulldown & swipe to switch

* Add a user configurable QuickSettings quick pulldown option.
* Add a swipe-to-switch action between Notification/QuickSettings panel.

[1/2] 快捷设置面板快速下拉 & 滑动切换

* 添加一个用户可配置的快捷设置面板快速下拉选项.
* 添加通知面板和快捷设置面板之间的滑动切换操作.

[2/2] in platform_packages_apps_Settings