721 Commits

Author SHA1 Message Date
Kenny Guy
d49386eaa5 Merge "DO NOT MERGE Clear calling identity before checking if user is running." into nyc-dev am: 2df7f9f9c0 am: c5d86736d3 am: 00b77edec0
am: 11c5ff0399

Change-Id: I649c06ea01b23db5668fa0694528cffd823b8d7b
2017-03-14 12:21:00 +00:00
Kenny Guy
11c5ff0399 Merge "DO NOT MERGE Clear calling identity before checking if user is running." into nyc-dev am: 2df7f9f9c0 am: c5d86736d3
am: 00b77edec0

Change-Id: I16ea6b1c11cde1b9491826d7e95dc9bf3a45458b
2017-03-14 12:16:23 +00:00
Kenny Guy
00b77edec0 Merge "DO NOT MERGE Clear calling identity before checking if user is running." into nyc-dev am: 2df7f9f9c0
am: c5d86736d3

Change-Id: I0886d46f74fec980eb8bd6c99d8b647e294bcb21
2017-03-14 12:11:54 +00:00
Kenny Guy
c5d86736d3 Merge "DO NOT MERGE Clear calling identity before checking if user is running." into nyc-dev
am: 2df7f9f9c0

Change-Id: I9ca23aa395e0120413a60174e9b7ef44d91a90b1
2017-03-14 12:07:26 +00:00
Kenny Guy
628a08842c DO NOT MERGE Clear calling identity before checking if user is running.
Fix crash with isActivePasswordSufficient when
checking if user is running.

Bug: 35667752
Change-Id: I9775de84bb41432aac29591952d08b11f9530a3f
2017-02-27 18:57:37 +00:00
Rubin Xu
0f2c853889 Merge "Fix uri permission grant on remote bug report uri" into nyc-dev am: 42f2e80293 am: 824c8284ce am: 72074e3ab9
am: f85a20702a

Change-Id: If9e569ba66dc9e5876fab5ffd2a6c9b0a9fb923b
2017-02-10 12:28:47 +00:00
Rubin Xu
f85a20702a Merge "Fix uri permission grant on remote bug report uri" into nyc-dev am: 42f2e80293 am: 824c8284ce
am: 72074e3ab9

Change-Id: I1cd4db65e0fe8c92628f22f94fe937cf64f2da04
2017-02-10 12:24:43 +00:00
Rubin Xu
72074e3ab9 Merge "Fix uri permission grant on remote bug report uri" into nyc-dev am: 42f2e80293
am: 824c8284ce

Change-Id: If4dfa2d7af980c91ec3d3f8faa7e7f4a39350c82
2017-02-10 12:20:18 +00:00
Rubin Xu
824c8284ce Merge "Fix uri permission grant on remote bug report uri" into nyc-dev
am: 42f2e80293

Change-Id: Ic167e10a205b5c8f9df81cd20a6f08359d3807f4
2017-02-10 12:16:19 +00:00
Greg Plesur
d78a0d21cb Allow any device with a device_owner to execute setDeviceOwnerSystemPropertyLocked().
am: 735b4dc0af

Change-Id: I5c8ca6d0a63af83cde91c17d10a634469c726442
2017-02-09 19:49:58 +00:00
Greg Plesur
735b4dc0af Allow any device with a device_owner to execute setDeviceOwnerSystemPropertyLocked().
BUG: 34824902
Change-Id: I95fbe0a352c48a3fff5af57b91325901a16d3d89
2017-02-09 11:44:39 -05:00
Greg Plesur
66af3515de Don't check device_provisioned on Wear devices in setDeviceOwnerSystemPropertyLocked()
am: c7b18342ea

Change-Id: I692fee4165de9a274d8eb8f0deaf49762974bb22
2017-02-08 23:44:13 +00:00
Greg Plesur
c7b18342ea Don't check device_provisioned on Wear devices in setDeviceOwnerSystemPropertyLocked()
BUG: 34824902
Change-Id: I49d4d7043829862e1abacb3f400a6690f454d6c0
2017-02-08 16:32:51 -05:00
Rubin Xu
ca53b27c34 Fix uri permission grant on remote bug report uri
System server is no longer allowed to grant uri permission directly. As a result
we use grantUriPermissionFromIntent() to grant permission from the shell UID,
who is the owner of the bug report content.

