565 Commits

Author SHA1 Message Date
Adrian Roos
8150d2a2a1 Require explicit userId in LockPatternUtils
Bug: 18931518
Change-Id: Ib03f37df9135f0324a998c62d165d8eea46328c8
2015-04-28 11:49:00 -07:00
Svet Ganov
8de348095f DO NOT MERGE Do not clean up global/system settings on package unintalls.
Legacy apps can write their own entries in the system settings and
when they get uninstalled these are hanging around forever polluting
the settings table. We keep track of which settings an app added and
when the app is uninstalled we drop its custom entries. The trouble
was that we did the same thing for global and secure settings with
no explicit list of platform defined settings. Hence, if say a test
signed by the platform certificate touches platform defined global
or secure settings and is then uninstalled, we would drop the platform
defined entries portentially crippling the system.

bug:20113160

Change-Id: Ia21694f6326ad4a1795c4666027b366e26c05a23
(cherry picked from commit b128540dc741c424d4f652419686882b7a3bfa06)
2015-04-27 17:49:35 +00:00
Geoff Mendal
f748bb3051 Import translations. DO NOT MERGE
Change-Id: Ic375b06aab79b9b7d17754eba4dd9d182a669734
Auto-generated-cl: translation import
2015-04-24 23:58:45 -07:00
Svet Ganov
e723e54650 Revert some unnecessary changes in handling XML read
Change-Id: I3bbbc3159930d80e2e1f28fa9c0035ae5029d4b8
2015-04-23 11:58:26 -07:00
Svet Ganov
ba0821ed3b Make read/write from/to XML persistent state more robust.
When writing critical state to XML an excpetion can lead to creating
a malformed XML that is later parsed and may put the device in a bad
state. Hence, on any error while writing we should bail out and drop
the partially write state on the floor.

Corollary, any error on parsing can lead to having a partially read
state that is not consistent which may lead to writing this bad state
back to disk. Hence, on any error while parsing we should bail as
our current state may be unrecoverable.

Change-Id: Ia050c16198cb583f8a51263ad2035dbb948052b8
2015-04-22 13:42:54 -07:00
Andres Morales
8fa5665f0e Wire up GateKeeper to LockSettingsService
Adds:
- Communication to GKService
- password upgrade flow
- enroll takes previous credential

Change-Id: I0161b64642be3d0e34ff4a9e6e3ca8569f2d7c0a
2015-04-13 18:38:45 -07:00
Jeff Sharkey
1b8ef7e316 Parcelable objects for Disk/Volume.
Will eventually be used by SystemUI and/or Settings.

Also fix SettingsProvider NPE.

Bug: 19993667, 19909433
Change-Id: Ie326849ac5f43ee35f728d9cc0e332b72292db70
2015-04-04 14:40:46 -07:00
Jeff Brown
fd93eaf278 Merge "Clarify settings update code." 2015-04-02 23:12:51 +00:00
Svet Ganov
c9755bc4f2 Fix a regression in settings parsing
Change-Id: I222bac482a843112ae031b00c83e3765ea6b456c
2015-03-28 13:21:22 -07:00
Svet Ganov
8440ca3934 Relax the parsing code in settings provider.
The practice in the system server is to have lenient parsing code
to avoid the whole system being unusable due to a single XML error.

Change-Id: Idf44031edf5221966f3352ca2f83e284973ab95f
2015-03-27 17:58:40 -07:00
Jeff Brown
503cffc181 Clarify settings update code.
Change-Id: I650ff827bc31eacff2efcdba84e6ef41016ad51c
2015-03-26 18:08:51 -07:00
Christopher Tate
7b9a28c7f0 Back up and restore the set of enabled IMEs
The restored set of enabled IMEs/subtypes is merged into the
current state of the system, rather than simply replacing it.
This is because we do not want to accidentally disable or
reconfigure something that the user is currently relying on.

There's a certain amount of repetitive activity here, rebuilding
the enabled-state data structures in a different format, but it's
important for maintainability that the restore code be able to
rely on the core InputMethodUtils implementation of reading/writing
the settings element.

