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

Commit 571cc979 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make sure we clear the calling identity when getting the broadcast...

Merge "Make sure we clear the calling identity when getting the broadcast allowlist to ensure the permission check does not fail while reading DeviceConfig" into sc-dev
parents d5af7f4a a87321f3
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -923,6 +923,9 @@ public final class Utils {
    }

    public static @NonNull Bundle getTempAllowlistBroadcastOptions() {
        // Use the Bluetooth process identity to pass permission check when reading DeviceConfig
        final long ident = Binder.clearCallingIdentity();
        try {
            final long durationMs = DeviceConfig.getLong(DeviceConfig.NAMESPACE_BLUETOOTH,
                    KEY_TEMP_ALLOW_LIST_DURATION_MS, DEFAULT_TEMP_ALLOW_LIST_DURATION_MS);
            final BroadcastOptions bOptions = BroadcastOptions.makeBasic();
@@ -930,5 +933,8 @@ public final class Utils {
                    TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_ALLOWED,
                    PowerExemptionManager.REASON_BLUETOOTH_BROADCAST, "");
            return bOptions.toBundle();
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }
}