History log of /frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
53a441ca8eda5a3e6209a952b1bbd32a39e19a1c 20-Apr-2016 Svet Ganov <svetoslavganov@google.com> 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
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
6474f0e02b9a00c1f69f985c0d73cf7f8c0fb073 24-Mar-2016 Lenka Trochtova <ltrochtova@google.com> Put disallow-safe-boot restriction to system settings
to make it accessible during boot.

BUG: 26251884

Change-Id: I1dee58dfc2aa746e0e97a6675c611c6e313ec91c
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
ad5619d44701ef488e8d4bd41cb7a98f362097c7 10-Feb-2016 Makoto Onuki <omakoto@google.com> Use Slog.e() instead of Slog.wtf() for unknown restrictions

Slog.wtf() normally indicates a bug in the system, but in this case
it's a caller side issue, so e() is more suitable.

Bug 26918715

Change-Id: I94980cb9dafd34e6c5672bf833fec921df14e6a1
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
1f1ceef0f88a8c2758d1ec0ed6c1366bac7c9de4 28-Jan-2016 Makoto Onuki <omakoto@google.com> Ignore unknown user restrictions and WTF instead.

Bug 23902097

Change-Id: I1ac147ecd0286a8eb674d6f9f527edfea6e1198e
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
f2519814cc7136773a115b770d20cf4c92945952 26-Jan-2016 Oleksandr Peletskyi <peletskyi@google.com> Added restriction that disallows ability to set wallpaper.
BUG: 24890474

Change-Id: I424aa80d914e3b6f3f9eba8ccb4802bad6f54907
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
2ec157d928b7804367091ee6c146b196ac6841e2 01-Feb-2016 Makoto Onuki <omakoto@google.com> Revert "Throw for unknown user restrictions."

This reverts commit 3861bf7e73fab9e39e8d1f6e5194f3600ed929a0.

Bug 26896902

Change-Id: I26fa0159b5bb832048ccd013054a01f91b54947b
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
3861bf7e73fab9e39e8d1f6e5194f3600ed929a0 28-Jan-2016 Makoto Onuki <omakoto@google.com> Throw for unknown user restrictions.

Bug 23902097

Change-Id: I78a4b09db880134577d690be0c50ee9a64e6a309
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
7f1f1dfc8713fbecbab60cfbe14ab4d97d27deee 18-Jan-2016 Oleksandr Peletskyi <peletskyi@google.com> Added restriction if a user is allowed to change the icon.
BUG: 25305966

Change-Id: I3d527224f00087b2bd959879ebb143e2ecb9c914
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
dea471ef548f09e04e178c5ec2d71a4b79bdb8f8 17-Dec-2015 Mahaver Chopra <mahaver@google.com> Added Data roaming user restriction

Added new user restriction DISALLOW_DATA_ROAMING, can only be set
by device owners.

Bug: 24890464
Change-Id: Ic4cb37dd5f9bbffa35f921751488ef7c7ff99452
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
5485ed46ff337769589c6e06b3469246e60b9e3b 09-Dec-2015 Makoto Onuki <omakoto@google.com> Allow PO to set DO restrictions if it's on user 0

Bug 26091525

Change-Id: Ie6d2cd4ade076d8d2ec47243ff1280b95b7c9044
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
9cbfc9e212151e84910a22387365644916dde446 08-Oct-2015 Fyodor Kupolov <fkupolov@google.com> Added DISALLOW_RUN_IN_BACKGROUND user restriction

It forces the user to stop instead of going into the background. Also
changed behavior of stopUser method. Now it also attempts to stop related
users along with the specified userId.

Based on ag/807976, with the only difference that it's now a user restriction.

Bug: 24579258
Bug: 24708668
Change-Id: I357298908816fc58feeed83b7e9979fc33d25da6
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
28da2e3490cff619157578c85d32a73ff979d554 20-Nov-2015 Makoto Onuki <omakoto@google.com> Fix "some user restrictions not working" issue

SettingsProvider used to prevent any changes to certain settings
when the corresponding user restriction is set, which isn't really what
these restrictions mean.
Even if a user restriction is set, it should still changing in the more
restricting direction.

Also stop setting "" to LOCATION_PROVIDERS_ALLOWED, which will simply
be ignored.

Bug 25614198

Change-Id: Ifa8edc2927e21e6c6174620c8c874c86c1dc0f75
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
ac65e1e1dba1cf0ea237a389220ec818ade07a16 21-Nov-2015 Makoto Onuki <omakoto@google.com> Remove UserManager.setSystemControlledUserRestriction()

