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

Commit 7e0fe5d2 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by The Android Automerger
Browse files

Disable policy when bandwidth module missing.

Bug: 6447017
Change-Id: I705a223dac15fc41e231bb9c81a96a287caaf094
parent 6c9035cc
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -318,6 +318,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
    }

    public void systemReady() {
        if (!isBandwidthControlEnabled()) {
            Slog.w(TAG, "bandwidth controls disabled, unable to enforce policy");
            return;
        }

        synchronized (mRulesLock) {
            // read policy from disk
            readPolicyLocked();
@@ -1897,6 +1902,18 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
        }
    }

    private boolean isBandwidthControlEnabled() {
        final long token = Binder.clearCallingIdentity();
        try {
            return mNetworkManager.isBandwidthControlEnabled();
        } catch (RemoteException e) {
            // ignored; service lives in system_server
            return false;
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    /**
     * Try refreshing {@link #mTime} when stale.
     */