diff --git a/src/com/android/settings/fuelgauge/batterytip/AnomalyDetectionJobService.java b/src/com/android/settings/fuelgauge/batterytip/AnomalyDetectionJobService.java
index 83a79bc..5d0e71d 100644
--- a/src/com/android/settings/fuelgauge/batterytip/AnomalyDetectionJobService.java
+++ b/src/com/android/settings/fuelgauge/batterytip/AnomalyDetectionJobService.java
@@ -31,8 +31,9 @@
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
+import android.os.Process;
 import android.os.StatsDimensionsValue;
-import android.os.SystemPropertiesProto;
+import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
 import android.support.annotation.VisibleForTesting;
@@ -122,7 +123,8 @@
             final boolean smartBatteryOn = Settings.Global.getInt(contentResolver,
                     Settings.Global.APP_STANDBY_ENABLED, ON) == ON;
             final String packageName = batteryUtils.getPackageName(uid);
-            if (!powerWhitelistBackend.isSysWhitelisted(packageName)) {
+            if (!powerWhitelistBackend.isSysWhitelistedExceptIdle(packageName)
+                    && !isSystemUid(uid)) {
                 if (anomalyType == StatsManagerConfig.AnomalyType.EXCESSIVE_BG) {
                     // TODO(b/72385333): check battery percentage draining in batterystats
                     if (batteryUtils.isLegacyApp(packageName) && batteryUtils.isAppHeavilyUsed(
@@ -156,7 +158,7 @@
      * 3. Bluetooth anomaly:    3:{1:{1:{1:10140|}|}|}
      */
     @VisibleForTesting
-    final int extractUidFromStatsDimensionsValue(StatsDimensionsValue statsDimensionsValue) {
+    int extractUidFromStatsDimensionsValue(StatsDimensionsValue statsDimensionsValue) {
         //TODO(b/73172999): Add robo test for this method
         if (statsDimensionsValue == null) {
             return UID_NULL;
@@ -178,4 +180,9 @@
 
         return UID_NULL;
     }
+
+    private boolean isSystemUid(int uid) {
+        final int appUid = UserHandle.getAppId(uid);
+        return appUid >= Process.ROOT_UID && appUid < Process.FIRST_APPLICATION_UID;
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/AnomalyDetectionJobServiceTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/AnomalyDetectionJobServiceTest.java
index aa3d5a8..499ab9d 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/AnomalyDetectionJobServiceTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/AnomalyDetectionJobServiceTest.java
@@ -18,11 +18,13 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyInt;
 import static org.mockito.Matchers.anyLong;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.robolectric.RuntimeEnvironment.application;
 
@@ -32,6 +34,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
+import android.os.Process;
 import android.os.StatsDimensionsValue;
 import android.os.UserManager;
 
@@ -84,7 +87,7 @@
         mBundle = new Bundle();
         mBundle.putParcelable(StatsManager.EXTRA_STATS_DIMENSIONS_VALUE, mStatsDimensionsValue);
 
-        mAnomalyDetectionJobService = new AnomalyDetectionJobService();
+        mAnomalyDetectionJobService = spy(new AnomalyDetectionJobService());
     }
 
     @Test
@@ -92,13 +95,14 @@
         AnomalyDetectionJobService.scheduleAnomalyDetection(application, new Intent());
 
         ShadowJobScheduler shadowJobScheduler =
-            Shadows.shadowOf(application.getSystemService(JobScheduler.class));
+                Shadows.shadowOf(application.getSystemService(JobScheduler.class));
         List<JobInfo> pendingJobs = shadowJobScheduler.getAllPendingJobs();
         assertThat(pendingJobs).hasSize(1);
+
         JobInfo pendingJob = pendingJobs.get(0);
         assertThat(pendingJob.getId()).isEqualTo(R.id.job_anomaly_detection);
         assertThat(pendingJob.getMaxExecutionDelayMillis())
-            .isEqualTo(TimeUnit.MINUTES.toMillis(30));
+                .isEqualTo(TimeUnit.MINUTES.toMillis(30));
     }
 
     @Test
@@ -115,9 +119,24 @@
     }
 
     @Test
+    public void testSaveAnomalyToDatabase_systemUid_doNotSave() {
+        doReturn(Process.SYSTEM_UID).when(
+                mAnomalyDetectionJobService).extractUidFromStatsDimensionsValue(any());
+
+        mAnomalyDetectionJobService.saveAnomalyToDatabase(mBatteryStatsHelper, mUserManager,
+                mBatteryDatabaseManager, mBatteryUtils, mPolicy, mPowerWhitelistBackend,
+                mContext.getContentResolver(), mBundle);
+
+        verify(mBatteryDatabaseManager, never()).insertAnomaly(anyInt(), anyString(), anyInt(),
+                anyInt(), anyLong());
+    }
+
+    @Test
     public void testSaveAnomalyToDatabase_normalApp_save() {
         doReturn(SYSTEM_PACKAGE).when(mBatteryUtils).getPackageName(anyInt());
         doReturn(false).when(mPowerWhitelistBackend).isSysWhitelisted(SYSTEM_PACKAGE);
+        doReturn(Process.FIRST_APPLICATION_UID).when(
+                mAnomalyDetectionJobService).extractUidFromStatsDimensionsValue(any());
 
         mAnomalyDetectionJobService.saveAnomalyToDatabase(mBatteryStatsHelper, mUserManager,
                 mBatteryDatabaseManager, mBatteryUtils, mPolicy, mPowerWhitelistBackend,
