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

Commit 0dd68fdb authored by Neil Fuller's avatar Neil Fuller Committed by Automerger Merge Worker
Browse files

Merge "Fix permission issues for network update service" am: 1aed0289 am: f240a52f

parents 9251e4c5 f240a52f
Loading
Loading
Loading
Loading
+27 −13
Original line number Diff line number Diff line
@@ -165,9 +165,14 @@ public class NetworkTimeUpdateService extends Binder {
        mContext.enforceCallingPermission(
                android.Manifest.permission.SET_TIME, "clear latest network time");

        final long token = Binder.clearCallingIdentity();
        try {
            mTime.clearCachedTimeResult();

            mLocalLog.log("clearTimeForTests");
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    /**
@@ -181,6 +186,8 @@ public class NetworkTimeUpdateService extends Binder {
        mContext.enforceCallingPermission(
                android.Manifest.permission.SET_TIME, "force network time refresh");

        final long token = Binder.clearCallingIdentity();
        try {
            boolean success = mTime.forceRefresh();
            mLocalLog.log("forceRefreshForTests: success=" + success);

@@ -188,8 +195,10 @@ public class NetworkTimeUpdateService extends Binder {
                makeNetworkTimeSuggestion(mTime.getCachedTimeResult(),
                        "Origin: NetworkTimeUpdateService: forceRefreshForTests");
            }

            return success;
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    /**
@@ -201,10 +210,15 @@ public class NetworkTimeUpdateService extends Binder {
        mContext.enforceCallingPermission(
                android.Manifest.permission.SET_TIME, "set NTP server config for tests");

        final long token = Binder.clearCallingIdentity();
        try {
            mLocalLog.log("Setting server config for tests: hostname=" + hostname
                    + ", port=" + port
                    + ", timeout=" + timeout);
            mTime.setServerConfigForTests(hostname, port, timeout);
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    private void onPollNetworkTime(int event) {