diff options
| author | Richard Ho <richo@google.com> | 2021-04-07 19:24:26 -0700 |
|---|---|---|
| committer | Richard Ho <richo@google.com> | 2021-04-29 19:31:56 -0700 |
| commit | de8fe06dfa69ef0275fa6ae2de2bb5814e897f0a (patch) | |
| tree | 6f3ff96ae9ce353916e24a0f306af93dc029d9f3 /core/java/android | |
| parent | 9773696596c08bc64fa6948f041f5cbbba51dd2d (diff) | |
Change streaming policy implementations
- Use userId in streaming policy getters.
- Check if PO or DO exist
- Return NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY if DPC is not
present.
Bug: 179910174
Bug: 179910177
Test: Builds successfully
Change-Id: I49191a4ddea45925772d39614f5d7f82657b26ee
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/admin/DevicePolicyManager.java | 34 | ||||
| -rw-r--r-- | core/java/android/app/admin/IDevicePolicyManager.aidl | 4 |
2 files changed, 27 insertions, 11 deletions
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index cbf2d6a12bec..f07f45389d82 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -1678,23 +1678,30 @@ public class DevicePolicyManager { }) public @interface PasswordComplexity {} + /** + * Indicates that nearby streaming is not controlled by policy, which means nearby streaming is + * allowed. + */ + public static final int NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY = 0; + /** Indicates that nearby streaming is disabled. */ - public static final int NEARBY_STREAMING_DISABLED = 0; + public static final int NEARBY_STREAMING_DISABLED = 1; /** Indicates that nearby streaming is enabled. */ - public static final int NEARBY_STREAMING_ENABLED = 1; + public static final int NEARBY_STREAMING_ENABLED = 2; /** * Indicates that nearby streaming is enabled only to devices offering a comparable level of * security, with the same authenticated managed account. */ - public static final int NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY = 2; + public static final int NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY = 3; /** * @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = {"NEARBY_STREAMING_"}, value = { + NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY, NEARBY_STREAMING_DISABLED, NEARBY_STREAMING_ENABLED, NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY, @@ -7199,15 +7206,20 @@ public class DevicePolicyManager { /** * Returns the current runtime nearby notification streaming policy set by the device or profile - * owner. The default is {@link #NEARBY_STREAMING_DISABLED}. + * owner. */ public @NearbyStreamingPolicy int getNearbyNotificationStreamingPolicy() { + return getNearbyNotificationStreamingPolicy(myUserId()); + } + + /** @hide per-user version */ + public @NearbyStreamingPolicy int getNearbyNotificationStreamingPolicy(int userId) { throwIfParentInstance("getNearbyNotificationStreamingPolicy"); if (mService == null) { - return NEARBY_STREAMING_DISABLED; + return NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY; } try { - return mService.getNearbyNotificationStreamingPolicy(); + return mService.getNearbyNotificationStreamingPolicy(userId); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } @@ -7235,15 +7247,19 @@ public class DevicePolicyManager { /** * Returns the current runtime nearby app streaming policy set by the device or profile owner. - * The default is {@link #NEARBY_STREAMING_DISABLED}. */ public @NearbyStreamingPolicy int getNearbyAppStreamingPolicy() { + return getNearbyAppStreamingPolicy(myUserId()); + } + + /** @hide per-user version */ + public @NearbyStreamingPolicy int getNearbyAppStreamingPolicy(int userId) { throwIfParentInstance("getNearbyAppStreamingPolicy"); if (mService == null) { - return NEARBY_STREAMING_DISABLED; + return NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY; } try { - return mService.getNearbyAppStreamingPolicy(); + return mService.getNearbyAppStreamingPolicy(userId); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index 8e86f6545f23..370db60fb825 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -134,10 +134,10 @@ interface IDevicePolicyManager { boolean getScreenCaptureDisabled(in ComponentName who, int userHandle, boolean parent); void setNearbyNotificationStreamingPolicy(int policy); - int getNearbyNotificationStreamingPolicy(); + int getNearbyNotificationStreamingPolicy(int userId); void setNearbyAppStreamingPolicy(int policy); - int getNearbyAppStreamingPolicy(); + int getNearbyAppStreamingPolicy(int userId); void setKeyguardDisabledFeatures(in ComponentName who, int which, boolean parent); int getKeyguardDisabledFeatures(in ComponentName who, int userHandle, boolean parent); |
