diff options
author | Wenchao Tong <tongwenchao@google.com> | 2015-07-22 11:15:09 -0700 |
---|---|---|
committer | Wenchao Tong <tongwenchao@google.com> | 2015-07-22 16:29:49 -0700 |
commit | 7cc902bea78dd16488d367e8ed0ccf25d4d825c2 (patch) | |
tree | 4917ede1aeac2ec6874718fb8ce571c1698d114f /services/usage/java | |
parent | bdb7d936512a39b6c06411d11a26824b82e5727f (diff) | |
download | frameworks_base-7cc902bea78dd16488d367e8ed0ccf25d4d825c2.zip frameworks_base-7cc902bea78dd16488d367e8ed0ccf25d4d825c2.tar.gz frameworks_base-7cc902bea78dd16488d367e8ed0ccf25d4d825c2.tar.bz2 |
Ignore the active network scorer when checking for idleness
Bug: 22667334
Change-Id: I97085e653c146eff148458440bbac0a2ac64d6d2
Diffstat (limited to 'services/usage/java')
-rw-r--r-- | services/usage/java/com/android/server/usage/UsageStatsService.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java index b0a14c8..a433ec4 100644 --- a/services/usage/java/com/android/server/usage/UsageStatsService.java +++ b/services/usage/java/com/android/server/usage/UsageStatsService.java @@ -42,6 +42,7 @@ import android.content.pm.UserInfo; import android.content.res.Configuration; import android.database.ContentObserver; import android.hardware.display.DisplayManager; +import android.net.NetworkScoreManager; import android.os.BatteryManager; import android.os.BatteryStats; import android.os.Binder; @@ -812,6 +813,10 @@ public class UsageStatsService extends SystemService implements return false; } + if (isActiveNetworkScorer(packageName)) { + return false; + } + if (mAppWidgetManager != null && mAppWidgetManager.isBoundWidgetPackage(packageName, userId)) { return false; @@ -847,6 +852,12 @@ public class UsageStatsService extends SystemService implements == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS; } + private boolean isActiveNetworkScorer(String packageName) { + NetworkScoreManager nsm = (NetworkScoreManager) getContext().getSystemService( + Context.NETWORK_SCORE_SERVICE); + return packageName != null && packageName.equals(nsm.getActiveScorerPackage()); + } + void informListeners(String packageName, int userId, boolean isIdle) { for (AppIdleStateChangeListener listener : mPackageAccessListeners) { listener.onAppIdleStateChanged(packageName, userId, isIdle); |