History log of /frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f3b9734464a850a10c6ee8cdc66773ac1aed951a 28-Mar-2018 yuemingw <yuemingw@google.com> Intent.ACTION_AIRPLANE_MODE_CHANGED should have a boolean extra.

Bug: 76468718
Test: run cts --module CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.DeviceOwnerTest#testAirplaneModeRestriction
Change-Id: Iec208f744b80e48e29f5a38ee88613e19f0d01b3
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
1d13eaea8380a43a31b12804f26d888f829feedf 30-Jan-2018 yuemingw <yuemingw@google.com> Block adb from changing certain settings value when corresponding user
restriction is on.

Check calling uid in isSettingRestrictedForUser(which is called by settingsprovider),
and only allow system_uid when certain user restriction is on, so that user won't be
able to change these settings with adb:
Settings.Secure.LOCATION_MODE,
Settings.Secure.PROVIDERS_ALLOWED,
Settings.System.SCREEN_BRIGHTNESS,
Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_OFF_TIMEOUT,
Settings.Global.AUTO_TIME,
Settings.Global.AUTO_TIME_ZONE.
This check also prevents 3rd party apps from modifying system settings value
when corresponding user restriction is on.
In addition, any attempt to change AUTO_TIME will also go through the check
for dpm.getAutoTimeRequired().

Test: manually by running the adb command with restriction set and not set
Bug: 72549013
Bug: 72548203
Bug: 72548533
Bug: 72686466
Bug: 72687105
Bug: 72940551
Bug: 72940562
Change-Id: I1d1fd20d9fa0f76f27905d62873f6a6e9af0224e
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
1e2b7318ba852c50554f3acd927b3bea0cdff445 28-Feb-2018 Alex Chau <alexchau@google.com> Use putIntForUser to turn off ambient display secure settings

- Without forUser we'll be turning off ambient display in primary user instead

Test: Use TestDPC to set DISALLOW_AMBIENT_DISPLAY in secondary users, ambient display is actually turned off
Bug: 72487689
Change-Id: I11a7a5304fcc609ab37594ad5d28814c217bc7f5
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
348bf6254f052e2aa09e421ac999e6f945bc04a0 24-Feb-2018 Yueming Wang <yuemingw@google.com> Revert "Block adb from changing certain settings value when corresponding user"

This reverts commit 4140f6c4e3de454dfbcf060112517408ac69e96c.

Reason for revert: This CL is merged accidentally as it got merged together with another CL.

Change-Id: I043a5872f370775a4261a1ca7ccb00489a588303
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
4140f6c4e3de454dfbcf060112517408ac69e96c 30-Jan-2018 yuemingw <yuemingw@google.com> Block adb from changing certain settings value when corresponding user
restriction is on.

Check calling uid in isSettingRestrictedForUser(which is called by settingsprovider),
and only allow system_uid when certain user restriction is on, so that user won't be
able to change these settings with adb:
Settings.Secure.LOCATION_MODE,
Settings.Secure.PROVIDERS_ALLOWED,
Settings.System.SCREEN_BRIGHTNESS,
Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_OFF_TIMEOUT,
Settings.Global.AUTO_TIME,
Settings.Global.AUTO_TIME_ZONE.
This check also prevents 3rd party apps from modifying system settings value
when corresponding user restriction is on.
In addition, any attempt to change AUTO_TIME will also go through the check
for dpm.getAutoTimeRequired().

Test: manually by running the adb command with restriction set and not set
Bug: 72549013
Bug: 72548203
Bug: 72548533
Bug: 72686466
Bug: 72687105
Bug: 72940551
Bug: 72940562


Change-Id: Idfe0f1758d57958b836207ab3d55b2a292e1ae0d
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
acc50461bb7cec5012bb9c58acebeae9ad729232 14-Feb-2018 Makoto Onuki <omakoto@google.com> [EBS] Don't disable location when DISALLOW_CONFIG_LOCATION is set

If *any* user has DISALLOW_CONFIG_LOCATION set, don't disable location
on battery saver.

Test: Manual test with TestDPC
Test: atest $ANDROID_BUILD_TOP/cts/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverLocationTest.java

Bug: 73004763
Change-Id: Iea7ddf94703463f0f8f2a92a8e76845b986350c3
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
622b9f921278b308e9497675e63159f926764c91 25-Jan-2018 Vladislav Kuzkokov <vkuzkokov@google.com> Make printing policy a restriction.

Use existing API instead of creating new method.

Bug: 64140119
Test: cts-tradefed run cts-dev --module CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.MixedDeviceOwnerTest#testPrintingPolicy

