Fix recent apps in appops.
Prior to this fix all apps would disappear from settings->location 15 minutes after the request was first made (even if request was ongoing). Tested this out - apps requesting location longer than the threshold stay in the list, and apps stay in the list exactly the threshold time after the location request ENDS. Change-Id: I7d4db25c615df2ec41e93b1b3191ba606d26719d
This commit is contained in:
@@ -194,9 +194,10 @@ public class RecentLocationApps {
|
|||||||
List<AppOpsManager.OpEntry> entries = ops.getOps();
|
List<AppOpsManager.OpEntry> entries = ops.getOps();
|
||||||
boolean highBattery = false;
|
boolean highBattery = false;
|
||||||
boolean normalBattery = false;
|
boolean normalBattery = false;
|
||||||
|
// Earliest time for a location request to end and still be shown in list.
|
||||||
|
long recentLocationCutoffTime = now - RECENT_TIME_INTERVAL_MILLIS;
|
||||||
for (AppOpsManager.OpEntry entry : entries) {
|
for (AppOpsManager.OpEntry entry : entries) {
|
||||||
// If previous location activity is older than designated interval, ignore this app.
|
if (entry.isRunning() || entry.getTime() >= recentLocationCutoffTime) {
|
||||||
if (now - entry.getTime() <= RECENT_TIME_INTERVAL_MILLIS) {
|
|
||||||
switch (entry.getOp()) {
|
switch (entry.getOp()) {
|
||||||
case AppOpsManager.OP_MONITOR_LOCATION:
|
case AppOpsManager.OP_MONITOR_LOCATION:
|
||||||
normalBattery = true;
|
normalBattery = true;
|
||||||
|
Reference in New Issue
Block a user