Bug 19822542

Change-Id: If0104151b3526da6ecc669adde3119a239ecafeb
2015-03-23 16:28:21 -07:00
Geoff Mendal
273c6f2e00 Import translations. DO NOT MERGE
Change-Id: I0acc044f88445fe6d48f84bcaee6a971409ad144
Auto-generated-cl: translation import
2015-03-21 02:02:20 -05:00
Svetoslav Ganov
e1519582ab Revert "Persist settings on a normal priority thread."
This reverts commit d289e64a2d7c8efba78b9066b647ee321eba701a.

Change-Id: Ic9455b538e0be8b9a4e4672f99b14978e70d2911
2015-03-17 22:00:37 +00:00
Christopher Tate
2d4aadca94 Merge restored accessibility enable state, don't overwrite
We do not want to accidentally disable the user's currently-enabled
accessibility service(s); presumably they turned them on during
setup for a reason.  We now merge the prior + current states rather
than simply replacing the current state with the former.

Bug 19427367

Change-Id: I96eb47df57318c88066c5da6862f23f656639148
2015-03-16 17:39:07 -07:00
Christopher Tate
6597e3435f Notification listener backup & restore
We now back up & restore the set of enabled notification listeners.  Post-
restore, a listener that had been enabled on the ancestral device will be
enabled on the current device as soon as it's installed, matching the
user's previous configuration.  After this has happened the enable/disable
state for that app is not "sticky"; disabling it again will work as
expected.

The infrastructure for accomplishing this is general: it can be leveraged
by any ManagedServices derivative.  There's a bit of extra wiring in the
settings provider to support the restore-time information flow as well.
This is because ManagedServices -- like many other parts of the system --
monitors writes to the settings provider and does work in response to new
writes of the elements that it cares about.  Unfortunately this means that
there is no way to use the BackupAgent's restoreFinished() hook to post-
process the restored data: by the time it is run, the ManagedService's
observers have already executed and culled any unknown components from
the description that was just pushed into settings.

As of this patch, the settings provider's restore logic knows that a
particular settings element will require a message to interested observers
about the restore-driven change.  The message is delivered as a broadcast,
and is sent after the new value has been committed to the settings db.
Adding other system ManagedService handling that parallels this will only
require adding a new corresponding entry to the table of individual settings
for which the relevant "this settings element is being restored" broadcast
is sent, found in SettingsHelper.

(It isn't sent for all settings elements because very few settings elements
have semantics that require it; 3rd party code won't be running yet during
platform restore anyway; and sending up to hundreds of broadcasts during
setup & restore is far from ideal.)

Bug 19254153

Change-Id: Ib8268c6cb273862a3ee089d2764f3bff4a299103
2015-03-16 16:24:28 -07:00
Svetoslav
d289e64a2d Persist settings on a normal priority thread.
We were doing the work for persisting settings on a background
priority thread and as a result persistence was not happening
correctly on a low end devices. Now we use a worker thread with
normal priority.

bug:19611897

Change-Id: I378c6e324935f5e3def8b986bd48486bfab55265
2015-03-13 12:08:45 -07:00
Raph Levien
174fa280d1 Fix XML parsing crash in SettingsProvider
A previous change added more whitespace to settings_global.xml to
improve human readability, but the parser is overly picky in ignoring
whitespace. This patch makes it accept all whitespace strings.

Bug: 19696812
Change-Id: I3ebb8f6df2e25f4e6b6841da743be3f3a91e2442
2015-03-11 14:37:45 -07:00
Svetoslav
c3f56c3cb5 Make settings XML files readable
Change-Id: I320f5419e045d257dc5ccbf81a9434f9b9d38564
2015-03-10 16:53:35 -07:00
Amith Yamasani
072543f580 Backup/restore owner info from locksettings
Backup the owner info string and whether or not
owner info is to be shown on the lockscreen.

Watch for changes to the two settings in LockSettingsService
and inform backup manager.

Bump up version numbers for the new entity.

