Commit Graph

1569 Commits

Author SHA1 Message Date
kholoud mohamed
9bbab6a6df Remove platform-signed apps from configurable cross profile apps
Most apps that declare the INTERACT_ACROSS_PROFILES permission do
not have it granted, but get the app-op instead. We do not
normally want platform-signed apps that are actually given the
permission to appear in the user-configurable section in Settings,
so we remove them from the return value of
canUserAttemptToConfigureInteractAcrossProfiles in this CL.

Note that OEM can choose to allow some platform-signed apps to be
user-configurable by including them in their OEM whitelist file.
This CL respects that and allows these apps to be configured by the user,
despite being granted the permission. If the user rejects the app-op,
PermissionChecker correctly returns false.

Bug: 149742043
Test: atest CrossProfileAppsServiceImplRoboTest
Change-Id: I693338507eec9cdc0ba10a3584e994a58d2d113c
2020-04-06 10:13:09 +00:00
Alex Johnston
bb5e6b49a7 Merge "Changed how user restrictions are pushed to UM" into rvc-dev 2020-04-05 21:15:26 +00:00
Yvonne Jiang
70a62376d0 Mark secondary lockscreen API as SystemApi.
It is currently not meant for use by general enterprise device admins.

Bug: 152478326

Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Test: atest KeyguardUpdateMonitorTest
Test: atest AdminSecondaryLockScreenControllerTest
Change-Id: I6d60bc35a4e8f74b1da55b042582a2f2fa89d57f
2020-04-02 08:41:04 +00:00
Alex Johnston
ec6c3d35db Changed how user restrictions are pushed to UM
* Sort the user restrictions to local restriction
  set and global bundle in DPMS instead of User
  Manager.
* Simplify pushUserRestrictions.
* Split the list of user restrictions the profile
  owner of an organization-owned device can set into
  a global and local list. The user restrictions in
  the local list will only be applied to the personal
  profile as opposed to the whole device.

Bug: 149743941
     148453838
Test: atest com.android.cts.devicepolicy.UserRestrictionsTest
      atest com.android.server.devicepolicy.DevicePolicyManagerTest
      atest com.android.server.pm.UserRestrictionsUtilsTest
      atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testUserRestrictionSetOnParentLogged
      atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testUserRestrictionsSetOnParentAreNotPersisted
Change-Id: I1faa1f4776deb98e38595a358c01c3fbabfb1840
2020-03-30 20:39:30 +01:00
Artur Satayev
d6503d5cfd Merge "Export change id processor." into rvc-dev 2020-03-29 18:07:37 +00:00
Artur Satayev
f9172bd785 Export change id processor.
- Don't declare the plugin directly, it is exported via java_library that defines the sources.
- Remove unneeded framework-annotation-proc.

Bug: 152220864
Test: m && diff merged_compat_config.xml
Change-Id: Ie750b5391229d21679a8610780b9f8d4a997e204
Merged-In: Ie750b5391229d21679a8610780b9f8d4a997e204
(cherry picked from commit 9f5a5623a7)
2020-03-28 19:24:53 +00:00
Hui Yu
5e089a4af5 Merge changes from topic "foregroundServiceType camera/microphone" into rvc-dev
* changes:
  Turn on foregroundServiceType camera/microphone feature in enforcement mode.
  Exempt device owner uid from FGS BG restriction.
2020-03-28 05:14:47 +00:00
Michael Groover
01be396381 Merge "Clean up device identifier access logging" into rvc-dev 2020-03-27 16:39:44 +00:00
Hui Yu
7cfe82b0ba Exempt device owner uid from FGS BG restriction.
Bug: 136219221
Test: atest cts/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java
Change-Id: Ic7c592d711e89fcea0ebd7ccc5e33512a0bf03dc
2020-03-26 16:07:42 -07:00
Pavel Grafov
46f58562d4 Fix unsuspending personal apps.
Bug: 152479824
Test: atest OrgOwnedProfileOwnerTest#testPersonalAppsSuspensionNormalApp
Change-Id: If4923226dc60f682979cb289ae2da78f2ca7f98b
2020-03-26 16:33:38 +00:00
Alex Johnston
7bd3e833ce Merge "Make FRP APIs callable by Settings" into rvc-dev 2020-03-26 12:58:48 +00:00
Michael Groover
f17894f341 Clean up device identifier access logging
This commit removes the log message from DevicePolicyManagerService
when a caller fails the access requirements as it can be confusing
if the caller subsequently passes a carrier privilege check and can
access identifiers, or in the case where the caller does not have
access a similar entry is logged by TelephonyPermissions. The subId
for which the carrier privilege check is performed is also logged
to facilitate debugging.

