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

Commit 8085da84 authored by Alex Xu's avatar Alex Xu
Browse files

Clear calling identity when getting global security state

This allows callers to get the global security state across profiles.

Bug: 379868378
Test: m
Change-Id: Id81d98837fb69ab5c37c7fd502f99aba96379b01
parent 93b436df
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.os.SecurityStateManager.KEY_VENDOR_SPL;

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.ISecurityStateManager;
@@ -56,6 +57,15 @@ public class SecurityStateManagerService extends ISecurityStateManager.Stub {

    @Override
    public Bundle getGlobalSecurityState() {
        final long token = Binder.clearCallingIdentity();
        try {
            return getGlobalSecurityStateInternal();
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    private Bundle getGlobalSecurityStateInternal() {
        Bundle globalSecurityState = new Bundle();
        globalSecurityState.putString(KEY_SYSTEM_SPL, Build.VERSION.SECURITY_PATCH);
        globalSecurityState.putString(KEY_VENDOR_SPL,