Settings: Don't hide home category if user has a settings capable launcher

By default the settings app hides the home category if it notices the user
has 1 launcher. Due to the ability to have settings per launcher, if the
user only has one launcher which happens to support settings, hiding this
category renders that feature useless.

So now we check if the user has < 2 launchers AND whether they support
a settings panel.

Change-Id: Id5dd94091a31fd9ee3637e0975816481903255bf
Settings LightSettingsDialog: update led on text change

Change-Id: I135f37829b9b4fb2166afac9d9531b76a62f3ef7
Fix memory leak in ManageApplication

ApplicationsAdapter new a Session member and make it has a reference to
it self. If we don't release it explicitly, the cross reference will
cause memory leak.

Change-Id: Iecce35ae1d56d98cee6347e84d3a3ff57f3b15a5
Fix lockscreen rotation

CM made it so that the option was removed if a device sets
config_enableLockScreenRotation to false.
However that bool is defined false on fw_base, which leads to it being
always removed.

So we remove this unnecessary check.

Change-Id: I28b66fc70a9d32275a467349f1301d7d136708a8
Move home & menu unlock to CF

Revert "Settings: Home & menu unlock"

This reverts commit 38f3ff1b997fd5edde8ab92d1738141584a58b9e.

Change-Id: I52eb28543aeb3b23365da5cff12c09f83b6feb58

Conflicts:
	res/values/cr_strings.xml
Addon to last commit
Settings: TRDS 3.0 and new theme engine preparation (4/4)

For the one who do not know this feature see as reference
the first two versions here:

https://github.com/SlimRoms/frameworks_base/commit/b330fde28306286572ba390e451a72539c0c3576

https://github.com/SlimRoms/frameworks_base/commit/3194015737b7944b4185fca007b8d167a0675cd8

we got now over a year now a lot experience how to handle the qualifier fallback
as well how to theme it and how to handle other apps. Based on this knowledge we
redid some parts of TRDS engine with following new features/additions and fixes
to have now a final perfect working TRDS

- compared to the old versions where it was needed on some apps to restart them
  in background this is not needed any more. All is handled about the internal
  AOSP resource handling and on qualifier change the caches are cleared
  and the apps get an onconfigurationchanged to restart the activity
  like it is doing on orientation change eg
- inverted folder is now depreciated and the new folders are holodark
  and hololight which allows on the one hand a dark theme (at least
  how TRDS started) and a light based theme hololight
- This name change is mainly because of the new theme engine which
  will come which uses this as base to add 2 external themes at the same
  time and give the user the ability to switch between them. But this is
  still in early stages and this commit is just the preparation for it
- Two new automodes are now integrated. User can enable the twilight modus
  which enables/disables holodark/hololight depending on the daytime...means
  on the evening it switches to holodark on normal day it is hololight.
  The other automode is based on light conditions....means that if it is
  dark outside it switches to holodark....if we have bright light conditions
  it switches immediatelly to hololight. Due of the resource cache handling now
  this happens immediatelly for the user and feels completly system integrated
  and happens without delay. A bit comparable to some navigation tool for cars
  which can switch automatically from dark to light and back
- currently the auto modes as well the manual mode switches between holodark
  and hololight. Due that we do not have currently anything hololight themed
  in the source hololight = stock theme. We will give the user the ability
  later when done to choose between which modes the user want to switch
  (stock/holodark/hololight). But this does not make sense at the moment.
  As soon as we have done the light theme or theme engine (lets see what
  comes first) we will open the ability to choose it. This is only a small code change
- a lot small tweaks and fixes went as well into the new version

Whatever this commit as usual adds the support for it. The themeing is done in the
other commits by kroz which is as well way more extended then on the older versions

cheers

PatchSet:
- derp
PatchSet3:
- tired me derp again
PatchSet:
- adapt to new qualifier structure

- listen to onconfigurationchange and mode settings value
  and let the switch
  switch if the uiThemeMode has changed. As well permit
  manual switching if automatic light mode is enabled
  and inform the user about

PS4: New light bulb icon