Bug: 152117976
Test: atest SubscriptionControllerTest
Change-Id: I6d88d739a0d9053e8eff32d74d90009699abe8fc
2020-03-25 20:29:27 -07:00
Alex Johnston
103f93a7e6 Make FRP APIs callable by Settings
Background
* If the device is an organization-owned managed
  profile device and a FRP policy is set, the
  factory reset protection data is no longer
  erased from factory reset in Settings.

Changes
* Added isNotEmpty method to FRP policy.
* Allow Settings to call
  getFactoryResetProtectionPolicy
  by checking for the MASTER_CLEAR permission.

Bug: 148847767
Test: manual testing
      atest com.android.server.devicepolicy.DevicePolicyManagerTest
Change-Id: I04f178255dd215579087c33b675b40eed7a6eac7
2020-03-25 20:16:28 +00:00
Rubin Xu
9747684a07 Merge "Clear no_remove_managed_profile retriction when removing test PO" into rvc-dev 2020-03-25 15:55:23 +00:00
Rubin Xu
8d23b6bebd Clear no_remove_managed_profile retriction when removing test PO
Bug: 149898237
Test: atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest
Change-Id: I719ee98c7dda5e256e5c8e45b52888a130d6ff5a
2020-03-25 14:06:35 +00:00
Eran Messeri
37fc495766 Merge "Remove unnecessary parent restriction check" into rvc-dev 2020-03-25 09:06:56 +00:00
Eran Messeri
957d31d1b5 Remove unnecessary parent restriction check
When checking whether provisioning of a managed profile is allowed, it
is unnecessary to check whether there's a restriction on the parent user
because the check is done from the primary user.

If the check is done from inside a managed profile, then the check
should return false because a managed profile cannot be provisioned from
within another managed profile.

The DevicePolicyManagerTest was incorrectly returning user 0 as the
"parent user" for user 0, so changed the test to return null as the
profile parent for user 0.

Bug: 147631026
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.ManagedProfileTest#testIsProvisioningAllowed
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.DeviceOwnerTest#testIsManagedDeviceProvisioningAllowed
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.DeviceOwnerPlusProfileOwnerTest#testProvisioningNotAllowedWithDeviceOwner
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.CustomDeviceOwnerTest#testIsProvisioningAllowed
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.CustomManagedProfileTest#testIsProvisioningAllowed
Change-Id: Ia62dce93265ec65b61a048c4d96f96baa4598a57
2020-03-24 14:29:39 +00:00
Pavel Grafov
97bb33b93c Suspend newly installed apps when personal apps are suspended
Also make use of PackageManager.getUnsuspendablePackages() which
already takes care of launcher and dialer packages and some
other critical apps, like package verifier, package
[un-]installer, etc.

For newly installed packages it PackageManager.getUnsuspendableApps()
seems to be sufficient since that app won't be critical for the
functioning of the device.

Test: Test: atest
    OrgOwnedProfileOwnerTest#testPersonalAppsSuspensionInstalledApp
Bug: 149394138
Change-Id: Ic3196dbfdd5c506e708563d305a42494391dc878
2020-03-24 12:28:07 +00:00
TreeHugger Robot
e39a7b6a80 Merge "Don't notify about explicit personal app suspension." into rvc-dev 2020-03-23 15:29:31 +00:00
Pavel Grafov
64d1fc040b Don't notify about explicit personal app suspension.
Notification about personal apps suspension should only be shown
in cases when apps are suspended because of maximum work profile
time off policy violation, not via an explicit call to suspend.

+ updated strings. Note, some strings are not used yet.

Test: manual, with TestDPC, suspended apps explicitly, checked
    that the notification is not shown.
