Update the setOverrideDeadline in the legacy AnomalyDetectionJobService

Update the setOverrideDeadline based on the suggestion in the b/319721625, and remove the legacy anomaly detection mechanism from the main entry BroadcastReceiver

Fix: 319721625
Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.fuelgauge.batterytip"
Change-Id: I1276bfc95d9cf36a60e28612ebb8a295fd58083b
This commit is contained in:
ykhung
2024-01-15 17:10:58 +08:00
committed by YK Hung
parent 4130a95c5d
commit 22273161fd
3 changed files with 4 additions and 10 deletions

View File

@@ -4697,14 +4697,6 @@
<receiver android:name=".fuelgauge.batterytip.AnomalyDetectionReceiver"
android:exported="false" />
<receiver android:name=".fuelgauge.batterytip.AnomalyConfigReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.app.action.STATSD_STARTED"/>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<service android:name=".fuelgauge.batterytip.AnomalyCleanupJobService"
android:permission="android.permission.BIND_JOB_SERVICE" />

View File

@@ -49,6 +49,7 @@ import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.fuelgauge.PowerAllowlistBackend;
import com.android.settingslib.utils.ThreadUtils;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -59,7 +60,7 @@ public class AnomalyDetectionJobService extends JobService {
private static final int ON = 1;
@VisibleForTesting static final int UID_NULL = -1;
@VisibleForTesting static final int STATSD_UID_FILED = 1;
@VisibleForTesting static final long MAX_DELAY_MS = TimeUnit.MINUTES.toMillis(30);
@VisibleForTesting static final long MAX_DELAY_MS = Duration.ofDays(1).toMillis();
private final Object mLock = new Object();

View File

@@ -71,6 +71,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.android.controller.ServiceController;
import org.robolectric.annotation.Config;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -133,7 +134,7 @@ public class AnomalyDetectionJobServiceTest {
JobInfo pendingJob = pendingJobs.get(0);
assertThat(pendingJob.getId()).isEqualTo(R.integer.job_anomaly_detection);
assertThat(pendingJob.getMaxExecutionDelayMillis())
.isEqualTo(TimeUnit.MINUTES.toMillis(30));
.isEqualTo(Duration.ofDays(1).toMillis());
}
@Test