History log of /frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3cb2b49f443a31b1bb043d0450e350b95acecc8b 10-Aug-2016 Suprabh Shukla <suprabh@google.com> Fixing admins not being removed from DpmMockContext

We were not calling setActiveAdmin before calling setDeviceOwner or
setProfileOwner in these tests. They were passing because the admins
were not being properly removed in the first place. The admin is
actually removed from the admin list inside onReceive of the receiver
passed in sendOrderedBroadcastForUser, which was not overridden to call
onReceive in DpmMockContext.

Bug: 30726135
Change-Id: I08cab5821228738196b229a8f885f7488aaafa34
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
7f98aa4aa93497692f200c553d2d6fff402e3de2 07-Apr-2016 Fyodor Kupolov <fkupolov@google.com> 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
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
3e794afb82228199c0a83bed5463dbeb3c48dd62 04-Mar-2016 Victor Chang <vichang@google.com> Unit test for isProvisioningAllowed

Note:
DevicePolicyManagerService is changed to inject ContentObserver notifier

Test: all test cases in DevicePolicyManagerTest pass

BUG: 25710621
Change-Id: I347cec71769d0e9dd6a334d7d6339d5ce6a3fa6a
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
1216ae5d023e8f6e4f158a447a5764288e4ccc3e 11-Mar-2016 Mahaver Chopra <mahaver@google.com> Update DPM.reboot with new restriction

DPM.reboot() should not be called when there is an ongoing call on the
device.

Bug:27531799
Change-Id: Idc1fa4c7aa79b20ec9c2afcccf855455ee316787
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
d4c9e541ec7110d3c842d6f92c3ec6beb0b6d997 26-Feb-2016 Makoto Onuki <omakoto@google.com> Add ENCRYPTION_STATUS_ACTIVE_PER_USER to...

getStorageEncryptionStatus()
Use StorageManager APIs to get the encryption
state instead of from the system properties
directly.

Bug 26547262

Change-Id: Ic27baa9489d43a93873f8bb0428084f8886aed67
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
2a3c3da0fc07ef37abc45cfb0166bdf5f7f202b6 18-Feb-2016 Makoto Onuki <omakoto@google.com> Clean up on UserManagerService and DPMS

- Avoid the ART warning about 4.1 compatibility
- Avoid integer overflow in DPMS

Bug 27243525
Bug 27242859

Change-Id: I92af323287e348fbd0eff31e6cf9823be8e41024
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
49caead1c2608f57ac6c260396c6bfd058b921ae 02-Feb-2016 Rubin Xu <rubinxu@google.com> Call SecurityLog methods via Injector

This is to make sure the unit test can mock them out.

Bug: 26911599
Change-Id: I07a1a8b43ad5716a4b667bc5266b3b03997268c5
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
3f3657a61b54d495bf2e692289eb92a48fe5a0b2 28-Jan-2016 Makoto Onuki <omakoto@google.com> Fix DPM unit tests

Bug 26911599

Change-Id: I874c9cd4f63c79bc984777ef3b1b654a414c4911
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
f8373b5afc6dd25350bbca7093178807f1cc9ed6 23-Dec-2015 Mahaver Chopra <mahaver@google.com> DPM Test: DA and PO cannot call DPM.reboot()

Bug: 25304994
Change-Id: Ifaccf3625314f4bfcd7f99413abc9067cc3dd2f9
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
a31ebbc439364a4993e79fd385cf6373408a42fe 24-Nov-2015 Makoto Onuki <omakoto@google.com> Add DO API to get wifi mac address

Bug 25496044

Change-Id: Ib1f0ce4ca10951edcfaa0aa79ae5c2d142a74599
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
cb6fd80721253ffa9dcab5cf8c2f4e9b9cd17ccc 05-Nov-2015 Fyodor Kupolov <fkupolov@google.com> Added keep-uninstalled-packages DO policy

This policy allows DO to specify a list of apps to cache even without being
installed on any user.

Bug: 23938464
Change-Id: I2eeab7f148409739fc23a5c44e955ad12b63fd04
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.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/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.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/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
a52562ca9a4144cf30e6d5c6ffe856cc8e284464 02-Oct-2015 Makoto Onuki <omakoto@google.com> setDeviceOwner() now requires a full component name.

Bug 20149907

Change-Id: I24e66159d1d966925aa3a494b1e2839b07cdafa2
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.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/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
d932f7689d799b07a6776bc7c59749f672528239 30-Sep-2015 Makoto Onuki <omakoto@google.com> Refactor DPMS tests to be able to test more different cases.

- DpmMockContext.addUser() allows to create more users. This will set up
UserManager properly and create a data directory.

- Updated DevicePolicyManagerTest so it can now easily emulate calls from
different secondary users.

Change-Id: Ic9d3e8d0d1e7f41e184c82e6dc323c244535b8d8
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
72a3a0c7d24f629bca38ee2652491307e4e706da 26-Sep-2015 Makoto Onuki <omakoto@google.com> Fix OwnersTest when run with -e package

It was because UserManager.get() returns a static cached instance but
we should always be using the mock instance that's created for each test.

Bug 24378326

Change-Id: Id4663e7676d2d0130622055a97fbde0884714349
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
b643fb0e67460344ade2e3db92738999f8168496 23-Sep-2015 Makoto Onuki <omakoto@google.com> Use a factory class for dependency injection, add more tests.

- Extracting into a factory allows us to use mocks in other classes.
(Such as Owners.)

- Also removed broken test ApplicationRestrictionsTest. Instead added a new
simplified test to DevicePolicyManagerTest.

- Also stop caching rarely used instances in DPMS.

Bug 24061108
Bug 24275172

Change-Id: Ice9e57204b18e7b5f6b115126dab2209041439c2
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
f76b06a6b546f430cf85e561858ed12eedc32b81 23-Sep-2015 Makoto Onuki <omakoto@google.com> Test more DPM APIs.

Bug 24061108

Change-Id: Ia9da19f62c0f4edf53ca1f4c213f0368ec1983ba
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
cc4bbeb76af92a8484fe05f37c4ff412b4c47ccc 17-Sep-2015 Makoto Onuki <omakoto@google.com> Make DPM/DPMS unit-testable

- Now all services that DPMS uses are injectable.
- Introduce some wrappers to make static methods and final class mockable.
(e.g. for Binder.getCallingUid())

- In unit tests we replace those with Mockito mocks, except we use a partial
mock for PackageManager, because we use way too many methods of this and
most of them are okay to use directly.

- To install a partial mock to PackageManager, I needed to make
ApplicationPackageManager @hide public non-final.

- For a starter, added tests for DPM.setAmin().

Bug 24061108

Change-Id: I2afd51d8bc0038992d5f9be38c686260be775b75
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
c9754cf0dfa66d39ce9ea0d2eeab5f7c442a9686 31-Aug-2015 Makoto Onuki <omakoto@google.com> Add unit tests for file persisting in Onwers.

Bug 23432442

Change-Id: If10ed5a46084695b2aca1286713b8baea8c2a418
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java