Test: manual, with TestDPC, set maximum work profile time off,
    adjusted the clock, checked that the notification is there.`
Bug: 151918490
Bug: 149076989
Change-Id: Idd4c7ec11af416c303c9218495d55c73154c7a5f
2020-03-23 13:35:22 +00:00
Yvonne Jiang
8345da3a97 Secondary Lockscreen API: improve documentation and rename onSurfaceReady method.
- Documentation clarity and method rename per API review feedback.
- Specifying in documentation and implementation that the implementing service must be exported by the Profile Owner.

Bug: 150866056
Bug: 136085151
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Test: atest KeyguardUpdateMonitorTest
Test: atest AdminSecondaryLockScreenControllerTest
Change-Id: I58175bd6cf8936f5b1267625ca15b4f9c57f4144
2020-03-20 17:06:24 +00:00
Rubin Xu
243c57f079 Merge "Replace COMMON_CRITERIA_MODE setting with getter API" into rvc-dev 2020-03-18 18:42:28 +00:00
Pavel Grafov
1628ee0aaf Make work profile maximum time off at least 3 days.
Bug: 150668401
Test: manual, with TestDPC (not testOnly)
Test: atest OrgOwnedProfileOwnerTest#testWorkProfileMaximumTimeOff
Change-Id: I9d274c67ff99d903ceb26b2233038b405c58e958
2020-03-16 16:08:04 +00:00
TreeHugger Robot
777531511f Merge "Rename get/setProtectedPackages methods" into rvc-dev 2020-03-15 23:05:42 +00:00
Pavel Grafov
75e2ea6bb4 Merge "Clarify time units for setManagedProfileMaximumTimeOff argument." into rvc-dev 2020-03-13 14:30:07 +00:00
Alex Johnston
1dbdcbc689 Merge "Rename AutoTime and AutoTimeZone APIs" into rvc-dev 2020-03-13 10:00:43 +00:00
Rubin Xu
f07973239a Replace COMMON_CRITERIA_MODE setting with getter API
Per API review feedback, global settings are discouraged in favour
of fine-grained getter APIs.

Bug: 149999040
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testCommonCriteriaMode
Test: atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testCommonCriteriaMode
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Change-Id: Ia810f67409ce2b482bca06f1e21df2f98d12ccfd
2020-03-12 12:03:15 +00:00
lucaslin
826224dbc1 Add enforceNetworkStackOrProfileOrDeviceOwner()
Add enforceNetworkStackOrProfileOrDeviceOwner() to check if the
caller has PERMISSION_MAINLINE_NETWORK_STACK or not.

Call this check in isAlwaysOnVpnLockdownEnabled() for allowing
the caller which has PERMISSION_MAINLINE_NETWORK_STACK to get the
status of always-on VPN.

Bug: 141621373
Test: 1. Build pass
      2. Manual test to see if CaptivePortalLoginActivity could
      deal with the issue properly.
Change-Id: I3b7ddc2543e6b4754d6eaac128ca9a8ccea6b59c
2020-03-12 13:23:52 +08:00
Srinivas Paladugu
8faac83a3f Rename get/setProtectedPackages methods
Based on API council feedback that current method names are ambiguous,
renaming them with
setUserControlDisabledPackages/getUserControlDisabledPackages.

Bug: 150865604
Test: atest DevicePolicyManagerTest
atest com.android.cts.devicepolicy.DeviceOwnerTest#testSetUserControlDisabledPackages

Change-Id: I74f07ae5f0e9b425a6f2e4aa52d2cb8ac42da68e
2020-03-11 11:21:49 -07:00
Pavel Grafov
822a7fbdb7 Clarify time units for setManagedProfileMaximumTimeOff argument.
This CL addressess API Review comment.

Bug: 150685276
Test: compiles
Change-Id: I23107617004db7fab19a77331b17fd5dc16d69d8
2020-03-10 13:52:50 +00:00
Neil Fuller
ce50962714 Revert DevicePolicyManager time / zone changes
Revert recent changes that make DevicePolicyManager call TimeDetector /
TimeZoneDetector to change the device time / time zone.

The DPC app runs as the user, so any rules that the TimeDetector /
TimeZoneDetector wants to enforce about what the end user can do will
need to be different for the DPMS path. There will be a dedicated
(probably LocalService) code path for the DPMS to use instead.

Bug: 140712361
Test: treehugger
Merged-In: Ia60702492231cc4c7c5de157c1f266d30996d950
Change-Id: Ia60702492231cc4c7c5de157c1f266d30996d950
(cherry picked from commit 77c9fcdb10)
2020-03-10 11:57:38 +00:00
Alex Johnston
2e24529c68 Rename AutoTime and AutoTimeZone APIs
* Rename setAutoTime and getAutoTime to
  setAutoTimeEnabled and getAutoTimeEnabled.
* Rename setAutoTimeZone and getAutoTimeZone
  to setAutoTimeZoneEnabled and
  getAutoTimeZoneEnabled.

Bug: 150958098
Test: atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testSetTime
      atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testSetTimeZone
      atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSetAutoTimeEnabled
      atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSetAutoTimeZoneEnabled
      atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSetTime
      atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSetTimeZone
      atest com.android.cts.devicepolicy.ManagedProfileTest#testParentProfileApiDisabled
Change-Id: I57a220549c33bcbbf2f3e37a1a724965ef2a9546
2020-03-09 13:18:07 +00:00
Eran Messeri
9c5f79ef29 Merge "Restrict adding managed profile in DO devices" into rvc-dev 2020-03-06 11:47:34 +00:00
TreeHugger Robot
deae24674d Merge "Fix leaks of personal apps in setApplicationHidden" into rvc-dev 2020-03-05 15:49:53 +00:00
Rubin Xu
cf5670aa4e Merge "Fix DPMS.findAdmin() after app enumeration restrictions" into rvc-dev 2020-03-05 11:37:30 +00:00
Eran Messeri
46bedf3184 Restrict adding managed profile in DO devices
On devices that have a Device Owner, or had a Device Owner and Profile
Owner and the managed profile was removed, apply the restriction
for adding a managed profile.

This would prevent such devices from getting into the DO+PO mode, which
is no longer supported in R.

Bug: 149006203
Test: Manual, set TestDPC as the Device Owner, upgrade it, observe TestDPC cannot create a managed profile.
Test: Manual, have a device with different DO and PO packages, remove PO, observe it cannot be re-added.
Change-Id: Iea48049a671071d2ad075b5e4c9ae3ce830975d3
2020-03-05 10:41:06 +00:00
Alex Johnston
fff2595d2a Fix leaks of personal apps in setApplicationHidden
* If setApplicationHidden is called with a non-system
  non-installed app, the exception thrown exposes
  whether the app is installed on the personal side.
* To solve this, the exception thrown is wrapped
  and a different message, which does not include
  whether the app is installed, is used.

Bug: 150677248
Test: atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testApplicationHiddenParent
Change-Id: I742b5d71904e5d54cc2b353448fa043bbc7293cb
2020-03-04 17:22:34 +00:00
Rubin Xu
b460022e40 Fix DPMS.findAdmin() after app enumeration restrictions
Clear binder identity before calling into PackageManager APIs.

Bug: 149932907
Test: atest com.android.cts.devicepolicy.MixedProfileOwnerHostSideTransferTest
Change-Id: I6376a79d7cac6a296adfa267cb07f719400f9c59
2020-03-04 16:29:21 +00:00
Soonil Nagarkar
e21ba28bec Clear binder identity before checking with compat service
Bug: 149673005
Test: manual
Change-Id: I3afa190d658106e6fa31bfe11d5dd9775c108887
2020-03-02 15:37:01 -08:00
TreeHugger Robot
126d683133 Merge "Clear binder identity before querying package information" into rvc-dev 2020-03-02 22:39:30 +00:00
Rubin Xu
547ef07710 Clear binder identity before querying package information
DevicePolicyManagerService needs to clear caller identity before
calling into PackageManager APIs, to make sure the app enumeration
restriction in R does not adversely affect its functionalities.

Bug: 150407679
Test: MixedManagedProfileOwnerTest#testDelegatedCertInstaller
      (without the stopgap fix ag/10456865)
Change-Id: I237c527241c26a309302bc2f7e36f8007a6c53b8
2020-03-02 20:55:59 +00:00
Alex Johnston
bb1d2a931b Fix testScreenCaptureDisabled
* A SecurityException was being thrown because getProfiles
  in UserManager cannot be called by the COPE PO for user 0
  without permission MANAGE_USERS or CREATE_USERS.
* Added binderWithCleanCallingIdentity to this method.

Bug: 149941985
Test: atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testScreenCaptureDisabled
Change-Id: Iccc60233baaeaa732f197d7aaf31acc9d75a247b
Merged-In: Iccc60233baaeaa732f197d7aaf31acc9d75a247b
(cherry picked from commit 2797594914)
2020-02-28 14:00:16 +00:00
Suprabh Shukla
1b6ce9ec76 Merge "Let admin block suspend in some cases" 2020-02-21 10:02:06 +00:00
Joshua Duong
10d71243b2 Merge changes from topic "adbwifi-aosp"
* changes:
  Add Settings.Global.ADB_WIFI_ENABLED.
  [adbwifi] SysUI: Add WifiDebuggingActivity.
2020-02-21 02:22:08 +00:00
Joshua Duong
2076c04333 Add Settings.Global.ADB_WIFI_ENABLED.
ADB_ENABLED historically meant the state for USB debugging. Since
wireless debugging can be enabled separately, define another setting
for it.

BUG: b/111434128

Test: make
Exempt-From-Owner-Approval: approved in aosp_master
Change-Id: If3abca8e77381d6832f55d55a43c52ee1a1267d1
2020-02-21 02:21:08 +00:00
Rubin Xu
cb40b9881d Merge "Support security logging on org-owned managed profile devices" 2020-02-21 00:00:03 +00:00
Soonil Nagarkar
a6149521d3 Merge "Revert requestSetProviderEnabled API" 2020-02-20 16:34:37 +00:00
Rubin Xu
1480ce7b87 Support security logging on org-owned managed profile devices
When security logging is enabled on org-owned profile devices,
Security events will be redacted to preserve privacy on the personal
profile as follows:

* TAG_ADB_SHELL_CMD
  Shell command will be redacted.

* TAG_MEDIA_MOUNT
* TAG_MEDIA_UNMOUNT
  The media's volume name will be redacted.

* TAG_APP_PROCESS_START
* TAG_CERT_AUTHORITY_INSTALLED
* TAG_CERT_AUTHORITY_REMOVED
* TAG_KEY_GENERATED
* TAG_KEY_IMPORT
* TAG_KEY_DESTRUCTION
* TAG_KEY_INTEGRITY_VIOLATION
  Only events happening inside the managed profile will be returned
  to the admin.

Bug: 148437300
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Test: atest FrameworksServicesTests:SecurityEventTest
Test: atest FrameworksCoreTests:EventLogTest
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSecurityLoggingWithSingleUser
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSecurityLoggingWithTwoUsers
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSecurityLoggingEnabledLogged
Test: atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testSecurityLogging

Change-Id: I2e52229a3163b3e0dc3d80d71700023394d84587
2020-02-20 15:47:29 +00:00
TreeHugger Robot
1ef019d3e0 Merge "Disable Settings toggle if admin has set always-on VPN" 2020-02-20 10:09:34 +00:00
Suprabh Shukla
f0f84c8f92 Let admin block suspend in some cases
There may be policy critical apps that must not be suspended by the
user in a managed profile. The owner can now use either of the following
to block suspension of apps:
 - DISALLOW_APPS_CONTROL: Blocks suspension of all apps in the user
 - DISALLOW_UNINSTALL_APPS: Blocks suspension of all apps in the user
 - setUninstallBlocked: Blocks suspension of a given package.

The same also block any of the DistractionRestriction to be set via
PackageManager#setDistractingPackageRestrictions. This is to make sure
the apps can still show notifications.

Since the owner should have the final call, these do not block the owner
from adding app suspensions itself. Whenever either of these are set,
any app suspensions that were not originally added by the owner are
lifted immediately and any distraction restrictions that were added are
removed.

Also, clearing restrictions and suspensions if an app with SUSPEND_APPS
permission is disabled. Even though it is expected that UI not allow
such an app to be disabled, it is hard to enforce across all device
implementations. And a missed edge case would lead to permanently
unusable apps on the device.

This change also fixes a bug where any DistractionRestrictions set
weren't cleared on suspending app data clear.

Test: atest GtsSuspendAppsTestCases

Bug: 144826981
Bug: 145735990
Change-Id: I81a492e1d07a8cc9aeb0acd7e5142826824a42ae
2020-02-19 15:56:17 -08:00