Merge "Fix bucket change issues." into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5a2d6f7270
@@ -979,6 +979,7 @@ public class AppIdleHistory {
|
|||||||
dumpBucketExpiryTimes(idpw, appUsageHistory, totalElapsedTime);
|
dumpBucketExpiryTimes(idpw, appUsageHistory, totalElapsedTime);
|
||||||
idpw.print(" lastJob=");
|
idpw.print(" lastJob=");
|
||||||
TimeUtils.formatDuration(totalElapsedTime - appUsageHistory.lastJobRunTime, idpw);
|
TimeUtils.formatDuration(totalElapsedTime - appUsageHistory.lastJobRunTime, idpw);
|
||||||
|
idpw.print(" lastInformedBucket=" + appUsageHistory.lastInformedBucket);
|
||||||
if (appUsageHistory.lastRestrictAttemptElapsedTime > 0) {
|
if (appUsageHistory.lastRestrictAttemptElapsedTime > 0) {
|
||||||
idpw.print(" lastRestrictAttempt=");
|
idpw.print(" lastRestrictAttempt=");
|
||||||
TimeUtils.formatDuration(
|
TimeUtils.formatDuration(
|
||||||
|
|||||||
@@ -1155,6 +1155,12 @@ public class AppStandbyController
|
|||||||
|
|
||||||
final int appId = getAppId(packageName);
|
final int appId = getAppId(packageName);
|
||||||
if (appId < 0) return;
|
if (appId < 0) return;
|
||||||
|
final int minBucket = getAppMinBucket(packageName, appId, userId);
|
||||||
|
if (idle && minBucket < AppIdleHistory.IDLE_BUCKET_CUTOFF) {
|
||||||
|
Slog.e(TAG, "Tried to force an app to be idle when its min bucket is "
|
||||||
|
+ standbyBucketToString(minBucket));
|
||||||
|
return;
|
||||||
|
}
|
||||||
final long elapsedRealtime = mInjector.elapsedRealtime();
|
final long elapsedRealtime = mInjector.elapsedRealtime();
|
||||||
|
|
||||||
final boolean previouslyIdle = isAppIdleFiltered(packageName, appId,
|
final boolean previouslyIdle = isAppIdleFiltered(packageName, appId,
|
||||||
@@ -1166,12 +1172,10 @@ public class AppStandbyController
|
|||||||
final boolean stillIdle = isAppIdleFiltered(packageName, appId,
|
final boolean stillIdle = isAppIdleFiltered(packageName, appId,
|
||||||
userId, elapsedRealtime);
|
userId, elapsedRealtime);
|
||||||
// Inform listeners if necessary
|
// Inform listeners if necessary
|
||||||
|
maybeInformListeners(packageName, userId, elapsedRealtime, standbyBucket,
|
||||||
|
REASON_MAIN_FORCED_BY_USER, false);
|
||||||
if (previouslyIdle != stillIdle) {
|
if (previouslyIdle != stillIdle) {
|
||||||
maybeInformListeners(packageName, userId, elapsedRealtime, standbyBucket,
|
notifyBatteryStats(packageName, userId, stillIdle);
|
||||||
REASON_MAIN_FORCED_BY_USER, false);
|
|
||||||
if (!stillIdle) {
|
|
||||||
notifyBatteryStats(packageName, userId, idle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1934,6 +1938,8 @@ public class AppStandbyController
|
|||||||
}
|
}
|
||||||
mAppIdleHistory.setAppStandbyBucket(
|
mAppIdleHistory.setAppStandbyBucket(
|
||||||
packageName, userId, elapsedRealtime, newBucket, newReason);
|
packageName, userId, elapsedRealtime, newBucket, newReason);
|
||||||
|
maybeInformListeners(packageName, userId, elapsedRealtime, newBucket,
|
||||||
|
newReason, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2490,6 +2496,8 @@ public class AppStandbyController
|
|||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case MSG_INFORM_LISTENERS:
|
case MSG_INFORM_LISTENERS:
|
||||||
|
// TODO(230875908): Properly notify BatteryStats when apps change from active to
|
||||||
|
// idle, and vice versa
|
||||||
StandbyUpdateRecord r = (StandbyUpdateRecord) msg.obj;
|
StandbyUpdateRecord r = (StandbyUpdateRecord) msg.obj;
|
||||||
informListeners(r.packageName, r.userId, r.bucket, r.reason,
|
informListeners(r.packageName, r.userId, r.bucket, r.reason,
|
||||||
r.isUserInteraction);
|
r.isUserInteraction);
|
||||||
|
|||||||
Reference in New Issue
Block a user