diff options
author | Wenchao Tong <tongwenchao@google.com> | 2015-07-23 18:14:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-23 18:14:47 +0000 |
commit | bf3a24d5ec004a46cc75b947226fb7c23e4a0ed1 (patch) | |
tree | 19c09602712bb4f5921a7966160023f89da834be /services | |
parent | 2abf0f24af60b8644d5b61eed9666793083546ee (diff) | |
parent | 7cc902bea78dd16488d367e8ed0ccf25d4d825c2 (diff) | |
download | frameworks_base-bf3a24d5ec004a46cc75b947226fb7c23e4a0ed1.zip frameworks_base-bf3a24d5ec004a46cc75b947226fb7c23e4a0ed1.tar.gz frameworks_base-bf3a24d5ec004a46cc75b947226fb7c23e4a0ed1.tar.bz2 |
Merge "Ignore the active network scorer when checking for idleness" into mnc-dev
Diffstat (limited to 'services')
-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); |