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

Commit 996e6d1d authored by Paul Hu's avatar Paul Hu Committed by android-build-merger
Browse files

Merge "Add CONNECTIVITY_INTERNAL to bt tethering related APIs temporarily" am:...

Merge "Add CONNECTIVITY_INTERNAL to bt tethering related APIs temporarily" am: 60675ece am: 1fe8de53
am: f0f09efa

Change-Id: I645995f3101b1062dd15a85ada671badfae30ed3
parents 2ee5f0ae f0f09efa
Loading
Loading
Loading
Loading
+10 −3
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.server;
package com.android.server;


import static android.Manifest.permission.CONNECTIVITY_INTERNAL;
import static android.Manifest.permission.NETWORK_SETTINGS;
import static android.Manifest.permission.NETWORK_SETTINGS;
import static android.Manifest.permission.OBSERVE_NETWORK_POLICY;
import static android.Manifest.permission.OBSERVE_NETWORK_POLICY;
import static android.Manifest.permission.SHUTDOWN;
import static android.Manifest.permission.SHUTDOWN;
@@ -737,7 +738,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
    //
    //
    @Override
    @Override
    public String[] listInterfaces() {
    public String[] listInterfaces() {
        NetworkStack.checkNetworkStackPermission(mContext);
        // TODO: Remove CONNECTIVITY_INTERNAL after bluetooth tethering has no longer called these
        //  APIs.
        NetworkStack.checkNetworkStackPermissionOr(mContext, CONNECTIVITY_INTERNAL);
        try {
        try {
            return mNetdService.interfaceGetList();
            return mNetdService.interfaceGetList();
        } catch (RemoteException | ServiceSpecificException e) {
        } catch (RemoteException | ServiceSpecificException e) {
@@ -787,7 +790,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub {


    @Override
    @Override
    public InterfaceConfiguration getInterfaceConfig(String iface) {
    public InterfaceConfiguration getInterfaceConfig(String iface) {
        NetworkStack.checkNetworkStackPermission(mContext);
        // TODO: Remove CONNECTIVITY_INTERNAL after bluetooth tethering has no longer called these
        //  APIs.
        NetworkStack.checkNetworkStackPermissionOr(mContext, CONNECTIVITY_INTERNAL);
        final InterfaceConfigurationParcel result;
        final InterfaceConfigurationParcel result;
        try {
        try {
            result = mNetdService.interfaceGetCfg(iface);
            result = mNetdService.interfaceGetCfg(iface);
@@ -805,7 +810,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub {


    @Override
    @Override
    public void setInterfaceConfig(String iface, InterfaceConfiguration cfg) {
    public void setInterfaceConfig(String iface, InterfaceConfiguration cfg) {
        NetworkStack.checkNetworkStackPermission(mContext);
        // TODO: Remove CONNECTIVITY_INTERNAL after bluetooth tethering has no longer called these
        //  APIs.
        NetworkStack.checkNetworkStackPermissionOr(mContext, CONNECTIVITY_INTERNAL);
        LinkAddress linkAddr = cfg.getLinkAddress();
        LinkAddress linkAddr = cfg.getLinkAddress();
        if (linkAddr == null || linkAddr.getAddress() == null) {
        if (linkAddr == null || linkAddr.getAddress() == null) {
            throw new IllegalStateException("Null LinkAddress given");
            throw new IllegalStateException("Null LinkAddress given");