708 Commits

Author SHA1 Message Date
Phil Weaver
83fec00697 Fix a race in settings update.
Need to invalidate caching before notifying of changes.

Bug: 28621277
Change-Id: I2820b15d2364ecaad7666a820c0c7280ac6b7b4c
2016-05-11 10:55:29 -07:00
Guang Zhu
5537ce1f94 Revert "Persist settings on a dedicated background thread"
Bug: 25472484

This reverts commit 82b8c92b97d3c7006d7a9f67a9cdb83263d6bf2c.

Change-Id: I1a8c2e186ad74d78f1c82fe508c6f71c438177dc
2016-05-10 07:02:42 +00:00
Svet Ganov
82b8c92b97 Persist settings on a dedicated background thread
Settings were persisted on the system background thread but during
first boot the device is under heavy load and persisting settings
competes with other system components using the shared background
thread. As a result persisting settings can be delayed much longer
than the expected 200ms. This can cause issues with setup wizard
being skipped/went over and its component disaabled being persisted
but the setting whether the device is provisioned not being
persisted - now if the device boots it will have no SUW but also
the home button would be missing. Generally, we need a tansactional
abstraction in the system process to peform all delayed operations
atomically.

bug:25472484

Change-Id: Icf38e72403b190a8fa9d0554b8dd83ce78da3bc8
2016-05-10 03:39:55 +00:00
Baligh Uddin
8a44c3c8d0 Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 28463229
Change-Id: Ie10dd0e18292f94995761a098df8c42ee69a0e25
2016-05-03 16:36:29 -07:00
Svetoslav Ganov
83a1f7fe91 Add a missing null object check
We now have a null object instead of null values and
there was a place where we returned null instead of
the correct null object.

bug:28423485

Change-Id: I2626768acdf8d19fc94aa5e978eb057818450fa5
2016-04-27 14:18:05 -07:00
Seigo Nonaka
6e5b602552 Fix unexpected null check condition flipping.
With I5a40675dd226564c0ee190d0d6f7eb2a7e4673b0, isNull() is used for
null check but accidentally the condition is flipped.

Bug:28406262
Change-Id: I776a6c259765210a7b334a81876233b594fd25ed
2016-04-27 16:32:44 +09:00
Svet Ganov
6f8a10bd14 Add a missing null check
We no longer have a null settings value - instead it is a
null object. This change adds a missing null check that is
not changed to check against the null object.

bug:28406262

Change-Id: I5a40675dd226564c0ee190d0d6f7eb2a7e4673b0
2016-04-26 23:14:06 -07:00
Svetoslav Ganov
fedb230213 Replace null checks is null object checks
A recent change replaced the null state during a setting
lookup with a null object, however missed to update some
null checks to be null object ones.

bug:28405145

Change-Id: I80f0fb3ac6e64f4283b6c617283a009e97a40efe
2016-04-26 18:36:47 -07:00
Svet Ganov
53a441ca8e Ensure local settings caches are not stale
We used the system proterties as a shared memory mechanism
to propagate information to local settings caches when the
content has changed and the cache should be cleared. The
system properties are unfortunately updated asynchronously
leading to cases where clients may read stale data.

This change adds a simple int array data structure backed
by shared memory which guarantees individual values are
atomically read and updated without memory tear. Multi-
index opearations are not synchronized between each other.

The settings provider is using the new data structure to
propagate the settings generation which drives when caches
are purged.

We have a single memory array keeping the generation for
different settings tables per user. Since memory array is
not a compact data structure and the user space exceeds
the memory array size we use an in-memory map from keys
to indices in the memory array where the generation id of
a key is stored. A key is derived by the setting type in
the 4 most significant bits and the user id in the 28 least
significant bits.

The mapping from a key to an index is cleared if the user is
removed and the corresponding index in the memory arry is
reset to make it available for other users. The size of the
memory array is derived from the max user count that can be
created at the same time.

bug:18826179

Change-Id: I64009cc5105309ef9aa83aba90b82afc8ad8c659
2016-04-26 11:31:55 -07:00
Suprabh Shukla
c9d064a380 Added null check in appendSettingToCursor
Added check for null setting before adding to MatrixCursor.

Bug: b/27908871
Change-Id: I0b71c3d5347cad705b8def98fda7e9e463c295e2
2016-04-12 18:45:41 -07:00
Fyodor Kupolov
4c74334c44 Merge "Added getProfileIds method returning array of userIds" into nyc-dev 2016-04-11 16:40:55 +00:00
Daniel U
02ba61203e Copy lockscreen notification settings upon upgrade
Copy the primary values of LOCK_SCREEN_SHOW_NOTIFICATIONS and
LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS into managed profile upon upgrade.

