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

Commit d5db50ee authored by arangelov's avatar arangelov
Browse files

Add UserRestrictionChanged atom and log to track user restriction events.

Test: none
Bug: 114382154
Change-Id: I20dcdce657e1fed3057d84df5f427542bbabf2cc
parent a28e38fa
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ message Atom {
        BatteryCausedShutdown battery_caused_shutdown = 93;
        PhoneServiceStateChanged phone_service_state_changed = 94;
        PhoneStateChanged phone_state_changed = 95;
        UserRestrictionChanged user_restriction_changed = 96;
    }

    // Pulled events will start at field 10000.
@@ -3049,3 +3050,17 @@ message ProcessCpuTime {
    // Process cpu time in system space, cumulative from boot/process start
    optional int64 system_time_millis = 4;
}

/**
 * Logs when a user restriction was added or removed.
 *
 * Logged from:
 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
 */
message UserRestrictionChanged {
    // The raw string of the user restriction as defined in UserManager.
    // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
    optional string restriction = 1;
    // Whether the restriction is enabled or disabled.
    optional bool enabled = 2;
}
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -206,6 +206,7 @@ import android.util.Log;
import android.util.Pair;
import android.util.Slog;
import android.util.SparseArray;
import android.util.StatsLog;
import android.util.Xml;
import android.view.IWindowManager;
import android.view.accessibility.AccessibilityManager;
@@ -9373,6 +9374,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
            }
            saveUserRestrictionsLocked(userHandle);
        }
        StatsLog.write(StatsLog.USER_RESTRICTION_CHANGED, key, enabledFromThisOwner);
        if (SecurityLog.isLoggingEnabled()) {
            final int eventTag = enabledFromThisOwner
                    ? SecurityLog.TAG_USER_RESTRICTION_ADDED