Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18c9b13c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fixed OneTimeSafetyChecker callback." into sc-dev am: caf9ae8b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13621542

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6a5786c8ef7515115c9cbe70e5bad3a1aac05f26
parents 6615aaf3 caf9ae8b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
    }

+0 −2
Original line number Diff line number Diff line
@@ -12347,7 +12347,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);
@@ -12355,7 +12354,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()) {
+4 −4
Original line number Diff line number Diff line
@@ -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);