Bug:27673591
Change-Id: I3207b7e5bf844f0df534324220082edbdabe8444
2016-04-08 16:41:15 +01:00
Fyodor Kupolov
7f98aa4aa9 Added getProfileIds method returning array of userIds
Previously many usages of UserManager.getProfiles and getEnabledProfiles
were only using ids of returned users. Given that the list of users needs
to be parceled and unparceled for Binder calls, returning array of ids
minimizes memory usage and serialization time.

A new method getProfileIds was introduced which returns an array of userIds.
Existing method calls were updated where appropriate.

Bug: 27705805
Change-Id: Ic5d5decd77567ba0f749e48837a2c6fa10e812c0
2016-04-07 16:41:57 -07:00
Ruben Brunk
98576cf949 Grant default permissions to preinstalled VrListenerServices.
- While explicitly bound, the package for a single pre-installed
  VrListenerService will be granted permission to access
  notification policy, be bound as a notification listener service,
  and draw system overlays.

Bug: 22855417
Change-Id: I568d5d9c032e0926e47c8ef4b46e3910b6bdf766
2016-03-30 18:48:54 -07:00
Geoff Mendal
0e1850fa22 Import translations. DO NOT MERGE
Change-Id: I52c8272bdf31d1624b5323433ef2f4742158a773
Auto-generated-cl: translation import
2016-03-19 03:57:59 +01:00
Jeff Sharkey
a04c7a7c64 Mark more Bundles as being defusable.
They're destined for the system, so they're okay to look inside.

Bug: 27726127
Change-Id: Ic85c308a8efe6f9b8652952717c72b3c663d328a
2016-03-18 12:20:39 -06:00
Jeff Sharkey
8a372a0a28 Refactoring FBE APIs based on council feedback.
Mostly consists of removing the word "encryption" from most APIs,
since we can't actually make promises about the data being encrypted.

Bug: 27531029
Change-Id: Iace9d7c4e64716abf86ed11847c40f3947e1d625
2016-03-17 14:49:08 -06:00
Jeff Sharkey
d136e51a99 Defuse Bundles parsed by the system process.
It's easy for apps to throw custom Parcelables into Bundles, but
if the system tries peeking inside one of these Bundles, it triggers
a BadParcelableException.  If that Bundle was passed away from the
Binder thread that delivered it into the system, we end up with a
nasty runtime restart.

This change mitigates this trouble by "defusing" any Bundles parsed by
the system server.  That is, if it encounters BadParcelableException
while unpacking a Bundle, it logs and delivers an empty Bundle as
the result.

Simultaneously, to help catch the system process sticking its
fingers into Bundles that are destined for other processes, a Bundle
now tracks if it's "defusable."  For example, any Intents delivered
through ActivityThread are marked as being defusable, since they've
arrived at their final destination.  Any other Bundles are considered
to be "in transit" and we log if the system tries unparceling them.

Merges several Parcel boolean fields into a flags int.  Add better
docs to several classes.

Bug: 27581063
Change-Id: I28cf3e7439503b5dc9a429bafae5eb48f21f0d93
2016-03-16 14:45:26 -06:00
Geoff Mendal
d629916673 Import translations. DO NOT MERGE
Change-Id: Ied20f8a06f71782e6f15c78d73cb3be49c097b2b
Auto-generated-cl: translation import
2016-03-09 07:27:08 -08:00
Prathmesh Prabhu
fbcaea877c Merge "SettingsProvider: Add default value for SHOW_IME_WITH_HARD_KEYBOARD." into nyc-dev 2016-03-08 19:55:59 +00:00
Amith Yamasani
4b1d8b07e5 Merge "Reorder migration of settings from db to xml" into nyc-dev 2016-03-08 18:35:13 +00:00
Amith Yamasani
bf2ef61770 Reorder migration of settings from db to xml
Make sure we commit the Global table last, so that if the
runtime was restarted before the others were written, we don't
get into an inconsistent state of migration.

Not sure if this fixes the following bug, but it's one thing
that stood out as a possibility.

Bug: 27335488
Change-Id: I4166a157e9ff542b1d5e32797693417375e40581
2016-03-07 17:02:45 -08:00
Ruben Brunk
e24b9a6cfa Add a VR listener service.
Bug: 22855417
Bug: 26724891
Bug: 27364145

- Add an API for VrListenerService, which is bound/unbound
  from the framework when the system VR mode changes.
- Allow only a single bound VrListenerService at a time.
- Monitor allowed VrListenerService implementations from
  VrManagerService and evict services as needed when packages,
  users, or settings change.
