Merge "Change streaming policy implementations" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
78a91deb5e
@@ -7466,9 +7466,10 @@ package android.app.admin {
|
||||
field public static final int LOCK_TASK_FEATURE_SYSTEM_INFO = 1; // 0x1
|
||||
field public static final int MAKE_USER_EPHEMERAL = 2; // 0x2
|
||||
field public static final String MIME_TYPE_PROVISIONING_NFC = "application/com.android.managedprovisioning";
|
||||
field public static final int NEARBY_STREAMING_DISABLED = 0; // 0x0
|
||||
field public static final int NEARBY_STREAMING_ENABLED = 1; // 0x1
|
||||
field public static final int NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY = 2; // 0x2
|
||||
field public static final int NEARBY_STREAMING_DISABLED = 1; // 0x1
|
||||
field public static final int NEARBY_STREAMING_ENABLED = 2; // 0x2
|
||||
field public static final int NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY = 0; // 0x0
|
||||
field public static final int NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY = 3; // 0x3
|
||||
field public static final int OPERATION_SAFETY_REASON_DRIVING_DISTRACTION = 1; // 0x1
|
||||
field public static final int PASSWORD_COMPLEXITY_HIGH = 327680; // 0x50000
|
||||
field public static final int PASSWORD_COMPLEXITY_LOW = 65536; // 0x10000
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -63,7 +63,7 @@ import static android.app.admin.DevicePolicyManager.LEAVE_ALL_SYSTEM_APPS_ENABLE
|
||||
import static android.app.admin.DevicePolicyManager.LOCK_TASK_FEATURE_HOME;
|
||||
import static android.app.admin.DevicePolicyManager.LOCK_TASK_FEATURE_NOTIFICATIONS;
|
||||
import static android.app.admin.DevicePolicyManager.LOCK_TASK_FEATURE_OVERVIEW;
|
||||
import static android.app.admin.DevicePolicyManager.NEARBY_STREAMING_DISABLED;
|
||||
import static android.app.admin.DevicePolicyManager.NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY;
|
||||
import static android.app.admin.DevicePolicyManager.NON_ORG_OWNED_PROFILE_KEYGUARD_FEATURES_AFFECT_OWNER;
|
||||
import static android.app.admin.DevicePolicyManager.OPERATION_SAFETY_REASON_NONE;
|
||||
import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_HIGH;
|
||||
@@ -7548,21 +7548,25 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearbyNotificationStreamingPolicy() {
|
||||
public int getNearbyNotificationStreamingPolicy(final int userId) {
|
||||
if (!mHasFeature) {
|
||||
return NEARBY_STREAMING_DISABLED;
|
||||
return NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY;
|
||||
}
|
||||
|
||||
final CallerIdentity caller = getCallerIdentity();
|
||||
Preconditions.checkCallAuthorization(
|
||||
isDeviceOwner(caller)
|
||||
|| isProfileOwner(caller)
|
||||
|| hasCallingOrSelfPermission(permission.READ_NEARBY_STREAMING_POLICY));
|
||||
isProfileOwner(caller)
|
||||
|| isDeviceOwner(caller)
|
||||
|| hasCallingOrSelfPermission(permission.READ_NEARBY_STREAMING_POLICY));
|
||||
|
||||
synchronized (getLockObject()) {
|
||||
final ActiveAdmin admin = getProfileOwnerOrDeviceOwnerLocked(caller);
|
||||
return admin.mNearbyNotificationStreamingPolicy;
|
||||
if (mOwners.hasProfileOwner(userId) || mOwners.hasDeviceOwner()) {
|
||||
final ActiveAdmin admin = getDeviceOrProfileOwnerAdminLocked(userId);
|
||||
return admin.mNearbyNotificationStreamingPolicy;
|
||||
}
|
||||
}
|
||||
|
||||
return NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -7584,21 +7588,25 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearbyAppStreamingPolicy() {
|
||||
public int getNearbyAppStreamingPolicy(final int userId) {
|
||||
if (!mHasFeature) {
|
||||
return NEARBY_STREAMING_DISABLED;
|
||||
return NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY;
|
||||
}
|
||||
|
||||
final CallerIdentity caller = getCallerIdentity();
|
||||
Preconditions.checkCallAuthorization(
|
||||
isDeviceOwner(caller)
|
||||
|| isProfileOwner(caller)
|
||||
|| hasCallingOrSelfPermission(permission.READ_NEARBY_STREAMING_POLICY));
|
||||
isProfileOwner(caller)
|
||||
|| isDeviceOwner(caller)
|
||||
|| hasCallingOrSelfPermission(permission.READ_NEARBY_STREAMING_POLICY));
|
||||
|
||||
synchronized (getLockObject()) {
|
||||
final ActiveAdmin admin = getProfileOwnerOrDeviceOwnerLocked(caller);
|
||||
return admin.mNearbyAppStreamingPolicy;
|
||||
if (mOwners.hasProfileOwner(userId) || mOwners.hasDeviceOwner()) {
|
||||
final ActiveAdmin admin = getDeviceOrProfileOwnerAdminLocked(userId);
|
||||
return admin.mNearbyAppStreamingPolicy;
|
||||
}
|
||||
}
|
||||
|
||||
return NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user