Removed screen on/off callbacks from NPMS.

NetworkPolicyManagerService (NPMS) used to depend on screen on/off
changes to determine if a foreground activity should have network
restrictions, but such check is now redundant since ActivityManager
already changes the proper UID state (like going from TOP to
TOP_SLEEPING) when the screen status is changed.

Removing such code decreases the NPMS lock contention when the screen is
turned on in about 3-5ms.

Change-Id: I2853443efedbf14961ae9a5b2e72689d4d1a646c
BUG: 30785671
(cherry picked from commit 88f40ad9a7)
This commit is contained in:
Felipe Leme
2016-08-10 13:00:32 -07:00
parent e24a4590bf
commit f8dd7b4e8d
3 changed files with 15 additions and 125 deletions

View File

@@ -809,10 +809,8 @@ public final class SystemServer {
traceBeginAndSlog("StartNetworkPolicyManagerService");
try {
networkPolicy = new NetworkPolicyManagerService(
context, mActivityManagerService,
(IPowerManager)ServiceManager.getService(Context.POWER_SERVICE),
networkStats, networkManagement);
networkPolicy = new NetworkPolicyManagerService(context,
mActivityManagerService, networkStats, networkManagement);
ServiceManager.addService(Context.NETWORK_POLICY_SERVICE, networkPolicy);
} catch (Throwable e) {
reportWtf("starting NetworkPolicy Service", e);