Add a separate device_config key for slice-pinned events.

Bug: 206518483
Test: manual
Change-Id: I6f9929c09c156c5781039dfc177f1f9c5e181d0f
This commit is contained in:
Sudheer Shanka
2022-01-11 15:55:28 -08:00
parent e21748a999
commit b016336ebe

View File

@@ -300,6 +300,8 @@ public class AppStandbyController
long mStrongUsageTimeoutMillis = ConstantsObserver.DEFAULT_STRONG_USAGE_TIMEOUT;
/** Minimum time a notification seen event should keep the bucket elevated. */
long mNotificationSeenTimeoutMillis = ConstantsObserver.DEFAULT_NOTIFICATION_TIMEOUT;
/** Minimum time a slice pinned event should keep the bucket elevated. */
long mSlicePinnedTimeoutMillis = ConstantsObserver.DEFAULT_SLICE_PINNED_TIMEOUT;
/** The standby bucket that an app will be promoted on a notification-seen event */
int mNotificationSeenPromotedBucket =
ConstantsObserver.DEFAULT_NOTIFICATION_SEEN_PROMOTED_BUCKET;
@@ -997,9 +999,8 @@ public class AppStandbyController
// Mild usage elevates to WORKING_SET but doesn't change usage time.
mAppIdleHistory.reportUsage(appHistory, pkg, userId,
STANDBY_BUCKET_WORKING_SET, subReason,
0, elapsedRealtime + mNotificationSeenTimeoutMillis);
// TODO: Add a separate setting to control the timeout for SLICE_PINNED event.
nextCheckDelay = mNotificationSeenTimeoutMillis;
0, elapsedRealtime + mSlicePinnedTimeoutMillis);
nextCheckDelay = mSlicePinnedTimeoutMillis;
} else if (eventType == UsageEvents.Event.SYSTEM_INTERACTION) {
mAppIdleHistory.reportUsage(appHistory, pkg, userId,
STANDBY_BUCKET_ACTIVE, subReason,
@@ -1998,6 +1999,9 @@ public class AppStandbyController
pw.print(" mNotificationSeenPromotedBucket=");
pw.print(standbyBucketToString(mNotificationSeenPromotedBucket));
pw.println();
pw.print(" mSlicePinnedTimeoutMillis=");
TimeUtils.formatDuration(mSlicePinnedTimeoutMillis, pw);
pw.println();
pw.print(" mSyncAdapterTimeoutMillis=");
TimeUtils.formatDuration(mSyncAdapterTimeoutMillis, pw);
pw.println();
@@ -2422,6 +2426,8 @@ public class AppStandbyController
"notification_seen_duration";
private static final String KEY_NOTIFICATION_SEEN_PROMOTED_BUCKET =
"notification_seen_promoted_bucket";
private static final String KEY_SLICE_PINNED_HOLD_DURATION =
"slice_pinned_duration";
private static final String KEY_SYSTEM_UPDATE_HOLD_DURATION =
"system_update_usage_duration";
private static final String KEY_PREDICTION_TIMEOUT = "prediction_timeout";
@@ -2464,6 +2470,8 @@ public class AppStandbyController
COMPRESS_TIME ? ONE_MINUTE : 1 * ONE_HOUR;
public static final long DEFAULT_NOTIFICATION_TIMEOUT =
COMPRESS_TIME ? 12 * ONE_MINUTE : 12 * ONE_HOUR;
public static final long DEFAULT_SLICE_PINNED_TIMEOUT =
COMPRESS_TIME ? 12 * ONE_MINUTE : 12 * ONE_HOUR;
public static final int DEFAULT_NOTIFICATION_SEEN_PROMOTED_BUCKET =
STANDBY_BUCKET_WORKING_SET;
public static final long DEFAULT_SYSTEM_UPDATE_TIMEOUT =
@@ -2556,6 +2564,11 @@ public class AppStandbyController
KEY_NOTIFICATION_SEEN_PROMOTED_BUCKET,
DEFAULT_NOTIFICATION_SEEN_PROMOTED_BUCKET);
break;
case KEY_SLICE_PINNED_HOLD_DURATION:
mSlicePinnedTimeoutMillis = properties.getLong(
KEY_SLICE_PINNED_HOLD_DURATION,
DEFAULT_SLICE_PINNED_TIMEOUT);
break;
case KEY_STRONG_USAGE_HOLD_DURATION:
mStrongUsageTimeoutMillis = properties.getLong(
KEY_STRONG_USAGE_HOLD_DURATION, DEFAULT_STRONG_USAGE_TIMEOUT);