Fix foreground importance bug in LocationManagerService.

Bug: 37121975
Test: tested locally
Change-Id: I2563408d10edfac74d04d68116cbf2a2ac66e9a3
This commit is contained in:
Soonil Nagarkar
2017-04-10 14:55:37 -07:00
parent 7b4ed6466d
commit ebda0286d4

View File

@@ -146,6 +146,9 @@ public class LocationManagerService extends ILocationManager.Stub {
// The maximum interval a location request can have and still be considered "high power".
private static final long HIGH_POWER_INTERVAL_MS = 5 * 60 * 1000;
private static final int FOREGROUND_IMPORTANCE_CUTOFF
= ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND_SERVICE;
// default background throttling interval if not overriden in settings
private static final long DEFAULT_BACKGROUND_THROTTLE_INTERVAL_MS = 30 * 60 * 1000;
@@ -376,7 +379,7 @@ public class LocationManagerService extends ILocationManager.Stub {
}
};
mActivityManager.addOnUidImportanceListener(uidImportanceListener,
ActivityManager.RunningAppProcessInfo.IMPORTANCE_PERCEPTIBLE);
FOREGROUND_IMPORTANCE_CUTOFF);
mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
updateUserProfiles(mCurrentUserId);
@@ -453,7 +456,7 @@ public class LocationManagerService extends ILocationManager.Stub {
}
private static boolean isImportanceForeground(int importance) {
return importance <= ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND_SERVICE;
return importance <= FOREGROUND_IMPORTANCE_CUTOFF;
}
/**