Bug: 19300363
Change-Id: I35485c961d18b26be68873f4d5eeedc5ae513cc8
2015-02-18 16:03:25 -08:00
Christopher Tate
8561ff98cd am 32f216c3: am 8cd95aba: am 56238eaa: am 129ea76a: Fix wifi AP backup
* commit '32f216c359540219905bbe0295da31e594d83f5f':
  Fix wifi AP backup
2015-02-18 11:39:01 +00:00
Svetoslav
b596a2c5bf Location settings not properly set.
Settings provider has special handling for location providers. The
code to set the location providers was calling itself recursively
instead of updating the setting value.

bug:19361236

Change-Id: I1ef1932c7faa8226b52123aa3f23f38048258328
2015-02-17 21:41:05 -08:00
Christopher Tate
32f216c359 am 8cd95aba: am 56238eaa: am 129ea76a: Fix wifi AP backup
* commit '8cd95aba2f97eb552d437c185b156ba964886a6e':
  Fix wifi AP backup
2015-02-18 02:23:06 +00:00
Christopher Tate
8cd95aba2f am 56238eaa: am 129ea76a: Fix wifi AP backup
* commit '56238eaaa3688c9a9858058f4dc63aade7092d9b':
  Fix wifi AP backup
2015-02-18 02:17:57 +00:00
Christopher Tate
56238eaaa3 am 129ea76a: Fix wifi AP backup
* commit '129ea76a4a129fb3e8e997e8c604c0712e8a9d73':
  Fix wifi AP backup
2015-02-18 02:07:55 +00:00
Christopher Tate
129ea76a4a Fix wifi AP backup
An OutputStream buffers only by explicit contract.  OutputStreamWriter
buffers internally, always.  Do not get these behaviors confused.

Bug 19341967

Change-Id: I0610ed625b0175620083dd286f3a73c24956b171
2015-02-17 17:07:37 -08:00
Svetoslav
85b880035d Merge "Add dump support to the settings provider" 2015-02-18 00:11:47 +00:00
Svetoslav
b505ccc906 Add dump support to the settings provider
Change-Id: I1338af4c660e3ecc412954a7cb9b820952aae523
2015-02-17 15:57:46 -08:00
Svetoslav
2849465ee1 Handle a missed case in query the settings provider
bug:19361521

Change-Id: Ibf4731b5d665563bb87ef93a4cf63e4c4d2e46a4
2015-02-12 14:43:41 -08:00
Geoff Mendal
ceb7ae3170 Import translations. DO NOT MERGE
Change-Id: Idd108e5eb791007b3604c67ce4a0853a368a445e
Auto-generated-cl: translation import
2015-02-12 10:51:28 -08:00
Svetoslav
683914bfb1 Rewrite of the settings provider.
This change modifies how global, secure, and system settings are
managed. In particular, we are moving away from the database to
an in-memory model where the settings are persisted asynchronously
to XML.

This simplifies evolution and improves performance, for example,
changing a setting is down from around 400 ms to 10 ms as we do not
hit the disk. The trade off is that we may lose data if the system
dies before persisting the change.

In practice this is not a problem because 1) this is very rare;
2) apps changing a setting use the setting itself to know if it
changed, so next time the app runs (after a reboot that lost data)
the app will be oblivious that data was lost.

When persisting the settings we delay the write a bit to batch
multiple changes. If a change occurs we reschedule the write
but when a maximal delay occurs after the first non-persisted
change we write to disk no matter what. This prevents a malicious
app poking the settings all the time to prevent them being persisted.

The settings are persisted in separate XML files for each type of
setting per user. Specifically, they are in the user's system
directory and the files are named: settings_type_of_settings.xml.

Data migration is performed after the data base is upgraded to its
last version after which the global, system, and secure tables are
dropped.

The global, secure, and system settings now have the same version
and are upgraded as a whole per user to allow migration of settings
between these them. The upgrade steps should be added to the
SettingsProvider.UpgradeController and not in the DatabaseHelper.

Setting states are mapped to an integer key derived from the user
id and the setting type. Therefore, all setting states are in
a lookup table which makes all opertions very fast.