Also fix a security bug where the broadcast to notify user consent of remote
bug report mismatches the <protected-broadcast> definition, causing it to be
sendable by anyone.

Bug: 34159108
Test: manual - Install TestDPC and request bugreport, try accept and decline
      once the report is ready (Bullhead).

Merged-In: I66e3f2a16d4547549f09d3c96d52aed2330caedf
Change-Id: I66e3f2a16d4547549f09d3c96d52aed2330caedf
2017-02-08 10:15:48 +00:00
Makoto Onuki
f1e276384d DO NOT MERGE Do not call RecoverySystem with DPMS lock held am: 2317451acc am: 01f971dcdc
am: 963cba5b5b

Change-Id: I3a1421f656d1a90970eac6156e0840625662fb17
2017-02-02 01:15:44 +00:00
Makoto Onuki
963cba5b5b DO NOT MERGE Do not call RecoverySystem with DPMS lock held am: 2317451acc
am: 01f971dcdc

Change-Id: If5f5e5d47b97e2b8480adc5ca2cb08702056ca87
2017-02-02 01:10:43 +00:00
Makoto Onuki
01f971dcdc DO NOT MERGE Do not call RecoverySystem with DPMS lock held
am: 2317451acc

Change-Id: Id3441141d4feea4c7291350c9670bd59ec017240
2017-02-02 01:03:21 +00:00
Makoto Onuki
2317451acc DO NOT MERGE Do not call RecoverySystem with DPMS lock held
Note DPM.wipeData() on a secondary user is now blocking, just like
it's been always blocking on the primary user.

Test: Manually tested wipeData() with ApiDemos, both on 1) the primary user,
2) a secondary user and 3) work profile.

Test: adb shell am instrument -e class com.android.server.devicepolicy.DevicePolicyManagerTest -w com.android.frameworks.servicestests

Bug 30681079

Change-Id: Ia832bed0f22396998d6307ab46e262dae9463838
Merged-in: Ia832bed0f22396998d6307ab46e262dae9463838
(cherry picked from commit efdec8f5688ce6b0a287eddb6d5dad93ffa0e1ee)
2017-01-31 21:21:36 +00:00
Makoto Onuki
efdec8f568 Do not call RecoverySystem with DPMS lock held
Note DPM.wipeData() on a secondary user is now blocking, just like
it's been always blocking on the primary user.

Test: Manually tested wipeData() with ApiDemos, both on 1) the primary user,
2) a secondary user and 3) work profile.

Test: adb shell am instrument -e class com.android.server.devicepolicy.DevicePolicyManagerTest -w com.android.frameworks.servicestests

Bug 30681079

Change-Id: Ia832bed0f22396998d6307ab46e262dae9463838
Merged-in: Ib97a92a6af87a5589d2643b9ae0522395735e1a5
2017-01-27 14:08:01 -08:00
Michal Karpinski
1710e5f079 DO NOT MERGE Change batch finalization timeout mechanism from
Handler#sendMessageDelayed() to a wakeful alarm

Messages sent with Handler#sendMessageDelayed() didn't get delivered
until the device woke up after being idle, which resulted in
potentially very long windows of logs accumulation and highly possible
network log loss from before the device becaming idle.

Bug: 34157435
Test: manual with decreased timeout over a few timeout iterations
Change-Id: I22d9cc743acb1a478d2da5407c5718e7f95e89cb
2017-01-26 12:48:56 +00:00
Kenny Guy
1894632864 Fix issue with saving admins before finishing loading. am: f98ed6863a am: b275a205af
am: ee9f03d1ed

Change-Id: Ic724588cbab8d4282eeb5bc806f8c67791189a05
2017-01-18 17:33:33 +00:00
Kenny Guy
ee9f03d1ed Fix issue with saving admins before finishing loading. am: f98ed6863a
am: b275a205af

