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

Commit b0f35611 authored by Alex Xu's avatar Alex Xu Committed by Android Build Coastguard Worker
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
(cherry picked from https://android-review.googlesource.com/q/commit:8085da84faaadf8513770d6f3ed36b9cbee0d1ed)
Merged-In: Id81d98837fb69ab5c37c7fd502f99aba96379b01
Change-Id: Id81d98837fb69ab5c37c7fd502f99aba96379b01
parent 608a6c53
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.os.SecurityStateManager.KEY_VENDOR_SPL;


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


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

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