Loading core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java +7 −4 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ import android.net.Uri; import android.os.UserHandle; import android.provider.DeviceConfig; import android.service.chooser.ChooserTarget; import android.util.Log; import android.view.View; import androidx.annotation.CallSuper; Loading Loading @@ -187,7 +188,7 @@ public class ChooserActivityTest { * TODO: remove when we no longer want to test the system's on-the-fly evaluation. */ protected boolean shouldTestTogglingAppPredictionServiceAvailabilityAtRuntime() { return true; return false; } /* -------- Loading Loading @@ -762,6 +763,7 @@ public class ChooserActivityTest { @Test @Ignore public void testNearbyShareLogging() throws Exception { Intent sendIntent = createSendTextIntent(); List<ResolvedComponentInfo> resolvedComponentInfos = createResolvedComponentsForTest(2); Loading Loading @@ -1327,16 +1329,17 @@ public class ChooserActivityTest { final ChooserActivity activity = mActivityRule.launchActivity(Intent.createChooser(sendIntent, null)); waitForIdle(); if (activity.getPackageManager().getAppPredictionServicePackageName() == null) { assertThat(activity.isAppPredictionServiceAvailable(), is(false)); } else { assertThat(activity.isAppPredictionServiceAvailable(), is(true)); if (!shouldTestTogglingAppPredictionServiceAvailabilityAtRuntime()) { return; } // This isn't a toggle per-se, but isAppPredictionServiceAvailable only works in // system (see comment in the method). assertThat(activity.isAppPredictionServiceAvailable(), is(true)); ChooserActivityOverrideData.getInstance().resources = Mockito.spy(activity.getResources()); when( Loading core/tests/coretests/src/com/android/internal/app/ChooserWrapperActivity.java +7 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,13 @@ public class ChooserWrapperActivity extends ChooserActivity implements IChooserW static final ChooserActivityOverrideData sOverrides = ChooserActivityOverrideData.getInstance(); private UsageStatsManager mUsm; // ResolverActivity (the base class of ChooserActivity) inspects the launched-from UID at // onCreate and needs to see some non-negative value in the test. @Override public int getLaunchedFromUid() { return 1234; } @Override protected AbstractMultiProfilePagerAdapter createMultiProfilePagerAdapter( Intent[] initialIntents, List<ResolveInfo> rList, boolean filterLastUsed) { Loading Loading
core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java +7 −4 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ import android.net.Uri; import android.os.UserHandle; import android.provider.DeviceConfig; import android.service.chooser.ChooserTarget; import android.util.Log; import android.view.View; import androidx.annotation.CallSuper; Loading Loading @@ -187,7 +188,7 @@ public class ChooserActivityTest { * TODO: remove when we no longer want to test the system's on-the-fly evaluation. */ protected boolean shouldTestTogglingAppPredictionServiceAvailabilityAtRuntime() { return true; return false; } /* -------- Loading Loading @@ -762,6 +763,7 @@ public class ChooserActivityTest { @Test @Ignore public void testNearbyShareLogging() throws Exception { Intent sendIntent = createSendTextIntent(); List<ResolvedComponentInfo> resolvedComponentInfos = createResolvedComponentsForTest(2); Loading Loading @@ -1327,16 +1329,17 @@ public class ChooserActivityTest { final ChooserActivity activity = mActivityRule.launchActivity(Intent.createChooser(sendIntent, null)); waitForIdle(); if (activity.getPackageManager().getAppPredictionServicePackageName() == null) { assertThat(activity.isAppPredictionServiceAvailable(), is(false)); } else { assertThat(activity.isAppPredictionServiceAvailable(), is(true)); if (!shouldTestTogglingAppPredictionServiceAvailabilityAtRuntime()) { return; } // This isn't a toggle per-se, but isAppPredictionServiceAvailable only works in // system (see comment in the method). assertThat(activity.isAppPredictionServiceAvailable(), is(true)); ChooserActivityOverrideData.getInstance().resources = Mockito.spy(activity.getResources()); when( Loading
core/tests/coretests/src/com/android/internal/app/ChooserWrapperActivity.java +7 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,13 @@ public class ChooserWrapperActivity extends ChooserActivity implements IChooserW static final ChooserActivityOverrideData sOverrides = ChooserActivityOverrideData.getInstance(); private UsageStatsManager mUsm; // ResolverActivity (the base class of ChooserActivity) inspects the launched-from UID at // onCreate and needs to see some non-negative value in the test. @Override public int getLaunchedFromUid() { return 1234; } @Override protected AbstractMultiProfilePagerAdapter createMultiProfilePagerAdapter( Intent[] initialIntents, List<ResolveInfo> rList, boolean filterLastUsed) { Loading