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

am: a6f3476476

Change-Id: I4ae09aac25226904e34d77edb7333da0aabe86f9
This commit is contained in:
Chalard Jean
2019-03-08 08:38:35 -08:00
committed by android-build-merger
2 changed files with 5 additions and 2 deletions

View File

@@ -33,7 +33,9 @@ public final class PermissionUtil {
public static void checkNetworkStackCallingPermission() {
// TODO: check that the calling PID is the system server.
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);
}
}

View File

@@ -289,7 +289,8 @@ public class NetworkStackClient {
private void requestConnector(@NonNull NetworkStackCallback request) {
// TODO: PID check.
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
throw new SecurityException(
"Only the system server should try to bind to the network stack.");