Only show app action button if it is not instant app.
- for instant app, we are showing another set of buttons, and hence the regular app action buttons should be not be available. Change-Id: I53f2a10921451c281166e123671c088ab87b2b0d Fixes: 71919219 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -93,7 +93,8 @@ public class AppActionButtonPreferenceController extends BasePreferenceControlle
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE;
|
||||
return AppUtils.isInstant(mParent.getPackageInfo().applicationInfo)
|
||||
? DISABLED_FOR_USER : AVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -79,6 +79,8 @@ public class AppActionButtonPreferenceControllerTest {
|
||||
private DevicePolicyManagerWrapper mDevicePolicyManager;
|
||||
@Mock
|
||||
private AppInfoDashboardFragment mFragment;
|
||||
@Mock
|
||||
private ApplicationInfo mAppInfo;
|
||||
|
||||
private Context mContext;
|
||||
private AppActionButtonPreferenceController mController;
|
||||
@@ -96,6 +98,25 @@ public class AppActionButtonPreferenceControllerTest {
|
||||
ReflectionHelpers.setField(mController, "mApplicationFeatureProvider",
|
||||
mFeatureFactory.applicationFeatureProvider);
|
||||
when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
|
||||
final PackageInfo packageInfo = mock(PackageInfo.class);
|
||||
packageInfo.applicationInfo = mAppInfo;
|
||||
when(mFragment.getPackageInfo()).thenReturn(packageInfo);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_notInstantApp_shouldReturnAvailable() {
|
||||
ReflectionHelpers.setStaticField(AppUtils.class, "sInstantAppDataProvider",
|
||||
(InstantAppDataProvider) (i -> false));
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(mController.AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_isInstantApp_shouldReturnDisabled() {
|
||||
ReflectionHelpers.setStaticField(AppUtils.class, "sInstantAppDataProvider",
|
||||
(InstantAppDataProvider) (i -> true));
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(mController.DISABLED_FOR_USER);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user