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

Commit 73c5ada0 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android Git Automerger
Browse files

am eb279868: am b7095284: Merge "Disable policy when bandwidth module missing." into jb-dev

* commit 'eb279868':
  Disable policy when bandwidth module missing.
parents 66ff373f eb279868
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.
     */