Loading services/core/java/com/android/server/net/NetworkPolicyManagerService.java +5 −3 Original line number Original line Diff line number Diff line Loading @@ -1689,6 +1689,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } } writePolicy = true; writePolicy = true; } } updateRulesForGlobalChangeLocked(true); // Remove associated UID policies // Remove associated UID policies int[] uids = new int[0]; int[] uids = new int[0]; Loading Loading @@ -1862,8 +1863,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { Slog.i(TAG, "adding uid " + uid + " to restrict background whitelist"); Slog.i(TAG, "adding uid " + uid + " to restrict background whitelist"); synchronized (mRulesLock) { synchronized (mRulesLock) { mRestrictBackgroundWhitelistUids.append(uid, true); mRestrictBackgroundWhitelistUids.append(uid, true); updateRulesForGlobalChangeLocked(true); writePolicyLocked(); writePolicyLocked(); // TODO: call other update methods like updateNetworkRulesLocked? } } mHandler.obtainMessage(MSG_RESTRICT_BACKGROUND_WHITELIST_CHANGED, uid, 0).sendToTarget(); mHandler.obtainMessage(MSG_RESTRICT_BACKGROUND_WHITELIST_CHANGED, uid, 0).sendToTarget(); } } Loading @@ -1878,9 +1879,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { mHandler.obtainMessage(MSG_RESTRICT_BACKGROUND_WHITELIST_CHANGED, uid, 0).sendToTarget(); mHandler.obtainMessage(MSG_RESTRICT_BACKGROUND_WHITELIST_CHANGED, uid, 0).sendToTarget(); } } private void removeRestrictBackgroundWhitelistedUidLocked(int uid, boolean writePolicy) { private void removeRestrictBackgroundWhitelistedUidLocked(int uid, boolean updateNow) { mRestrictBackgroundWhitelistUids.delete(uid); mRestrictBackgroundWhitelistUids.delete(uid); if (writePolicy) { if (updateNow) { updateRulesForGlobalChangeLocked(true); writePolicyLocked(); writePolicyLocked(); } } } } Loading services/core/java/com/android/server/net/NetworkPolicyManagerShellCommand.java +12 −2 Original line number Original line Diff line number Diff line Loading @@ -215,7 +215,12 @@ class NetworkPolicyManagerShellCommand extends ShellCommand { if (uid < 0) { if (uid < 0) { return uid; return uid; } } final long token = Binder.clearCallingIdentity(); try { mInterface.addRestrictBackgroundWhitelistedUid(uid); mInterface.addRestrictBackgroundWhitelistedUid(uid); } finally { Binder.restoreCallingIdentity(token); } return 0; return 0; } } Loading @@ -224,7 +229,12 @@ class NetworkPolicyManagerShellCommand extends ShellCommand { if (uid < 0) { if (uid < 0) { return uid; return uid; } } final long token = Binder.clearCallingIdentity(); try { mInterface.removeRestrictBackgroundWhitelistedUid(uid); mInterface.removeRestrictBackgroundWhitelistedUid(uid); } finally { Binder.restoreCallingIdentity(token); } return 0; return 0; } } Loading Loading
services/core/java/com/android/server/net/NetworkPolicyManagerService.java +5 −3 Original line number Original line Diff line number Diff line Loading @@ -1689,6 +1689,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } } writePolicy = true; writePolicy = true; } } updateRulesForGlobalChangeLocked(true); // Remove associated UID policies // Remove associated UID policies int[] uids = new int[0]; int[] uids = new int[0]; Loading Loading @@ -1862,8 +1863,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { Slog.i(TAG, "adding uid " + uid + " to restrict background whitelist"); Slog.i(TAG, "adding uid " + uid + " to restrict background whitelist"); synchronized (mRulesLock) { synchronized (mRulesLock) { mRestrictBackgroundWhitelistUids.append(uid, true); mRestrictBackgroundWhitelistUids.append(uid, true); updateRulesForGlobalChangeLocked(true); writePolicyLocked(); writePolicyLocked(); // TODO: call other update methods like updateNetworkRulesLocked? } } mHandler.obtainMessage(MSG_RESTRICT_BACKGROUND_WHITELIST_CHANGED, uid, 0).sendToTarget(); mHandler.obtainMessage(MSG_RESTRICT_BACKGROUND_WHITELIST_CHANGED, uid, 0).sendToTarget(); } } Loading @@ -1878,9 +1879,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { mHandler.obtainMessage(MSG_RESTRICT_BACKGROUND_WHITELIST_CHANGED, uid, 0).sendToTarget(); mHandler.obtainMessage(MSG_RESTRICT_BACKGROUND_WHITELIST_CHANGED, uid, 0).sendToTarget(); } } private void removeRestrictBackgroundWhitelistedUidLocked(int uid, boolean writePolicy) { private void removeRestrictBackgroundWhitelistedUidLocked(int uid, boolean updateNow) { mRestrictBackgroundWhitelistUids.delete(uid); mRestrictBackgroundWhitelistUids.delete(uid); if (writePolicy) { if (updateNow) { updateRulesForGlobalChangeLocked(true); writePolicyLocked(); writePolicyLocked(); } } } } Loading
services/core/java/com/android/server/net/NetworkPolicyManagerShellCommand.java +12 −2 Original line number Original line Diff line number Diff line Loading @@ -215,7 +215,12 @@ class NetworkPolicyManagerShellCommand extends ShellCommand { if (uid < 0) { if (uid < 0) { return uid; return uid; } } final long token = Binder.clearCallingIdentity(); try { mInterface.addRestrictBackgroundWhitelistedUid(uid); mInterface.addRestrictBackgroundWhitelistedUid(uid); } finally { Binder.restoreCallingIdentity(token); } return 0; return 0; } } Loading @@ -224,7 +229,12 @@ class NetworkPolicyManagerShellCommand extends ShellCommand { if (uid < 0) { if (uid < 0) { return uid; return uid; } } final long token = Binder.clearCallingIdentity(); try { mInterface.removeRestrictBackgroundWhitelistedUid(uid); mInterface.removeRestrictBackgroundWhitelistedUid(uid); } finally { Binder.restoreCallingIdentity(token); } return 0; return 0; } } Loading