- Remove previous VR functionality in NotificationListenerService.
- Add component target to Activity#setVrMode to allow
  explicit selection of the running VrListenerService from
  the current VR activity.

Change-Id: I776335f4441be0e793d3126f2d16faf86a8c621a
2016-03-07 15:54:12 -08:00
Prathmesh Prabhu
de16b86930 SettingsProvider: Add default value for SHOW_IME_WITH_HARD_KEYBOARD.
Allow OEMs to override default behaviour wrt. showing IME with a
hardware keyboard is connected. Current behaviour remains unchanged.

BUG: 27503877
BUG: 27484734
Change-Id: I7ed70b195c3ae98471e413b3eecc5d8fcd3dee26
2016-03-04 15:22:24 -08:00
Svetoslav Ganov
67a8d3516c Fix a regression in SettingsProvider
bug24990012

Change-Id: I1631d125df029f559ffc059ffcb73067389184e8
2016-03-02 13:26:43 -08:00
Jeff Sharkey
413573ac59 Offer to cache ringtones in system DE storage.
Ringtones often live on shared media, which is now encrypted with CE
keys and not available until after the user is unlocked.  To improve
the user experience while locked, cache the default ringtone,
notification sound, and alarm sound in a DE storage area.

Bug: 26730753
Change-Id: Ie6ad7790af4c87dd25759df3ed017e3b91a2fb87
2016-02-23 13:27:00 -07:00
Ritesh Reddy
f61a847881 Merge "Enabled Network Policy Backup/Restore." into mm-wireless-dev
am: d9c4bc0c4d

* commit 'd9c4bc0c4db7a8b16d8ea0f58ed0615efc167f47':
  Enabled Network Policy Backup/Restore.
2016-02-10 19:46:20 +00:00
Ritesh Reddy
70cffc57e5 Merge "Enabling SoftAP Configuration Backup." into mm-wireless-dev
am: c4a1188afd

* commit 'c4a1188afd81b4b773e30ec184839bc1a82b355d':
  Enabling SoftAP Configuration Backup.
2016-02-10 18:04:38 +00:00
Ritesh Reddy
adca34a0d6 Enabled Network Policy Backup/Restore.
Added Backup Restore specific NetworkPolicySerializer
to NetworkPolicy Class and related classes.

Change-Id: I2a11e2afae8dd9e0ee0c3356e669a73f6a1361af
2016-02-08 10:41:21 +00:00
Ritesh Reddy
aeb4c06013 Enabling SoftAP Configuration Backup.
SoftAp Conf is backed up as a serialized WifiConfiguration
object.

Change-Id: Ib7f4d130600313a67b710b45df274e15f0baad24
2016-02-08 10:33:13 +00:00
Ritesh Reddy
2400d27a65 Constrained allowable backup versions
Constrained the version on an incoming backup set
to the highest version that the SettingsBackupAgent
can handle. This is to deal with either corrupted backup
sets or newer backup sets (when modifiying/downgrading the
SettingsBackupAgent).

Change-Id: I4d666e8d4541c0b86e656a73744837d03318c4ae
2016-02-02 11:42:26 +00:00
Ritesh Reddy
33117feb6b Revert "Enabled SoftAP Configuration Backup"
This reverts commit 188ae9dc22e0ecc0612c8bfe1efdb0e22acdc43e.

Change-Id: I37e517d0e7a9a17614fa1b6890e1854346fd0138
2016-02-01 16:19:50 +00:00
Ritesh Reddy
e0cbb65e10 Merge "Revert "Enabled NetworkPolicy backup and restore."" 2016-02-01 14:05:04 +00:00
Ritesh Reddy
6b7f0f3061 Revert "Enabled NetworkPolicy backup and restore."
This reverts commit 9f548b00dcdd89e8d557223b8b99269ca7362c2e.

Change-Id: If0081fa34333339e36f9e8b9a34a2e3a84e4638f
2016-02-01 13:47:48 +00:00
Geoff Mendal
f61205150c Import translations. DO NOT MERGE
Change-Id: Ia2f7528a912c5e4a76ec13d0a16aac404244e30f
Auto-generated-cl: translation import
2016-01-27 06:09:58 -08:00
Casey Burkhardt
86b867fd45 Adds Settings.System.FONT_SCALE observer to ActivityManagerService
Changes to Settings.System.FONT_SCALE were not being handled by any service,
which required a device reboot for any changes to take effect.  Changes to
this field by the Settings app worked as expected only because it is able to
poke ActivityManager with an updated configuration, whereas unbundled
applications cannot.