Change-Id: I01487d9c39f4e82b63961cdd43df238f2bfd2b89
2017-01-18 17:27:10 +00:00
Kenny Guy
b275a205af Fix issue with saving admins before finishing loading.
am: f98ed6863a

Change-Id: I7f816c164548df86f9607c86772902efd0d53620
2017-01-18 17:13:31 +00:00
Kenny Guy
f98ed6863a Fix issue with saving admins before finishing loading.
Saving device policy managers settings to clear out
password stats was happening before initializing mAdminList
so could wipe active admins.

Test: manual - flash with N2G05C add google account with dmagent flash wth this fix, check dmagent is still an active admin, reboot check admin is still active.
Test: runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest frameworks-services

Bug: 34277435
Change-Id: I13660b47f30e9aba001eb13f2e457c3b3f36da3e
(cherry picked from commit adbda7474cc1968b66e9948aee566dc346e71340)
2017-01-18 12:01:55 +00:00
Kenny Guy
adbda7474c Fix issue with saving admins before finishing loading.
Saving device policy managers settings to clear out
password stats was happening before initializing mAdminList
so could wipe active admins.

Test: manual - flash with N2G05C add google account with dmagent flash wth this fix, check dmagent is still an active admin, reboot check admin is still active.
Test: runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest frameworks-services

Bug: 34277435
Change-Id: I13660b47f30e9aba001eb13f2e457c3b3f36da3e
2017-01-17 23:37:57 +00:00
Andrew Scull
3c9b36482f resolve merge conflicts of ad4aa1ce7d3d to nyc-mr1-dev am: eb35ad9969
am: 3aac3ebee1

Change-Id: Id7be6d9656b292ec1bf526750db8081022267c4a
2017-01-13 21:16:31 +00:00
Andrew Scull
3aac3ebee1 resolve merge conflicts of ad4aa1ce7d3d to nyc-mr1-dev
am: eb35ad9969

Change-Id: I4fd9ce4c79db5a10f28008c89205fc9c8ef2888f
2017-01-13 17:17:49 +00:00
Andrew Scull
eb35ad9969 resolve merge conflicts of ad4aa1ce7d3d to nyc-mr1-dev
Change-Id: I97ef31536cd06495a08a3f94f81df2d1376186e0
2017-01-13 15:28:36 +00:00
Andrew Scull
ad4aa1ce7d resolve merge conflicts of e4cefbf4fce4 to nyc-dr1-dev
Change-Id: Ib536a33ba381c28397320edd516d52727e5bdacc
2017-01-13 13:16:09 +00:00
Michal Karpinski
4da4a5d0c8 [DPM] Improvements to the network logs batch finalization mechanism
The full batch will still be available to DPC if there were no
network logs pending.
Added some more debug logging to better investigate the issues.

Test: manual for both cases - pending batch was empty and non-empty,
      with locally decreased timeout
Test: cts-tradefed run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testNetworkLoggingWithSingleUser

Bug: 34245471
Bug: 29748723
Change-Id: Iee229d74d4b0a06025b305a15687f336a0aa337e
2017-01-12 17:10:02 +00:00
Andrew Scull
e4cefbf4fc Don't save password metrics to disk.
On FBE devices, don't save the metrics to disk but compute them when the
password is first entered and only store them in RAM.

Merged-in: 5daf273b7e3272269c53eda20ce494d0e7a365b5
Bug: 32793550
Change-Id: Icee7f615167761177b224b342970a36c7d90f6ba
2017-01-12 16:01:59 +00:00
phweiss
df7bfcfc22 Add ticker text for network logging notification
Set ticker text to title for accessibility.

Bug:31207965
Test: manual

Change-Id: I0b78f9e6464dd470b74e0db97813623b335835d9
(cherry picked from commit d4a54bbfd1902dccb0e4de03f15bfbbba50b9531)
2017-01-11 15:04:00 +00:00
phweiss
971236480c Dismiss network logging notification when disabling logging
Bug:34116213
Bug:29748723
Test: CTSVerifier in a separate CL.

