Start MountService before performBootDexOpt

This change is to start Mountservice before starting
performBootDexOpt, as in one case, in performBootDexOpt
when system upgrade happens, StorageManager will be started to
get the low threshold of DataDir. But, at this point, as
Mountservice is still not up, StorageManager will end up
having a null object of Mountservice.

Change-Id: If2b5e1b58e7d2a72c6313f196e98a68738295ec6
Be increasingly aggressive about fstrim if it isn't being run

The current heuristics depend on devices being alive at midnight+ in
order to run periodic background fstrim operations.  This unfortunately
means that people who routinely turn their devices off overnight wind
up with their devices *never* running fstrim, and this causes major
performance and disk-life problems.

We now backstop this very-friendly schedule with an increasingly
aggressive one.  If the device goes a defined time without a background
fstrim, we then force the fstrim at the next reboot.  Once the
device hits the midnight+ idle fstrim request time, then we already
aggressively attempt to fstrim at the first available moment
thereafter, even if it's days/weeks later without a reboot.

'Available' here means charging + device idle.  If the device never
becomes idle then we can't do much without rendering an in-use device
inoperable for some number of minutes -- but we have no evidence of
devices ever failing to run fstrim due to this usage pattern.

A new Settings.Global element (type 'long', called
"fstrim_mandatory_interval") is the source of the backstop time.  If
this element is zero or negative, no mandatory boot-time fstrim will
ever be performed.  If the element is not supplied on a given device,
the default backstop is 3 days.

Adds a new string to display in the upgrading dialog when doing
the fstrim.  Note it is too late for this to be localized, but since
this operation can take a long time it is probably better to have
it show *something* even if not localized, rather than just sit there.

Bug 18486922

Change-Id: I5b265ca0a65570fb8931251aa1ac37b530635a2c
Properly recognize repeating wakeup alarms

cherry-pick from lmp-mr1-dev

The code in place was inappropriately treating all recurring alarms
as non-wakeup for purposes of deferral.  Worse, it was overriding the
"this deliverable batch of alarms includes a wakeup alarm" bookkeeping,
so could potentially cause inappropriate deferral of even standalone
wakeup alarms.

Bug 18591317

Change-Id: I2a62ed4badcaeb549c1ac4f086014aa829e45427
(cherry picked from commit 864d42eb96a9127b7d2f10ad11e709c24b4b4304)
Tune delivery and batching of alarms

cherry-pick from lmp-mr1-dev

* Inexact alarms no longer coalesce with exact alarms.  The motivation here
is that exact alarms are far more likely to be wall-clock aligned, and in
general pulling all alarms toward wall-clock alignment is a bad idea.

* Wakeup times are now fuzzed within the target batch's allowed window
rather than being hard pinned at the start of the window.

Bug 18631821

Change-Id: Iefaf34eee3f2a6546abefc27e177ee2fdcff935f
(cherry picked from commit 81f9882b5aadd6a2289c9f521a06a7af5f35ebf0)
framework: add blacklist disconnect cause

Constant to be used when marking a Call as blacklisted.

Change-Id: If8e0ba7a2fb9b3ebbcfde04df48cd0ab14bba864
Signed-off-by: Roman Birg <roman@cyngn.com>
Update color dependent items when reusing notifications.

The notification might have changed its color setting.

Change-Id: Icf494db47b30af5505107eec2f728fb8bcba421a
Battery text mode: fix MSim crash

Change-Id: Iff1e39ee2b1bb8118f310a0f30b9bcc6baace243
VideoView: Add logs for video start/stop profiling

Add logs to profile video start and stop latencies.

Change-Id: Ic7f6237ee932a5c07828b1d0010dcb0fd3175411
Move media player list management to Audioservice

Move media player list management to Audioservice so that
list is retained even after BT restart.

Change-Id: Ia2455e6def1900b4af2225c50e1b5325a7ce1a98
Revert "MediaMuxer: handle expection for add track"

This reverts commit 0e57858602657ccbb22d6f592831f6e2547cc4ef

Change-Id: Ia9b4969a660a9816b1698fabd5456400fca84563
audio: fix unresolved link error for javadoc

- Remove @link comments for extended audio
  formats to fix unresolved link error while
  compiling Javadoc
- These extended audio formats are not standard
  AOSP definition and should not be updated for
  javadoc

Change-Id: I34fec0d9709a7def0f92660b6ec0a8e971529161
DocumentsUI: Fix download status was displayed incompletely

