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

Commit 78c34132 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Give Telephony the permissions to access the network stack." am:...

Merge "Merge "Give Telephony the permissions to access the network stack." am: a6f34764 am: 1dba2f82 am: 5a390b36"
parents a58b7082 81cbed11
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -33,7 +33,9 @@ public final class PermissionUtil {
    public static void checkNetworkStackCallingPermission() {
    public static void checkNetworkStackCallingPermission() {
        // TODO: check that the calling PID is the system server.
        // TODO: check that the calling PID is the system server.
        final int caller = getCallingUid();
        final int caller = getCallingUid();
        if (caller != Process.SYSTEM_UID && UserHandle.getAppId(caller) != Process.BLUETOOTH_UID) {
        if (caller != Process.SYSTEM_UID
                && UserHandle.getAppId(caller) != Process.BLUETOOTH_UID
                && UserHandle.getAppId(caller) != Process.PHONE_UID) {
            throw new SecurityException("Invalid caller: " + caller);
            throw new SecurityException("Invalid caller: " + caller);
        }
        }
    }
    }
+2 −1
Original line number Original line Diff line number Diff line
@@ -289,7 +289,8 @@ public class NetworkStackClient {
    private void requestConnector(@NonNull NetworkStackCallback request) {
    private void requestConnector(@NonNull NetworkStackCallback request) {
        // TODO: PID check.
        // TODO: PID check.
        final int caller = Binder.getCallingUid();
        final int caller = Binder.getCallingUid();
        if (caller != Process.SYSTEM_UID && !UserHandle.isSameApp(caller, Process.BLUETOOTH_UID)) {
        if (caller != Process.SYSTEM_UID && !UserHandle.isSameApp(caller, Process.BLUETOOTH_UID)
                && !UserHandle.isSameApp(caller, Process.PHONE_UID)) {
            // Don't even attempt to obtain the connector and give a nice error message
            // Don't even attempt to obtain the connector and give a nice error message
            throw new SecurityException(
            throw new SecurityException(
                    "Only the system server should try to bind to the network stack.");
                    "Only the system server should try to bind to the network stack.");