Hide the app details preference for mainline module apps
For mainline module apps, user can not install them from the play store. We should not provide the play store link for them in app info page. Therefore, we decide to hide their app details preference which is to provide the play store link from the app info page. Bug: 152718521 Test: visual and robotests Change-Id: I46b64be0d725740c2b80a5251a42e9fc834e4596
This commit is contained in:
@@ -42,6 +42,11 @@ public class AppInstallerInfoPreferenceController extends AppInfoPreferenceContr
|
|||||||
if (UserManager.get(mContext).isManagedProfile()) {
|
if (UserManager.get(mContext).isManagedProfile()) {
|
||||||
return DISABLED_FOR_USER;
|
return DISABLED_FOR_USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AppUtils.isMainlineModule(mContext, mPackageName)) {
|
||||||
|
return DISABLED_FOR_USER;
|
||||||
|
}
|
||||||
|
|
||||||
return mInstallerLabel != null ? AVAILABLE : DISABLED_FOR_USER;
|
return mInstallerLabel != null ? AVAILABLE : DISABLED_FOR_USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,6 +32,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
|
import android.content.pm.ModuleInfo;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
@@ -148,4 +149,16 @@ public class AppInstallerInfoPreferenceControllerTest {
|
|||||||
verify(mPreference, never()).setEnabled(false);
|
verify(mPreference, never()).setEnabled(false);
|
||||||
verify(mPreference).setIntent(any(Intent.class));
|
verify(mPreference).setIntent(any(Intent.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAvailabilityStatus_isMainlineModule_shouldReturnDisabled()
|
||||||
|
throws PackageManager.NameNotFoundException {
|
||||||
|
when(mUserManager.isManagedProfile()).thenReturn(false);
|
||||||
|
when(mAppInfo.loadLabel(mPackageManager)).thenReturn("Label");
|
||||||
|
mController.setPackageName("Package");
|
||||||
|
when(mPackageManager.getModuleInfo("Package", 0 /* flags */)).thenReturn(new ModuleInfo());
|
||||||
|
|
||||||
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||||
|
BasePreferenceController.DISABLED_FOR_USER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user