Now that we don't have UM.setUserRestriction*s*() that could remove
all existing restrictions, there's almost no point handling
DISALLOW_RECORD_AUDIO differently.

Now DISALLOW_RECORD_AUDIO is handled just like other restrictions,
except we don't persist it.

Bug 24954662

Change-Id: I27875b4a74dd95a3ce6bb774081eeaf718eaec15
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
1a2cd74526113b45d9108b6997609122c4311fb1 16-Nov-2015 Makoto Onuki <omakoto@google.com> More work on layered user restrictions.

- Now when DO/PO sets a user restriction, DPMS pushes it to UMS and
then UMS persists it, in order for UserManager.hasUserRestriction()
to never have to talk with DPMS, which would cause lock inversion.

- Also apply user restrictions when a user start.

- This is an updated version of the abandoned CL -- the difference
is, ActivityManager no longer has to call DPMS.

- Also removed an unnecessary write to userlist.xml in UMS.
upgradeIfNecessaryLP().

Bug 23902097
Bug 25388912
Bug 25354031
Bug 25641040

Change-Id: I0948aea06ad7d0f45fe612a431d765faddfe3c58
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
d45a4a2ecb18701b4cfadcb4a26663f2eab642fe 03-Nov-2015 Makoto Onuki <omakoto@google.com> Have AudioService listen to DISALLOW_UNMUTE_MICROPHONE and

... DISALLOW_ADJUST_VOLUME, instead of UserManager pushing
new settings to AudioService.

Also:
- Allow PO to set these two restrictions.

- Now AS.setMasterMuteInternal() respects mUseFixedVolume to make
it consistent with readPersistedSettings().

- When a user switches and restores the mute state in
AS.readPersistedSettings(), also check the current user restrictions
in addition to system settings. Because of the delay in AudioService
before persisting the mute settings in setMasterMuteInternal() and
setMicrophoneMute(), there's was an edge case
DISALLOW_UNMUTE_MICROPHONE and DISALLOW_ADJUST_VOLUME would be ignored
when the user switches right after they are set.

Bug 24981972

Change-Id: I4d9b709a0a0e6812319204568c6e44d6664bdeb4
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
4f16073556f7978708fb71c87628cfe1692412d5 28-Oct-2015 Makoto Onuki <omakoto@google.com> Make UserManager enforce user restrictions, not DPM.

- Now even if a user restriction is set via UserManager, it'll be correctly
enforced.

- Changed the way AudioService enforces the OP_MUTE_MICROPHONE and
OP_AUDIO_MASTER_VOLUME app ops -- previously, when they're set, even a muting
call would be rejected. This was why DPMS.setUserRestriction() used different
calling orders for DISALLOW_UNMUTE_MICROPHONE/DISALLOW_ADJUST_VOLUME depending
on setting them or clearing them.
Now, even when the app ops are set, we still allow muting calls.

Bug 23902097
Bug 24981972

Change-Id: I865b5de43e15f5955f94006475a5ec6254904d31
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
068c54a5be697c3df4657dcda33cd17c4b547710 13-Oct-2015 Makoto Onuki <omakoto@google.com> Layer user restrictions

- Now DPMS remembers user restrictions set by DO / PO in their ActiveAdmin.

- User restrictions set by DO/PO will no longer be saved by UserManger. Instead,
when needed, UMS will consult DPMS to build "effective" user restrictions.

- UM.getUserRestrictions() will now always return "effective" user restrictions.

- DPMS migrates existing user restrictions per the eng spec.

- Also now UM.setUserRestrictions() will crash. UMS.setUserRestrictions() has
been removed.
This was needed because UM.setUserRestrctions(UM.getUserRestrictions()) will no
longer be a valid use like it used to be.

- Also introduced a fined-grained lock for user restrictions in UM to avoid
deadlock between DPMS and also for better performance.

Bug 23902097

Change-Id: If0e1e49344e2f3e9226532d00777976d1eaa7df3
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
a4f119790e32fcce56586e7324d508e35cb30a2a 01-Oct-2015 Makoto Onuki <omakoto@google.com> First cut of user restriction layering.

- Start persisting restrictions set by DO/PO.

- Also dump user restrictions on dumpsys

- More changes will follow, including migration.

- Now System settings are mockable.

Bug 23902097
Bug 23902477

Change-Id: I0bda22f484e1a8e259a1feb2df83c5f4a29116da
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java