The code is a complete rewrite aiming for improved clarity and
increased maintainability as opposed to using minor optimizations.
Now setting and getting the changed setting takes around 10 ms. We
can optimize later if needed.

Now the code path through the call API and the one through the
content provider APIs end up being the same which fixes bugs where
some enterprise cases were not implemented in the content provider
code path.

Note that we are keeping the call code path as it is a bit faster
than the provider APIs with about 2 ms for setting and getting
a setting. The front-end settings APIs use the call method.

Further, we are restricting apps writing to the system settings.
If the app is targeting API higher than Lollipop MR1 we do not
let them have their settings in the system ones. Otherwise, we
warn that this will become an error. System apps like GMS core
can change anything like the system or shell or root.

Since old apps can add their settings, this can increase the
system memory footprint with no limit. Therefore, we limit the
amount of settings data an app can write to the system settings
before starting to reject new data.

Another problem with the system settings was that an app with a
permission to write there can put invalid values for the settings.
We now have validators for these settings that ensure only valid
values are accepted.

Since apps can put their settings in the system table, when the
app is uninstalled this data is stale in the sytem table without
ever being used. Now we keep the package that last changed the
setting and when the package is removed all settings it touched
that are not in the ones defined in the APIs are dropped.

Keeping in memory settings means that we cannot handle arbitrary
SQL operations, rather the supported operations are on a single
setting by name and all settings (querying). This should not be
a problem in practice but we have to verify it. For that reason,
we log unsupported SQL operations to the event log to do some
crunching and see what if any cases we should additionally support.

There are also tests for the settings provider in this change.

Change-Id: I941dc6e567588d9812905b147dbe1a3191c8dd68
2015-02-11 17:58:22 -08:00
John Spurlock
6156017c22 Move AudioService to services.
...and a few dependencies. Move remaining shared items to AudioSystem.

Change-Id: Ib9623ff867678d34977337856bb0156e8cdaeeb5
2015-02-09 17:13:38 -05:00
John Spurlock
24c0518723 Use shared value for default muteable streams.
Change-Id: Ib8fa7aee3bed83fc26945fd0caf0cbd9f4f8af3a
2015-02-05 12:30:36 -05:00
Geoff Mendal
6ec8c248ee Import translations. DO NOT MERGE
Change-Id: I5113a08f43c71e78b43dc3c73f8c329adc411e9a
Auto-generated-cl: translation import
2015-02-02 06:40:30 -08:00
Christopher Tate
0c3e78c93f am a97fe138: Merge "Exclude ephemeral networks from wifi backup" into lmp-mr1-dev automerge: 68dabad
automerge: f3ac99f

* commit 'f3ac99f2e093f851ca52bcd5aefb251046db10fa':
  Exclude ephemeral networks from wifi backup
2015-01-09 20:25:31 +00:00
Christopher Tate
f3ac99f2e0 am a97fe138: Merge "Exclude ephemeral networks from wifi backup" into lmp-mr1-dev
automerge: 68dabad

* commit '68dabada9e6e380ec0c6dacbc2ce7a46aa663a07':
  Exclude ephemeral networks from wifi backup
2015-01-09 20:20:01 +00:00
Christopher Tate
68dabada9e am a97fe138: Merge "Exclude ephemeral networks from wifi backup" into lmp-mr1-dev
* commit 'a97fe1387df731ddbbdae7c75dfbdfa4f1eb0339':
  Exclude ephemeral networks from wifi backup
2015-01-09 20:16:21 +00:00
Christopher Tate
cab915a327 Exclude ephemeral networks from wifi backup
We compare the set of networks defined in the supplicant with the
set of networks described as "configured" by the Wifi Manager.  The
latter excludes ephemeral networks, so any network definition we
find in the supplicant data that we do not also find in the
configured network set, we ignore for backup purposes.

Bug 18917753

Change-Id: I8e0f258d0cdb72d7bf9482fafe64dc921419fcb2
2015-01-08 19:05:04 -08:00
Marvin Paul
437d859c57 Merge "Don\'t backup ringtone on non-telephony devices." into lmp-mr1-dev automerge: a30fdf7 automerge: 8298afb
automerge: 9ff2160

