Fixes broken Settings test.

In ag/22187500, we added the requirement for a wallpaper picker app to be installed in order to treat the lock screen shortcuts feature as enabled (in addition to the feature flag). That broke this test.

To fix, we're adding a mocked result to the PackageManager to pretend like the wallpaper picker application is installed.

Change-Id: I8654375e3fa33df0984c48fcf91dd8f6c18e984f
Fix: 280017187
Test: the test is back to passing.
diff --git a/tests/robotests/src/com/android/settings/display/ControlsTrivialPrivacyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/ControlsTrivialPrivacyPreferenceControllerTest.java
index 8bb3ff6..a82e1f1 100644
--- a/tests/robotests/src/com/android/settings/display/ControlsTrivialPrivacyPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/ControlsTrivialPrivacyPreferenceControllerTest.java
@@ -18,6 +18,7 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.atLeastOnce;
@@ -27,6 +28,10 @@
 
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
 import android.database.Cursor;
 import android.database.MatrixCursor;
 import android.provider.Settings;
@@ -64,12 +69,16 @@
     @Mock
     private PreferenceScreen mPreferenceScreen;
 
+    @Mock
+    private PackageManager mPackageManager;
+
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = spy(ApplicationProvider.getApplicationContext());
         mContentResolver = spy(mContext.getContentResolver());
         when(mContext.getContentResolver()).thenReturn(mContentResolver);
+        when(mContext.getPackageManager()).thenReturn(mPackageManager);
 
         setCustomizableLockScreenQuickAffordancesEnabled(false);
 
@@ -199,5 +208,19 @@
                             });
                     return cursor;
                 });
+
+        if (isEnabled) {
+            final ApplicationInfo applicationInfo = new ApplicationInfo();
+            applicationInfo.packageName = "package";
+
+            final ActivityInfo activityInfo = new ActivityInfo();
+            activityInfo.applicationInfo = applicationInfo;
+            activityInfo.name = "activity";
+
+            final ResolveInfo resolveInfo = new ResolveInfo();
+            resolveInfo.activityInfo = activityInfo;
+
+            when(mPackageManager.resolveActivity(any(), any())).thenReturn(resolveInfo);
+        }
     }
 }