Change-Id: I9ff94f4d73824e7bf9aedbb64811ad60fccf9779
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
7810b8b5a1deef711f2a3d83681bf8f23c349fd9 01-Feb-2018 yuemingw <yuemingw@google.com> Rename DISALLOW_CONFIG_LOCATION_MODE to DISALLOW_CONFIG_LOCATION.

Bug: 72732481
Test: CtsVerifier test already in
Change-Id: I6932d08b250546879a77bc11022987a0d44c3135
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
c010951c91588d0bf458eacc6358ec3cf26150b0 21-Jan-2018 yuemingw <yuemingw@google.com> Turn off ambient settings when DISALLOW_AMBIENT_DISPLAY is set.

Bug: 67675787
Test: manual
Change-Id: I2098b1d71ed7dd86e84137219ba4e8fd7020fad1
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
265c692c8ec5a50054e0279321a98e7af85c2117 11-Jan-2018 yuemingw <yuemingw@google.com> Turn off airplane mode when DISALLOW_AIRPLANE_MODE is set.

Test: run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testAirplaneModeRestriction
Bug: 67675441

Change-Id: I94b6c985fe76cc9601ac6a481beca17966102109
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
5cda3aefd995dc873fb93aa4b829b33b0a040d48 15-Jan-2018 yuemingw <yuemingw@google.com> Add DISALLOW_CONFIG_SCREEN_TIMEOUT.

Bug: 67675734
Test: cts test will be added in b/67675743.

Change-Id: I75df384acdfe4cb9c259f68ff78214c4fad6410c
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
a178144906fa7e2241715779f866d22b8b92a250 10-Jan-2018 yuemingw <yuemingw@google.com> Add DISALLOW_AMBIENT_DISPLAY.

Bug: 67675787
Test: cts will be added in b/67675794

Change-Id: Ic859783e05e54ea88d98db517891d41353ad033d
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
cc391c2c13b30c494908309659509f8426af48ea 02-Jan-2018 Rubin Xu <rubinxu@google.com> Implement DISALLOW_SHARE_INTO_MANAGED_PROFILE

Add a user restriction to allow profile owners to enforce a stronger
isolation of managed profile by preventing users sharing data into
the profile. This is achieved by disabling a subset of built-in cross
profile intent filters added by ManagedProvisioning during profile
inflation.

Implementation wise, DevicePolicyManagerService listens for the restriction
change and notifies ManagedProvisioning to modify the built-in intent
filters. This is needed since ManagedProvisioning has ground truth of all
built-in intent filters and manages them. It also has the advantage that
ManagedProvisioning only needs to run when a policy change happens.

Test: cts-tradefed run cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.ManagedProfileTest#testDisallowSharingIntoProfileFromPersonal
Test: cts-tradefed run cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.ManagedProfileTest#testDisallowSharingIntoProfileFromProfile
Bug: 63911046
Change-Id: Ia6d12a5086627d1280325cd19d6e3a0752dae633
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
c6ac29d34fcebf3d392dfb729f0085a87bceb6c9 10-Jan-2018 yuemingw <yuemingw@google.com> Add DISALLOW_CONFIG_BRIGHTNESS.

Bug: 67675654
Test: cts test will be added in b/67675678.

Change-Id: Iaaeb1a19aed89cdbb139c33939923d0bb675d212
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
717f52f2dd8920d387c4d5143c7646787cec13bf 05-Jan-2018 Jeff Sharkey <jsharkey@android.com> Intent to manage subscription plans.

Define an API for carrier apps to provide a deep-link into their app
for the user to see more details about their billing relationship,
such as upgrading plans.

The createManageSubscriptionIntent() method is ready for OS
components to use when deciding if they should show a "MANAGE"
button in their UI, and the returned Intent is fully constructed
and ready to roll.

Test: builds, boots
Bug: 64133169
Change-Id: I9b2775b7cba5313f517996870135eb4682082873
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
5fe75dc26d55a86f223fa5571b64e30731341564 29-Nov-2017 yuemingw <yuemingw@google.com> Add DISALLOW_AIRPLANE_MODE.

Bug: 67675441
Test: cts test will be added for b/67675455

Design doc: https://docs.google.com/document/d/1rvEg5jE3lMhjH-OA0iTLBUY2opM96fg7BrP81MoPnmg/edit#

Change-Id: I902b281695a7e734639c9d6d4852a0e96fea8305
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
7cc2c4c2ee8543e0a04dc1378db2be7224535d22 28-Nov-2017 yuemingw <yuemingw@google.com> Add DISALLOW_CONFIG_LOCATION_MODE.

