17 Commits

Author SHA1 Message Date
Pavel Grafov
5bb5a6219d Introduce "adb shell dpm force-security-logs"
This command fetches the most recent batch of the logs
and makes them available to the DPC. Primary purpose is
to make security logging testable in CTS without having
to either wait for 2 hours or relying on implementation
details.

To prevent the user from abusing the command and
annoying the DPC, it is throttled if run more than once
per 10 seconds. Waiting happens in Dpm command.

Test: adb shell dpm force-security-logs
Bug: 70886042
Bug: 62251154
Change-Id: Ic5acd5a3e5c3b060881385c472df2b972961b626
2018-02-02 14:20:41 +00:00
Rubin Xu
29b9a7d1f4 Add freeze period support in SystemUpdatePolicy
Freeze period is defined as a pair of calendar dates (recurring annually)
during which the system should block any incoming system updates, including
security patches. They are set on top of existing system udpate policy
types (automatic, windowed, postpone) such that outside the freeze
periods existing policy semantics will still apply. They are created to
allow admin to keep their device fleet from any destabilizing changes during
critical period of the year, for example during Christmas sales period.

Device Owner can set several freeze periods, although to prevent the device
from not receiving OTAs indefinitely, each single freeze period is
restricted to be at most 90 days, and adjacent freeze periods need to be at
least 60 days apart. To properly enforce these restrictions, any freeze
periods the device previously experienced is tracked by DevicePolicyManager
and are validated against any new policy. This is to deal with corner cases
such as the admin repeatedly set a short but overlapping freeze period on a
rolling basis, hence bypassing the 90-day freeze period restriction.

Test: runtest -c com.android.server.devicepolicy.SystemUpdatePolicyTest frameworks-services
Bug: 64813061
Change-Id: I2864192797dc194edd9c183b881da6cfe3fdba5e
2018-01-26 23:07:59 +00:00
George Burgess IV
6c1688850e cmds: add #!s
Without this, exec()ing these fails.

Found with `grep -L bin/sh $(grep -Rl Script)`

Bug: None
Test: exec()ed each of these scripts; I no longer get "exec format
error" for any of them.
Change-Id: I47db5007e5cc14ab91eb846b7bffecb925d37874
2017-11-05 01:07:30 -07:00
Sudheer Shanka
dc589ac82b 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
2016-11-14 11:27:12 -08:00
Kenny Guy
38dcca51a7 Add test method to remove admins.
Add test method to remove admins that declare
FLAG_TEST_APP without informing them.
The method will also remove the device and profile
owner status of the admin.

Bug: 28027468
Change-Id: Idb4d3299a9c6595c94bfb424546cd8a384131835
2016-04-19 20:10:56 +01:00
Alan Treadway
afad878369 Add explicit and persistent user provisioning state.
Add explicit modelling of provisioning state so that integration
of management provisioning flows with packages such as setup-wizard
are cleaner, and can be more direct. Previously we relied upon
USER_SETUP_COMPLETE secure setting and HOME intents to signal intent,
but this is not very clear and can be fragile.

Bug: 25858670
Change-Id: Idc56a040f710c3aee281db420f21717da3960722
2016-01-25 15:46:30 +00:00
Fyodor Kupolov
6bccb76a64 Allow --user current in dpm command
dpm command now accepts current user as an argument.

Bug: 25974105
Change-Id: I5335a2fc2159f9574e319697dcf5e0485233d8f2
2015-12-04 14:28:46 -08:00
Makoto Onuki
a52562ca9a setDeviceOwner() now requires a full component name.
Bug 20149907

Change-Id: I24e66159d1d966925aa3a494b1e2839b07cdafa2
2015-10-05 16:05:15 -07:00
Makoto Onuki
58b684f1cd [split system] Tentatively support running DO on meat user
- setDeviceOwner() now takes a user ID.  (We can infer it from Binder, but
we still need it for the dpm command.)

- Change broadcast target UID for DO to the DO user

- Start the DO user on boot complete.
TODO Investigate whether this is actually the good timing.

TODO Prevent the DO user from being killed

Bug 23827706

Change-Id: I227dbd444f1f4e94d98c317489d151554fe79d91
2015-09-08 11:24:58 -07:00
Xiaohui Chen
cc791bc47c More cleanup USER_OWNER
Bug: 19913735
Change-Id: I7fe1bb2a66231b7d1ae0670dff5e2ec736b2e541
2015-08-27 18:05:21 +00:00
Xiaohui Chen
b52c7330d9 Clean up USER_OWNER reference in cmds.
Again, the easy ones.

Bug: 19913735
Change-Id: Ib9519cb8309b332258b20dee54a38007eaba3b1d
2015-08-06 14:05:35 -07:00
Sudheer Shanka
474c7aceae Update dpm command to follow --user convention.
Bug: 18426246
Change-Id: Ieacba15c4b4bfaf6ac325d20554ac91a1051ca4c
2015-01-13 20:07:46 +00:00
Zoltan Szatmary-Ban
e9119876a2 Add new subcommand 'set-active-admin' to the dpm command.
Bug: 18002490
Change-Id: I91746032df08ef0fdef05711114691da18796a0a
2014-11-19 13:47:11 +00:00
Esteban Talavera
c48bca50fa Make dpm command output more test friendly
Added 'Success' at the beginning of the command output every time
it didn't fail, so that we can easily check the output in tests.
The command is brand new, only used by us on CTS tests, so this
shouldn't break anybody.

Bug: 17312478
Change-Id: Ie67bf5b2f44e658e7009e5bd87f8cb81be515584
2014-09-18 18:32:45 +01:00
Esteban Talavera
41de9bb6fd Add 'adb dpm' subcommand to set profile owner
Required for GTS tests. Needed to relax the restriction that
only root user can run 'pm create-user' as GTS tests can't
get root permissions.

Bug: 17312478
Change-Id: I1841286ddf51756c73018c087a5f29afeb5b9f15
2014-09-16 10:24:58 +01:00
Esteban Talavera
9c17388cff Set device admin on dpm set-device-owner command
Bug: 17312478
Change-Id: I4ef730a97d603352eda77f04a2b00fa97c2be662
2014-09-15 11:42:34 +01:00
Esteban Talavera
b5ef162129 Add new adb dpm (= DevicePolicyManager) command
Adds new adb command to execute DevicePolicyManager tasks. First subcommand
allows us to set a device owner on a provisioned device (provided no accounts
are associated with the device). This is required as GTS tests run on provisioned
devices. We plan to add more subcomands required for new GTS tests, such as the
ability to create a managed profile.

Bug: 17312478, 17316711
Change-Id: I2613178ea82a6c6268e7f8012e74c4a852fea0d4
2014-09-12 11:33:59 +01:00