This also ensures the setting value is backed up and doesn't conflict with
a configured value from accessibility onboarding during restore.

Bug:23033258
Change-Id: I98d4aed2f9f5893d054e6b10c4dfda406de8eba2
2016-01-24 04:21:36 -08:00
xinhe
f7705c3ed6 Initial codes for Quality network selection
In this change list, the old WifiAutojoin module is
    refactored initially. The old WifiAutojoinController is
    replaced with a new WifiQualifiedNetworkSelector.
    WifiConfiguration, WifiConfigureStore and
    WifiStateMachine have been modified accordingly. The new
    network selection logic is refactored with a more clear
    and deterministci one. To refer to thedescribed in
    details, in "Quality Network Selection and Connectivity
    Scan Management in N". The link of the document is:
    https://docs.google.com/document/d
    /1JPTa2NEk-PgjCJ16fIrR6ohV-kDKveDlYDOeiMCB2_c

cherry-picked from 8d106780b6a638552749e54e169fc72537d4bccc
and make changes on WiFiConfigurationSerializer.java since
it is not on mm-wireless-dev
Bug:26012244
Change-Id: I44e454544b630b891c9a58a18b5a028edcce580f
2016-01-13 15:06:30 -08:00
Mahaver Chopra
d68cc200ec Merge "Handle null pointer exception" 2016-01-08 20:20:02 +00:00
Anna Galusza
69c952f833 Merge "Add remaining Accessibility Settings to backup list. Note additional settings that should not be restored if they are already set (on account of the new Setup Wizard, which allows critical Accessibility Settings to be set before restore)." 2016-01-08 19:25:01 +00:00
Mahaver Chopra
87648756e3 Handle null pointer exception
Handle null pointer exception, just in case calling entitity doesn't
check.

Change-Id: I1b4809476cc689ad3dfd426e123a64e9a0336c87
2016-01-08 19:23:57 +00:00
Mahaver Chopra
dea471ef54 Added Data roaming user restriction
Added new user restriction DISALLOW_DATA_ROAMING, can only be set
by device owners.

Bug: 24890464
Change-Id: Ic4cb37dd5f9bbffa35f921751488ef7c7ff99452
2016-01-08 18:07:31 +00:00
Anna Galusza
fa7786cbe7 Add remaining Accessibility Settings to backup
list. Note additional settings that should not be
restored if they are already set (on account of
the new Setup Wizard, which allows critical
Accessibility Settings to be set before restore).

Change-Id: I95524abbef20ab12e529a2b1e6165adc7294c3db
2016-01-08 09:28:53 -08:00
Fyodor Kupolov
42f9fe75e6 Merge "Optimized database creation for a new user" 2015-12-18 17:22:04 +00:00
Bryce Lee
bd17928afc resolve merge conflicts of 6b9e5bf0c2 to master.
Change-Id: Idada49313619533bfeb375ee232c942589457fa4
2015-12-18 03:05:20 +00:00
Bryce Lee
9eaa59a1ff Merge "Add setting for declaring disabled bluetooth profiles." into cw-e-dev
am: cf91b45c05

* commit 'cf91b45c05358c81ddaccf3ddd4b1ea6d5295faa':
  Add setting for declaring disabled bluetooth profiles.
2015-12-17 11:45:17 -08:00
Fyodor Kupolov
497b5faba9 Optimized database creation for a new user
If the file doesn't exist, database can be kept in memory. It's safe because
the database will be migrated and disposed of immediately after onCreate
finishes.

Bug: 26237300
Change-Id: Ib37c520f28960c8d6b9ce8dd719ffbcc11a97a58
2015-12-17 10:47:33 -08:00
Bryce Lee
ec85f34812 Add setting for declaring disabled bluetooth profiles.
Bug: 25900899
Change-Id: I420a7c590d72ba10f3e466d15dccfdbb520e810a
2015-12-16 13:32:28 -08:00
Geoff Mendal
5f7eefc8d0 Import translations. DO NOT MERGE
Change-Id: I8dc68f5b6e8579613e61c5a060a9d2fff5729cef
Auto-generated-cl: translation import
2015-12-16 06:08:30 -08:00
Christopher Tate
a89f9d93cb Don't back up / restore EAP network definitions
Bug 25725016

Cherrypick from AOSP.

Change-Id: I6aa11a76e7724a0aaad05a1aa074afa2c429370c
2015-12-10 18:23:22 -08:00
Ritesh Reddy
4d4f0db8d9 Merge changes I2363e66a,If17effb9
* changes:
  Enabled NetworkPolicy backup and restore.
  Enabled SoftAP Configuration Backup
2015-12-10 18:38:42 +00:00