Bug: 67674888
Test: cts test will be added in b/67674901

Design doc: https://docs.google.com/document/d/1rvEg5jE3lMhjH-OA0iTLBUY2opM96fg7BrP81MoPnmg/edit#

Change-Id: I284d421eedfb238084fa61e7661638c22b28734f
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
c4f87e9ceb4d5ce78c1663912bc166e0d41554aa 26-Oct-2017 Pavel Grafov <pgrafov@google.com> Introduce DISALLOW_UNIFIED_PASSWORD.

When DISALLOW_UNIFIED_PASSWORD is enforced by managed profile
owner, the user is disallowed to user single lock for both primary
user and the profile.

DMP.isUsingUnifiedPassword() can be called by DPC to check if
this restriction is obeyed.

Test: make cts-verifier
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases -t
com.android.cts.devicepolicy.ManagedProfileTest#testIsUsingUnifiedPassword
Test: cts-tradefed run cts -m CtsAdminTestCases -t
android.admin.cts.DevicePolicyManagerTest#testIsUsingUnifiedPassword_failIfNotProfileOwner
Bug: 63909482
Change-Id: Ib758e32d4bf4012d805185bce874f481e17576ba
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
fde6ea8d29da5f9c6b321df64c8f0722d1173586 09-Nov-2017 Christine Franks <christyfranks@google.com> Merge "Add DISALLOW_CONFIG_LOCALE user restriction"
ff66fa9ef2e12654b5869cae844a9747dfc441eb 10-Aug-2017 Benjamin Franz <bfranz@google.com> Create a new user restriction to disallow user switching

For multi-user session implementation, we want to block the user from
going back to user 0. Therefore, we block the user switcher in the
secondary user, as well as swtiching via user section in Settings app.

Bug: 64382189
Test: Manually verify user switcher is not displayed in QuickSettings
Test: Manulaly verify not able to remove or switcher user in user
section in Setting app
Change-Id: I84bc9e67e3fe7fccb75edf0fc49b775b902f5290
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
1bade5d62974544639f2b1656a7e2785b0338a6f 11-Oct-2017 Christine Franks <christyfranks@google.com> Add DISALLOW_CONFIG_LOCALE user restriction

Bug: 67586452
Test: make cts && cts-tradefed run cts-dev -m DevicePolicyManager \
-t com.android.cts.devicepolicy.UserRestrictionsTest

Change-Id: Icaf78dec5527c57c00e2b9854ba17ec1982bfac4
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
a9772f360202b05858fa199088bfe94697a3f623 23-Oct-2017 yuemingw <yuemingw@google.com> Add DISALLOW_CONFIG_DATE_TIME user restriction.

Test: cts test for bug 67627542 in following cl
Bug: 67497909

Follow design doc: https://docs.google.com/document/d/1NV93mr2CT157S_haru1QbKo9HLeP9iPM9eMiGfVmfCM/edit#
Change-Id: Iee3c2fbf88b4958dde81330c2e4d60dfce09197f
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
22ff6f9df0b1e195f4d9daee0c7f4ba8f7ad6c9a 05-Oct-2017 Charles He <qiurui@google.com> Add user restriction to suppress error dialogs.

Bug: 66125576
Test: cts-tradefed run cts-dev --module DevicePolicyManager -t com.android.cts.devicepolicy.UserRestrictionsTest
Test: bit FrameworksServicesTests:com.android.server.pm.UserRestrictionsUtilsTest
Change-Id: I1c4cf4a107f47e9b5543607e57b76dd2e5acfba5
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
5d7027db6e0b82c0ffcb101c3a17997f6aefafc5 12-Apr-2017 Andrew Scull <ascull@google.com> Add implementation alternatives for OemLockManager.

The OEM lock can be implemented with the persistent data block or the
OemLock HAL.

Test: gts-tradefed run gts -m GtsOemLockServiceTestCases -t com.google.android.oemlock.gts.OemLockServiceTest
Bug: 34766843
Change-Id: I16b31785d9af58212a050a299ef024be3139f0c6
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
7f4ad75218bdd3f1bdf9022a146147eae032cc0c 28-Mar-2017 Pavel Grafov <pgrafov@google.com> Introduce DISALLOW_BLUETOOTH_SHARING.

When this restriction is enforced Bluetooth sharing option should not be
present when the user tries to share something. Previously this was handled
by explicitly disabling bluetooth sharing activity during managed
provisioning, now this code is to be removed (see topic CLs) and the same
behavior should be achieved by setting this restriction for profile owners
by default.