Change-Id: Ie652505ff57665f626712c67837577833f1595d6
(cherry picked from commit 82ed31c1efeb98acba60d79d1fc0a291b1440dc2)
2017-01-10 10:16:12 +00:00
Makoto Onuki
fd24353d75 Get account features before taking lock (cherry-pick from master)
Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.AccountCheckHostSideTest
* without having Id49f2bd5dfa80ecf35b3a23c789100ade38c2656 *

Test: adb shell am instrument -e class com.android.server.devicepolicy.DevicePolicyManagerTest -w com.android.frameworks.servicestests

Bug: 33481725
Change-Id: Ie2fe9aea87d1a7167581f4cd74ae063ef24a4567
Merged-in: I1e4dd9701a76ca366f86fdaf2fc6c282e9dbe5c1
2017-01-04 09:04:09 -08:00
phweiss
923d2cc9d9 DO NOT MERGE Show notification when network logging is enabled
A notification is shown after network logging is enabled
and after the next three reboots that are at least one day apart.

Clicking it sends an intent to quick settings to shown its device monitoring
dialog.

Cherry-picked from master.

Bug: 29748723
Bug: 33126577

(cherry-picked from commit a0cb251ca6a8ea8df17ff8089573bc50f2f1849f)

Test: Manual, CTS-Verifier tests will be added later
Change-Id: I2bf517bd27ab23ad3f66270602dbf062efab8cbb
2016-12-20 19:23:58 +01:00
Philipp Weiß
f84f98c4e2 Merge "DO NOT MERGE Add network logging icon to Quicksettings when enabled" into nyc-mr2-dev 2016-12-19 17:57:16 +00:00
phweiss
c94b637305 DO NOT MERGE Add network logging icon to Quicksettings when enabled
Add the network logging icon in Quick Settings' footer if
network logging is enabled, possible next to the VPN icon.
Quicksettings has to be able to tell that network logging
is enabled, so this CL changes DPM.isNetworkLoggingEnabled() to be
callable from the device owner or from any app with the MANAGE_USERS
permission.

The icon is only a placeholder until the official icon is finished.

CTS Verifier tests will be added when all Network logging UX changes are
done.

Cherry-picked from master, and then modified to work in N:
I had to remove the QSFooterTest change because the testing infrastructure
is not there in N. Also, I had to add DPMS.enforceDeviceOwnerOrManageUsers()
to which did not exist in N before.

BUG: 33126618
BUG: 29748723
Test: Manual, CTS-Verifier tests will be added in a follow-up

(cherry picked from commit a4e169ed68ee57aa249e5e79fcd6bff5df46199e)

Change-Id: Ib35d323605ab11f883a4b6199d1db79b9e53c49b
2016-12-16 19:25:29 +01:00
Michal Karpinski
a775ad997b Initialize AtomicBoolean for NetworkLogger#mIsLoggingEnabled
Test: cts-tradefed run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testNetworkLoggingWithSingleUser
Bug: 29748723

(cherry picked from commit e4dfd2d0028ff1c7088ec58a4d3eaf8f222311e6)

Change-Id: Ib175f1d57093590b0080f32dc5f6c60ea50066e0
2016-12-16 18:18:57 +00:00
Michal Karpinski
92cd0ce92d DO NOT MERGE Make NetworkLogger.mIsLoggingEnabled an AtomicBoolean
Fixes a potential race condition - when enabling/disabling the logging
some events might have been lost.

Bug: 29748723
Change-Id: I8a436d525393b2314805e287eddcea26d4ec073b
2016-12-15 12:54:36 +00:00
Michal Karpinski
c4e7c32063 DO NOT MERGE Logging when the new batch of network logs broadcast is sent to DO
Test: this only adds a log message
Bug: 29748723

(cherry picked from commit bcf1c58ec25f275fa25f8aab1c265da868e64e29)