* commit '9ff2160eddf4dfbd118eb9b0656e7803603f215a':
  Don't backup ringtone on non-telephony devices.
2014-12-30 03:18:54 +00:00
Marvin Paul
9ff2160edd Merge "Don\'t backup ringtone on non-telephony devices." into lmp-mr1-dev automerge: a30fdf7
automerge: 8298afb

* commit '8298afbc78f2b2c609f2e52ca3fc7c6a2cd9797e':
  Don't backup ringtone on non-telephony devices.
2014-12-30 03:15:55 +00:00
Marvin Paul
8298afbc78 Merge "Don\'t backup ringtone on non-telephony devices." into lmp-mr1-dev
automerge: a30fdf7

* commit 'a30fdf790d66e241252c51d7dbdc401e021e51ad':
  Don't backup ringtone on non-telephony devices.
2014-12-30 00:53:52 +00:00
Marvin Paul
8fc5072524 Don't backup ringtone on non-telephony devices.
Restoring a device that supports telephony using the backup set of
a non-telephony device would cause the ringtone to be set to "None"
instead of the default value. This was due to the fact that on
non-telephony devices, the ringtone value was being backed up as
"_silent" instead of null.

Bug: 18777629

Change-Id: Idece1f874438a895169dbba7df1d716adea6660e
2014-12-23 14:58:17 -08:00
Marvin Paul
6879555723 Buffer SettingsBackupAgent checksum writes
Reduce SettingsBackupAgent I/O when writing new checksum by wrapping
FileOutputStream in a BufferedOutputStream.

Bug: 18674340

Change-Id: Ia8169445d42d032e24d8a395e678295f67841a65
2014-12-16 16:27:49 -08:00
Baligh Uddin
5950a91371 Import translations. DO NOT MERGE
Change-Id: Ia2ccce90103cdc5e6b3814d50394e9c81e38010d
Auto-generated-cl: translation import
2014-12-02 16:50:24 -08:00
Amit Mahajan
5ed01f6427 am bb35bbf1: am 6f10d1c3: am b22462c5: Merge "Adding new setting LTE_SERVICE_FORCED." into lmp-mr1-dev
* commit 'bb35bbf198201fc00858ea56cdf97eae8f2cfdbb':
  Adding new setting LTE_SERVICE_FORCED.
2014-11-19 18:05:33 +00:00
Amit Mahajan
bb35bbf198 am 6f10d1c3: am b22462c5: Merge "Adding new setting LTE_SERVICE_FORCED." into lmp-mr1-dev
* commit '6f10d1c34efba28856fea162f1d193319cad2576':
  Adding new setting LTE_SERVICE_FORCED.
2014-11-19 17:57:39 +00:00
Amit Mahajan
6f10d1c34e am b22462c5: Merge "Adding new setting LTE_SERVICE_FORCED." into lmp-mr1-dev
* commit 'b22462c57f35404f5b39680a9fb76165968d8faf':
  Adding new setting LTE_SERVICE_FORCED.
2014-11-19 17:44:33 +00:00
Amit Mahajan
4fea0923be Adding new setting LTE_SERVICE_FORCED.
Bug: 18328639
Change-Id: Icbf9d7987d27af34cbe4ee1b4e9df19e139c2fc7
2014-11-18 17:34:36 -08:00
Jeff Sharkey
afc506c54b am 670cf5c6: am 22c3f906: am 628d2606: Merge "Move ringtone redirection to MediaPlayer." into lmp-mr1-dev
* commit '670cf5c663f4f17faafa9d4f7cf7209f68a02468':
  Move ringtone redirection to MediaPlayer.
2014-11-14 19:16:38 +00:00
Jeff Sharkey
670cf5c663 am 22c3f906: am 628d2606: Merge "Move ringtone redirection to MediaPlayer." into lmp-mr1-dev
* commit '22c3f90639fa8d74de68a63b0a13412740580845':
  Move ringtone redirection to MediaPlayer.
2014-11-14 00:02:58 +00:00