In Bluetooth:
1) Don't check restrictions on boot, it is invoked anyway through the
listener during boot.
2) Ignore when the restriction is "changed" from true to true - i think
it was the initial intent in that condition.
3) Disable the component for a particular user and not always the
system user. This is something that has to be fixed in O I think since
currently in secondary user the bluetooth itself gets disabled but the
sharing thing still shows up.

In DPMS:
1) Now ActiveAdmin for PO also contains a set of restrictions applied by
default.
2) Now all ActiveAdmins for POs are loaded quite early. That shouldn't
have huge impact though.

Bug: 36249732
Test: run cts -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.ManagedProfileTest#testBluetoothSharingRestriction
Test: run cts -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.DeviceOwnerTest#testBluetoothRestriction
Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java
Change-Id: I78c4ffbd503c4a10138e8c0862a9f206f24c5631
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
24d5893b25ce62b7bc9ed9f35fa72b9d47f23cdd 21-Mar-2017 Felipe Leme <felipeal@google.com> Added a UserManager.DISALLOW_AUTOFILL restriction.

bug: 35710740

Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases -t android.autofillservice.cts.LoginActivityTest#testUserRestriction
Test: cts-tradefed run commandAndExit cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDisallowAutofill_allowed
Test: cts-tradefed run commandAndExit cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedProfileOwnerTest#testDisallowAutofill_allowed
Test: cts-tradefed run commandAndExit cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testDisallowAutofill_allowed

Change-Id: I41b2bf9fe3bc8df627c6650960bd11346c430a7e
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
eafee02fdc463e765ce34b8541f4ba55989b4bee 16-Mar-2017 Fyodor Kupolov <fkupolov@google.com> Clear mGuestRestrictions before loading from disk

Only guest user restrictions that are set to true are saved in
writeUserListLP. When loading <guestRestrictions>, they are applied
on top of mGuestRestrictions filled with default values.
Restrictions set to false are reset and this was causing the issue.

Bug: 33250860
Test: Manual
Change-Id: I6e5c792a3adcf2116bb26fd5feba551d7edcb28e
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
bf80a14d5b60a051af3872bdbed215cc4de05e7f 06-Mar-2017 Stephen Chen <stewchen@google.com> Do not disable Open Network Notifications setting on profile change.

The DISALLOW_CONFIG_WIFI user restriction will be enforced in the
feature implementation instead.

Bug: 35996959
Test: runtest --path
frameworks/base/services/tests/servicestests/src/com/android/server/pm/UserRestrictionsUtilsTest.java

Change-Id: Iabde4f974d26ab264e9544018d6547b4147f81aa
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
33a119c94fbef9a185b82204fc58292e08c3d33d 13-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix typo on DISALLOW_UNMUTE_DEVICE"
492b4724fb42adf29f3978f01ebc5238f893d194 13-Feb-2017 Esteban Talavera <etalavera@google.com> Fix typo on DISALLOW_UNMUTE_DEVICE

Test: Builds sucessfully. Cannot find other usages in code search
Change-Id: I83f85b4715b11630b0ce0b471be536aef46a2936
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
e3745eed8b9599de6f413d48a81098209fd41791 03-Feb-2017 Suprabh Shukla <suprabh@google.com> Deprecating secure setting install_non_market_apps

Apps targetting Android O or higher should use the new api
canRequestPackageInstalls in package manager. The secure setting
INSTALL_NON_MARKET_APPS which was used is set to 1 to make the
change transparent to apps who are already querying for this setting's
value.

Test: adb shell am instrument -e class\
'com.android.providers.settings.InstallNonMarketAppsDeprecationTest' -w\
'com.android.providers.setting.test/android.support.test.runner.AndroidJUnitRunner'

Bug: 33947615

Change-Id: Ie38d130bfccd022483a566270fce071acbdb00b7
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
6a40f09083fc52acc3309d0b04401fca02df6372 25-Oct-2016 Pavel Grafov <pgrafov@google.com> Make ENSURE_VERIFY_APPS global even when set by PO.

Currently only device owner can set global user restrictions.
With this CL ENSURE_VERIFY_APPS will be global no matter who
enforces it, DO or PO.

To make it possible for system apps to check who enforces a
particular restriction in this case a new API method is added
to UserManager: getUserRestrictionSources which returns a list
of users who enforce the restriction.

