Merge "Fixed OneTimeSafetyChecker callback." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
caf9ae8b52
@@ -1073,6 +1073,7 @@ public class DeviceAdminReceiver extends BroadcastReceiver {
|
||||
private void onOperationSafetyStateChanged(Context context, Intent intent) {
|
||||
if (!hasRequiredExtra(intent, EXTRA_OPERATION_SAFETY_REASON)
|
||||
|| !hasRequiredExtra(intent, EXTRA_OPERATION_SAFETY_STATE)) {
|
||||
Log.w(TAG, "Igoring intent that's missing required extras");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1084,7 +1085,6 @@ public class DeviceAdminReceiver extends BroadcastReceiver {
|
||||
}
|
||||
boolean isSafe = intent.getBooleanExtra(EXTRA_OPERATION_SAFETY_STATE,
|
||||
/* defaultValue=*/ false);
|
||||
|
||||
onOperationSafetyStateChanged(context, reason, isSafe);
|
||||
}
|
||||
|
||||
|
||||
@@ -12344,7 +12344,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
Slog.v(LOG_TAG, String.format("notifyUnsafeOperationStateChanged(): %s=%b",
|
||||
DevicePolicyManager.operationSafetyReasonToString(reason), isSafe));
|
||||
}
|
||||
|
||||
Preconditions.checkArgument(mSafetyChecker == checker,
|
||||
"invalid checker: should be %s, was %s", mSafetyChecker, checker);
|
||||
|
||||
@@ -12352,7 +12351,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
extras.putInt(DeviceAdminReceiver.EXTRA_OPERATION_SAFETY_REASON, reason);
|
||||
extras.putBoolean(DeviceAdminReceiver.EXTRA_OPERATION_SAFETY_STATE, isSafe);
|
||||
|
||||
// TODO(b/178494483): add CTS test
|
||||
sendDeviceOwnerCommand(DeviceAdminReceiver.ACTION_OPERATION_SAFETY_STATE_CHANGED,
|
||||
extras);
|
||||
for (int profileOwnerId : mOwners.getProfileOwnerKeys()) {
|
||||
|
||||
@@ -72,11 +72,11 @@ final class OneTimeSafetyChecker implements DevicePolicySafetyChecker {
|
||||
DevicePolicyManagerInternal dpmi = LocalServices
|
||||
.getService(DevicePolicyManagerInternal.class);
|
||||
|
||||
Slog.i(TAG, "notifying " + reasonName + " is active");
|
||||
dpmi.notifyUnsafeOperationStateChanged(this, reason, true);
|
||||
Slog.i(TAG, "notifying " + reasonName + " is UNSAFE");
|
||||
dpmi.notifyUnsafeOperationStateChanged(this, reason, /* isSafe= */ false);
|
||||
|
||||
Slog.i(TAG, "notifying " + reasonName + " is inactive");
|
||||
dpmi.notifyUnsafeOperationStateChanged(this, reason, false);
|
||||
Slog.i(TAG, "notifying " + reasonName + " is SAFE");
|
||||
dpmi.notifyUnsafeOperationStateChanged(this, reason, /* isSafe= */ true);
|
||||
|
||||
Slog.i(TAG, "returning " + reasonName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user