diff --git a/tests/unit/src/com/android/settings/applications/HibernatedAppsPreferenceControllerTest.java b/tests/unit/src/com/android/settings/applications/HibernatedAppsPreferenceControllerTest.java
index a34e634..39c966d 100644
--- a/tests/unit/src/com/android/settings/applications/HibernatedAppsPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/applications/HibernatedAppsPreferenceControllerTest.java
@@ -24,17 +24,24 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import android.app.usage.IUsageStatsManager;
+import android.app.usage.UsageStats;
+import android.app.usage.UsageStatsManager;
 import android.apphibernation.AppHibernationManager;
 import android.content.Context;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
+import android.content.pm.ParceledListSlice;
 import android.content.res.Resources;
+import android.os.RemoteException;
 import android.provider.DeviceConfig;
 
 import androidx.test.core.app.ApplicationProvider;
@@ -58,11 +65,11 @@
     PackageManager mPackageManager;
     @Mock
     AppHibernationManager mAppHibernationManager;
+    @Mock
+    IUsageStatsManager mIUsageStatsManager;
     private static final String KEY = "key";
     private Context mContext;
     private HibernatedAppsPreferenceController mController;
-    private PackageInfo mHibernatedPackage;
-    private PackageInfo mAutoRevokedPackage;
 
     @Before
     public void setUp() {
@@ -73,10 +80,9 @@
         when(mContext.getPackageManager()).thenReturn(mPackageManager);
         when(mContext.getSystemService(AppHibernationManager.class))
                 .thenReturn(mAppHibernationManager);
+        when(mContext.getSystemService(UsageStatsManager.class)).thenReturn(
+                new UsageStatsManager(mContext, mIUsageStatsManager));
         mController = new HibernatedAppsPreferenceController(mContext, KEY);
-        mHibernatedPackage =
-                getHibernatedPackage(mAppHibernationManager, mPackageManager, mContext);
-        mAutoRevokedPackage = getAutoRevokedPackage(mPackageManager, mContext);
     }
 
     @Test
@@ -88,36 +94,71 @@
     }
 
     @Test
-    public void getSummary_shouldReturnCorrectly() {
+    public void getSummary_getsRightCountForHibernatedPackage() {
+        final PackageInfo hibernatedPkg = getHibernatedPackage();
         when(mPackageManager.getInstalledPackages(anyInt())).thenReturn(
-                Arrays.asList(mHibernatedPackage, mAutoRevokedPackage, new PackageInfo()));
+                Arrays.asList(hibernatedPkg, new PackageInfo()));
         when(mContext.getResources()).thenReturn(mock(Resources.class));
-        final int totalHibernated = 2;
 
         mController.getSummary();
-        verify(mContext.getResources()).getQuantityString(
-                anyInt(), eq(totalHibernated), eq(totalHibernated));
+        verify(mContext.getResources()).getQuantityString(anyInt(), eq(1), eq(1));
     }
 
-    private static PackageInfo getHibernatedPackage(
-            AppHibernationManager apm, PackageManager pm, Context context) {
+    @Test
+    public void getSummary_getsRightCountForUnusedAutoRevokedPackage() {
+        final PackageInfo autoRevokedPkg = getAutoRevokedPackage();
+        when(mPackageManager.getInstalledPackages(anyInt())).thenReturn(
+                Arrays.asList(autoRevokedPkg, new PackageInfo()));
+        when(mContext.getResources()).thenReturn(mock(Resources.class));
+
+        mController.getSummary();
+        verify(mContext.getResources()).getQuantityString(anyInt(), eq(1), eq(1));
+    }
+
+    @Test
+    public void getSummary_getsRightCountForUsedAutoRevokedPackage() {
+        final PackageInfo usedAutoRevokedPkg = getAutoRevokedPackage();
+        setAutoRevokedPackageUsageStats();
+        when(mPackageManager.getInstalledPackages(anyInt())).thenReturn(
+                Arrays.asList(usedAutoRevokedPkg, new PackageInfo()));
+        when(mContext.getResources()).thenReturn(mock(Resources.class));
+
+        mController.getSummary();
+        verify(mContext.getResources()).getQuantityString(anyInt(), eq(0), eq(0));
+    }
+
+    private PackageInfo getHibernatedPackage() {
         final PackageInfo pi = new PackageInfo();
         pi.packageName = HIBERNATED_PACKAGE_NAME;
         pi.requestedPermissions = new String[] {PERMISSION};
-        when(apm.getHibernatingPackagesForUser()).thenReturn(Arrays.asList(pi.packageName));
-        when(pm.getPermissionFlags(
-                pi.requestedPermissions[0], pi.packageName, context.getUser()))
+        when(mAppHibernationManager.getHibernatingPackagesForUser())
+                .thenReturn(Arrays.asList(pi.packageName));
+        when(mPackageManager.getPermissionFlags(
+                pi.requestedPermissions[0], pi.packageName, mContext.getUser()))
                 .thenReturn(PackageManager.FLAG_PERMISSION_AUTO_REVOKED);
         return pi;
     }
 
-    private static PackageInfo getAutoRevokedPackage(PackageManager pm, Context context) {
+    private PackageInfo getAutoRevokedPackage() {
         final PackageInfo pi = new PackageInfo();
         pi.packageName = AUTO_REVOKED_PACKAGE_NAME;
         pi.requestedPermissions = new String[] {PERMISSION};
-        when(pm.getPermissionFlags(
-                pi.requestedPermissions[0], pi.packageName, context.getUser()))
+        when(mPackageManager.getPermissionFlags(
+                pi.requestedPermissions[0], pi.packageName, mContext.getUser()))
                 .thenReturn(PackageManager.FLAG_PERMISSION_AUTO_REVOKED);
         return pi;
     }
+
+    private void setAutoRevokedPackageUsageStats() {
+        final UsageStats us = new UsageStats();
+        us.mPackageName = AUTO_REVOKED_PACKAGE_NAME;
+        us.mLastTimeVisible = System.currentTimeMillis();
+        try {
+            when(mIUsageStatsManager.queryUsageStats(
+                    anyInt(), anyLong(), anyLong(), anyString(), anyInt()))
+                    .thenReturn(new ParceledListSlice(Arrays.asList(us)));
+        } catch (RemoteException e) {
+            // no-op
+        }
+    }
 }