Bug:31000521
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.UserRestrictionsTest (ag/1732744)
Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/pm/UserRestrictionsUtilsTest.java
Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java
Test: installed M on a Nexus5x device, created a managed profile with some user restrictions, and checked that after upgrading M->O all restrictions are preserved and split correctly into base, global and local.
Change-Id: I543d3ec9ef0cf2b730da6f7406021c0bba43b785
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
2ea46fe658c5a977a11372d7180e8ed9abf261e8 05-Jan-2017 Nicolas Prevot <nprevot@google.com> Make disallow add/remove managed profile restriction not global.

Otherwise: if the DO sets remove managed profile user restriction:
the profile owner of a managed profile cannot remove this managed
profile.

BUG:33854430
Test: adb shell am instrument -e class com.android.server.devicepolicy.DevicePolicyManagerTest -w
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I90b2028ea627a2073298bf9ef3c07b4fdf8d13a1
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
6c9116a6430ca5cd55b1b926213a5e8de77e4fc6 24-Nov-2016 Esteban Talavera <etalavera@google.com> Create DISALLOW_{ADD,REMOVE}_MANAGED_PROFILE user restrictions

Bug: 31952368

Test: runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest frameworks-services
Test: runtest -c com.android.server.pm.UserManagerTest frameworks-services
Test: cts-tradefed run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.UserRestrictionsTest

Change-Id: I240ab99c2409bbabffbc574bef202f2457026905
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
63d5e4a7491b707235654cb081d2fc9074a5a65a 02-Dec-2016 Lenka Trochtova <ltrochtova@google.com> Introduce a new user restriction for disallowing Bluetooth.

Only the device owner will be able to set the restriction
and the restriction will prevent usage of Bluetooth on the
entire device - i.e. in all the users.

Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.UserRestrictionsTest
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.DeviceOwnerTest#testBluetoothRestriction

Bug: 32895300

Change-Id: I2875cf178cb16eca1965d0ba965d1cd3d8db2ad5
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
dc589ac82b5fe2063f4cfd94c8ae26d43d5420a0 11-Nov-2016 Sudheer Shanka <sudheersai@google.com> Update usage of ActivityManagerNative.

- Remove references to ActivityManagerProxy.
- Add isSystemReady to ActivityManager.

Bug: 30977067
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \
-w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
c48b20f8f1d3e07e8a931b195669b0ab8895006c 11-Aug-2016 Esteban Talavera <etalavera@google.com> Do not toggle OEM unlock if bootloader unlocked

Bug: 30681215
Change-Id: Ia0fd55dd7b6b731d6f5733fc733621e99bd7b153
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
0df1d34e6e1bb687205fa061b0ae60b34957b65a 25-Jul-2016 Tony Mak <tonymak@google.com> Merge "Persist master volume mute across reboot" into nyc-mr1-dev
c1205111a92b52283078f1a2e86c8d32c5928b92 22-Jul-2016 Tony Mak <tonymak@google.com> Persist master volume mute across reboot

Fix: 30133263

Change-Id: I53450a504e40e55516acc88550f369a74a244eaf
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
36eb7a13709073111e2397c9f542cb6f64f3f2b9 22-Jul-2016 Benjamin Franz <bfranz@google.com> Block user from setting safe boot setting via adb
am: 0ff13fce6f

Change-Id: I50db586478eb52d0a2f43e9150cc663c96e5779b
0ff13fce6fa4caa0cc61dae555881c4568020327 12-Jul-2016 Benjamin Franz <bfranz@google.com> Block user from setting safe boot setting via adb

Bug: 29900345
Change-Id: Id3b4472b59ded2c7c29762ddf008ee8486009dbb
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
3d9805d50281882b4420ee2d4ede8a8bdd94d455 07-Jul-2016 Mahaver Chopra <mahaver@google.com> Added UM.DISALLOW_OEM_UNLOCK, Removed Global.OEM_UNLOCK_DISALLOWED.

Currently we used global setting to restrict user from enabling oem
unlock. As global settings can be chagned using adb, using user
restrictions instead.

Bug: 29893399
Change-Id: Ic83112a4838b8279bf50408a29ae205e0b8639ee
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
d444ff120774ef87710ee3106534ea7ca44baa5d 16-Jun-2016 Mahaver Chopra <mahaver@google.com> Global.OEM_UNLOCK_DISALLOWED should only restrict when enabling oem

Bug:29409746
Change-Id: I5254456cc2364c93809cebbe2d134a873873790d
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
830e32cdccdeeeadc5f07ba006b2b5779f8be65d 17-May-2016 Mahaver Chopra <mahaver@google.com> Disallow OEM unlock when DISALLOW_FACTORY_RESET applies

Bug: 28339424
Change-Id: I4b6dc6f186ea60a13e778f52d574e615b0b19b74
/frameworks/base/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
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