Add number of enterprise-installed apps to Privacy Settings page

This CL adds information about the number of apps that were installed
by the admin to the Enterprise Privacy Settings page.

Test: make RunSettingsRoboTests
Bug: 32692748

Change-Id: Ib710a1249db6d285da962122fd3dfb35a43752a1
This commit is contained in:
Bartosz Fabianowski
2017-01-13 17:41:38 +01:00
parent 0d22680807
commit 13f569ebd6
16 changed files with 314 additions and 40 deletions

View File

@@ -25,12 +25,24 @@ import java.util.List;
public abstract class InstalledAppCounter extends AppCounter {
public InstalledAppCounter(Context context, PackageManagerWrapper packageManager) {
private final int mInstallReason;
private final PackageManagerWrapper mPackageManager;
public InstalledAppCounter(Context context, int installReason,
PackageManagerWrapper packageManager) {
super(context, packageManager);
mInstallReason = installReason;
mPackageManager = packageManager;
}
@Override
protected boolean includeInCount(ApplicationInfo info) {
final int userId = UserHandle.getUserId(info.uid);
if (mInstallReason != ApplicationFeatureProvider.IGNORE_INSTALL_REASON
&& mPackageManager.getInstallReason(info.packageName,
new UserHandle(userId)) != mInstallReason) {
return false;
}
if ((info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
return true;
}
@@ -40,7 +52,6 @@ public abstract class InstalledAppCounter extends AppCounter {
Intent launchIntent = new Intent(Intent.ACTION_MAIN, null)
.addCategory(Intent.CATEGORY_LAUNCHER)
.setPackage(info.packageName);
int userId = UserHandle.getUserId(info.uid);
List<ResolveInfo> intents = mPm.queryIntentActivitiesAsUser(
launchIntent,
PackageManager.GET_DISABLED_COMPONENTS