Change-Id: I5b857c542d92b9fd253b3556f14c790226594c4f

settings: TRDS some tweaks and fixes (2/2)

some smaller issues fixed and optimizations:

- fix twilightmode was wrong assigned to wrong value
- ligtsensor mode after first immediattely switch it does
  not allow for 5sec to switch again....after the 5sec it switches
  to current state if the sensor changed its state in this time.
  This prevends on the one hand on bad light conditions a permanent
  switch between dark/light as well it does not bring the system into
  troubles due of to much configuration changes at the same time
- get rid completly of the observe for the UI_THEME_MODE value and
  handle all over the UIModeManager
- adapt slimActions and settings to this new behaviour/method
- some cleanup and minor fixes

Change-Id: I099eb70f179149bcc519a209b93063529349f1e2

Change-Id: I5b857c542d92b9fd253b3556f14c790226594c4f

Conflicts:
	res/values/cr_arrays.xml
	res/values/cr_strings.xml
	res/xml/settings_headers.xml
	src/com/android/settings/Settings.java
Enable Back-key when go to Emergency call

When go to "Emergency call" from lock screen, back key is disappeared.
It is difficult for user to find the way to go back to previous screen.
This might be bad user experience. So we are going to make it enable.

Change-Id: Iefcca9b8943472c24ddbca6e3ec3441e93e5be91
BT: Multi HF support in Settings App.

1. The connected sinks are not disconnected from
HeadsetProfile when new sink is connecting.
2. Also return correct connection status for
specific HS.
3. Sets priority for specific HS while disconnecting.

Change-Id: I876f9810be82482cb360451343e4eb2a9f3ed668
Telephony: Use new apn.sim.operator_numeric property

Use new property to filter apns. We need this new property
because icc.operator_numeric property is also used in cdma
and ApnSetting UI might display wrong set of apns if the
peroperty value used was set by RuimRecords.
CRs-Fixed: 362846

Change-Id: Ie740c9b3bb6a14621e19c55e4fa18c66bc0d7b0c
(cherry picked from commit b74be3a91ed12c29626edf64bce34a154d4b1db1)
(cherry picked from commit bb13705113a67b493530cf1a8e8ffdca2887093f)
(cherry picked from commit 6cd912d7f13d0985eaa03fa2171f7983c0d2671c)

Conflicts:
	src/com/android/settings/ApnEditor.java
	src/com/android/settings/ApnSettings.java
Telephony: Avoid list of Apns in ApnSettingsMenu

Don't display any Apns in the ApnSettingsMenu when
getOperatorNumericSelection returns empty

Change-Id: I8f425e75c995f9825905983dc1bdc94f15f2054e
CRs-fixed: 486026
(cherry picked from commit 09e0403e2199c65e567775994ffe990281fc5183)
(cherry picked from commit d483b697e2acc4eef23a8cd743be97b2febdb565)
(cherry picked from commit c89dc4e90cff4d0f3342cf3862d159ff785b2a2e)
Multisim: Add support for MSIM

Add Multi SIM Settings screen in UI which is used to select
Voice, SMS, Data preferences.
Extend APN Settings, Security Settings, Wireless Settings
for MSIM.

Subscription specific for Mobile data, roaming and usage
 - Provide per subscription based support for both Mobile Data
   and Data roaming options. UI and functionality changes in:
   a. Settings -> Data Usage application
   b. Settings -> Mobile Networks menu
 - Provide per subscription based data usage information. UI and
   functionality changes in Settings -> Data Usage application.

Add prompt support for SMS
 - Add prompt option in SMS multi sim settings.
 - New iterface API to get SMS prompt is enabled or not.
 - Disply prompt while sending SMS, if user selects
   prompt mode in multi sim settings

Extend CB "Operator info" feature to MSIM.
 - Add SUB information while broadcasting CB intent for MSIM.
 - Remove country specific checks for cellbroadcast Operator
   info for MSIM.
 - Move Operator info to About phone->Status->SelectSubscription
   ->SUB1/SUB2->Operator info in MSIM