The layout arrangement of date, size and summary are unreasonable.
Text was ellipsized when summary has too much characters.

Reconfigure "layout_weight" of date, size and summary can fix this
issue.

CRs-Fixed: 619201

Change-Id: Ic2db20a303dd1db7e2d3375e4b733d704daf393b
Download: use "control" column to mark paused/resumed status

Before, column "status" is directly updated when user pauses/resumes
download, this causes status shown to user is not same as real status
because pausing/resuming needs a little time not instantly, and then
causes some status error.

The column "control" is updated instead of "status". When user pauses
download, will update "control" as CONTROL_PAUSED and set "status" as
STATUS_PAUSED_BY_APP until pausing operation is finished; and when
user resumes download, will update "control" as CONTROL_RUN and change
the status as STATUS_RUNNING until DownloadThread is started to run.
Then the status shown to user will be same with real download status.

Change-Id: I2204b972d24b809f7914b0981cad11e9175f4ae6
CRs-Fixed: 737182
Revert "camera2-legacy: Workaround max jpeg/preview size AR mismatch"

- This reverts commit a0496d34ffc5153bf933cacbd4be71a4a1bd4041,
  because it breaks CTS test cases:
  'android.hardware.camera2.cts.RecordingTest#testBasicRecording'
  and 'android.app.cts.SystemFeaturesTest#testCameraFeatures'.
- Above change causes all video sizes that doesn't match
  the largest still image aspect ratio to be threated as
  non-supported (not looking reasonable).

CRs-Fixed: 747378
Change-Id: Ib38b39e6ba575b4644cdaeb94391068845337044
SystemUI: kill MSim logspew

Change-Id: I64ce4e61402d43d4d12ef6a80a9cb42b2fb2979a
WiFi : Fix to DHCP to static IP configuration problem

WiFiStateMachine shall update the IP address configuration to
the kernel through NetworkManagementService.This notification
from the kernel is again sent to the connectivity service
through the NetLinkStateTracker and WiFiStateMachine.
Thus ,if the interface is down during this IP address
reconfiguration (for the case of DHCP to Static IP configuration),
Connectivity service shall be notified with old IP address ,NULL(0)
IP address(signifying interface down) and the latest IP address.
This notification was done by updating the IP address using a local
variable , and hence the second notification on the interface down
is over ridden by the last notification , resulting in missed
interface down notification to the connectivity service.This
resulted in failed data connection when IP address is changed from
DHCP to IP on the fly.
Hence ,this gerrit enhances the design and also pass the updated
IP address to the connectivity service.

Change-Id: I50cd0502c5f8259b1325ed68de870b592d96ae22
CRs-Fixed: 750277
Wifi: Add a flag to indicate duplicate network

Add a flag to indicate if a wifiConfiguration is duplicate or not
This flag decides whether the previous network history along
with IP and proxy configurations are required to be copied
or not.

Change-Id: I663d985031c82e64f889044441daee70d17e5ddc
CRs-Fixed: 760505
Revert "wlan: Provide runtime option to enable or disable rssi threshold (base)"

This reverts commit b95c030a6ffa22b8c96d5358ee34ed835085a172.

RSSI threshold parameters are now user configurable.Below are the
parameters.
THRESHOLD_UNBLACKLIST_HARD_5G
THRESHOLD_UNBLACKLIST_SOFT_5G
THRESHOLD_UNBLACKLIST_HARD_24G
THRESHOLD_UNBLACKLIST_SOFT_24G
THRESHOLD_INITIAL_AUTO_JOIN_ATTEMPT_RSSI_MIN_5G
THRESHOLD_INITIAL_AUTO_JOIN_ATTEMPT_RSSI_MIN_24G

Hence reverting the gerrit

Change-Id: I0d589cd494a488a4618434314e76fefde1275abd
CRs-Fixed: 757958
Fix blacklist unknown number mode query string.

The same was string was being used to query the database for both private and
unknown numbers, with the effect that enabling private number blocking also
blocked unknown numbers.

Change-Id: I5a77566fde3187ff6044415c64e74ce4e10cd4dc
base: added national roaming info for Play in Poland

Cherry-picked from OmniROM:
https://gerrit.omnirom.org/#/c/3382/

Users of Play in Poland (MCC 260 MNC 06) can roam on
Plus, T-Mobile, Orange (MNCs 01/02/03)

Change-Id: I8ea62b0ca40bac9ced11802ee8ef583d6392a199