Change-Id: Iad57528c60f35d4820a2f0196cccc92f7c4d3830
2016-12-13 17:24:55 +00:00
Michal Karpinski
504fa62f9e DO NOT MERGE Disable DO single user features when clearDeviceOwner() is called
regardless of the amount of users

Bug: 32901196
Bug: 29748723
Change-Id: Ie419b5e496e23656cbe5436942d9aba402bfe68e
2016-12-13 17:24:17 +00:00
Michal Karpinski
5c64223da4 DO NOT MERGE Fix disabling DO single user features when clearDeviceOwner() is called
We should disable those features before the DO is actually cleared.

Bug: 32901196
Bug: 29748723

(cherry picked from commit c44e67961170ddfb668372dc6e9ce6b391e3740f)

Change-Id: I74679abc26753585f302f3d52bca81fe21e2e668
2016-12-13 17:23:42 +00:00
Michal Karpinski
896b9db8ed DO NOT MERGE [DPM] Minor code fixes in NetworkLoggingHandler
Added a comment and renamed field to follow mConvention.

Test: will be CTS tested once APIs unhidden
Bug: 29748723

(cherry picked from commit aabe96db87838501d3abeb96c25a4b1c50b9c12c)

Change-Id: I7ef118723d13ce1d313c3c56299c2dca2411eee6
2016-12-13 17:22:53 +00:00
Michal Karpinski
bbf352a2c1 DO NOT MERGE [DPM] DO uses batch token to retrieve network logs, and can retrieve
the same batch many times

This allows DO to:
a) know that some logs were dropped (by trying with token and not
getting anything)
b) know how many logs were there in each batch (useful especially
for the dropped ones)
c) retry batch retrieval if it failed

Test: will be CTS tested once APIs unhidden
Bug: 29748723

(cherry picked from commit a9ff206af26871695bfce54969428b8ad03e31e6)

Change-Id: Iac10e61cdf3b100719a9c029ff897bd5ef5c8e2f
2016-12-13 17:22:07 +00:00
Michal Karpinski
4c47adef60 DO NOT MERGE [DPM] Management and retrieval of network logs
This CL follows up on ag/1530343 and adds:
1) Various network events.
2) Retrieval method in DPM and APIs in DeviceAdminReceiver.
3) Extension of NetworkLogger and it's NetworkLoggingHandler.

Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/NetworkEventTest.java
Bug: 29748723
Change-Id: I42a1a477e7c75c109a3982f809c22732b814e8b2
2016-12-13 17:19:22 +00:00
Michal Karpinski
c3abd34cfe DO NOT MERGE [DPM] DO can start network logging and listen for events
This CL adds:
1) Setter and getter in DPM to manipulate logging switch (retrieval
method to come in a subsequent CL(s)).
2) A way for DPM to register to listen for events.
3) Skeleton of NetworkLogger class (more to come in subsequent CL(s)).

Bug: 29748723
Change-Id: I5c04662ccc6febd2ba294b0eaca1ed1da9c16e47
2016-12-13 17:15:38 +00:00
Greg Plesur
34fb70ab88 If the current device is a watch, fix DeviceOwner/ProfileOwner logic.
In this case, don't require the device to have gone through the
Setup Wizard before disqualifying DO/PO if there's an incompatible
account on the device.

BUG: 32438704,32438210

Change-Id: I6858db13c8df6e95d01d18a903f4343f70370e8b
2016-11-03 17:35:42 -04:00
Michal Karpinski
bc755da55c Don't expose default strong auth timeout as constant
am: 6dbf67fc48

Change-Id: Iacbe9a2de7024e29e9c2c98594ebca828b855a43
2016-10-13 22:52:38 +00:00
TreeHugger Robot
a6b3caf58e Merge "Don't expose default strong auth timeout as constant" into nyc-mr1-dev 2016-10-13 22:47:30 +00:00
Greg Plesur
216ee1f0e7 Merge "DPM.isProvisioningAllowed(ACTION_PROVISION_MANAGED_DEVICE) should return 'false' for Wear devices after pairing/upgrade." into cw-f-dev 2016-10-13 21:02:01 +00:00