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

Commit b7095284 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Disable policy when bandwidth module missing." into jb-dev

parents c4be1b7e 8c1dc72b
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -319,6 +319,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();
@@ -1917,6 +1922,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.
     */