Change-Id: I84abe80f20de2415ff819c7250ef0a0799662b52
(cherry picked from commit ccfd14b8a86c78c6a179a70be1357131b80d4823)
(cherry picked from commit 794b5787304bed493bbde3e9c9010a4b82824641)

Conflicts:
	res/values/arrays.xml
	src/com/android/settings/ApnSettings.java
	src/com/android/settings/DataUsageSummary.java
	src/com/android/settings/DeviceInfoSettings.java
	src/com/android/settings/Settings.java
Settings(MSIM): Add TuneAway and PrioritySub to MultiSimSettings

1. Add support for TuneAway and PrioritySub UI options in
MultiSimSettings
2. Add setDefaultVoiceSub, setTuneAway and setPrioritySub
OEM HOOK requests in OSS space

Change-Id: I3b1bc4ed98b3ed7b280938878ba9d7bdb244fcf9
CRs-fixed: 464483
Add support for below network modes info in hidden menu

 LTE/WCDMA
 TD-SCDMA only
 TD-SCDMA and WCDMA
 TD-SCDMA and LTE
 TD-SCDMA and GSM
 TD-SCDMA,GSM and LTE
 TD-SCDMA, GSM/WCDMA
 TD-SCDMA, WCDMA and LTE
 TD-SCDMA, GSM/WCDMA and LTE
 TD-SCDMA, GSM/WCDMA, CDMA and EvDo
 TD-SCDMA, LTE, CDMA, EvDo GSM/WCDMA

Add support for other network modes in set preferred
network mode UI option in phone information in hidden menu

Change-Id: Id3fd9a27be84e85f4f32a0fd2a7eee9eec545227
CRs-Fixed: 569944

Conflicts:
	src/com/android/settings/RadioInfo.java
MSIM : Enhance UI when no SIM / single SIM is present

As part of this change, the following UI enhancements are done:
1)"SIM card info not available.Menu cannot be accessed" will be
displayed to user on accessing the multiSIM menu when
no SIM card is inserted
2)If a single SIM is inserted, only Configure
subscriptions menu inside Multi SIM setting will be accessible
to the user.The remaining options will be grayed out
3)If multiple SIM cards are inserted, all options inside
Multi SIM setting will be accessible

In case of airplane mode, based on the availability of
SIM card info the UI specified above is displayed

Change-Id: Id41f3b3260ed72dbf43413d49da9b9e5019aef69
CRs-Fixed: 554727
Settings: Tune Away option is not retained on UI.

The Tune away status setting is not written to the settings
database. Writing the value to Settings database through
MSimPhoneFactory in telephony framework.

Change-Id: Ieb27c6e421d37308e0d97e26dbd8db52281d966d
CRs-Fixed: 533245
Settings: Removal of DSDS menu in SSSS mode

Add new intent filter
"codeaurora.intent.filter.settings.multisim.SHORTCUT"
to de-couple MSIM setting menu in non-DSDS mode.

Change-Id: Ie7df65570095fd570ab48736072b03ac5b1b0027
CRs-fixed: 539932
Add initial preferred APN feature

In multi-sim scenarios, each sim will have its own preferred APN
setting. When ApnSettings sets/reads the preferred Apn, SUB id will
be passed to TelephonyProvider.  TelephonyProvider will update/return
the value of the key 'apn-id0' or 'apn-id1' based on the given SUB id.

Change-Id: Ifbbb49f2b38a5c6cff56785313a80a34479ea08f

Conflicts:
	src/com/android/settings/ApnSettings.java
Telephony (MSIM): Retain the pref selection when set voice sub fails.

When set voice subscription fails due to sub not activated, the
preference selection is not reset until the Activity is resumed.
Return false for onPreferenceChange() so that UI is reset back to
original value.
Similar fix done for set priority subscription and set sms
subscriptions also.

Change-Id: Ia12a88db87ff442713785b4501e227f37ee10c95
CRs-Fixed: 577949
Unbreak the APN editor

Change-Id: I4f0b27628539473381fb28b6d60dd5eacd8e1fd4

Conflicts:
	src/com/android/settings/ApnEditor.java