Populate Enterprise Privacy Settings page - batch 1
This CL adds the first batch of items to the Privacy Settings page. These are all the items that fall into the "What types of information can your organization see?" category and do not require deeper Framework changes. Further batches are to come in separate CLs. Test: make RunSettingsRoboTests Bug: 32692748 Change-Id: I460093bc45ed0e5baab2a5cdf9833e654d436cc9
This commit is contained in:
@@ -25,5 +25,17 @@ public interface ApplicationFeatureProvider {
|
||||
* Returns a new {@link AppHeaderController} instance to customize app header.
|
||||
*/
|
||||
AppHeaderController newAppHeaderController(Fragment fragment, View appHeader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously calculates the total number of apps installed on the device, across all users
|
||||
* and managed profiles.
|
||||
*/
|
||||
void calculateNumberOfInstalledApps(NumberOfInstalledAppsCallback callback);
|
||||
|
||||
/**
|
||||
* Callback that receives the total number of packages installed on the device.
|
||||
*/
|
||||
public interface NumberOfInstalledAppsCallback {
|
||||
void onNumberOfInstalledAppsResult(int num);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,17 +18,50 @@ package com.android.settings.applications;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.os.UserManager;
|
||||
import android.view.View;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ApplicationFeatureProviderImpl implements ApplicationFeatureProvider {
|
||||
|
||||
private final Context mContext;
|
||||
private final PackageManagerWrapper mPm;
|
||||
private final UserManager mUm;
|
||||
|
||||
public ApplicationFeatureProviderImpl(Context context) {
|
||||
public ApplicationFeatureProviderImpl(Context context, PackageManagerWrapper pm) {
|
||||
mContext = context.getApplicationContext();
|
||||
mPm = pm;
|
||||
mUm = UserManager.get(mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppHeaderController newAppHeaderController(Fragment fragment, View appHeader) {
|
||||
return new AppHeaderController(mContext, fragment, appHeader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculateNumberOfInstalledApps(NumberOfInstalledAppsCallback callback) {
|
||||
new AllUserInstalledAppCounter(callback).execute();
|
||||
}
|
||||
|
||||
private class AllUserInstalledAppCounter extends InstalledAppCounter {
|
||||
private NumberOfInstalledAppsCallback mCallback;
|
||||
|
||||
AllUserInstalledAppCounter(NumberOfInstalledAppsCallback callback) {
|
||||
super(mContext, ApplicationFeatureProviderImpl.this.mPm);
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCountComplete(int num) {
|
||||
mCallback.onNumberOfInstalledAppsResult(num);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<UserInfo> getUsersToCount() {
|
||||
return mUm.getUsers(true /* excludeDying */);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,13 @@ public interface PackageManagerWrapper {
|
||||
*/
|
||||
List<ApplicationInfo> getInstalledApplicationsAsUser(int flags, int userId);
|
||||
|
||||
/**
|
||||
* Calls {@code PackageManager.hasSystemFeature()}.
|
||||
*
|
||||
* @see android.content.pm.PackageManager.PackageManager#hasSystemFeature
|
||||
*/
|
||||
boolean hasSystemFeature(String name);
|
||||
|
||||
/**
|
||||
* Calls {@code PackageManager.queryIntentActivitiesAsUser()}.
|
||||
*
|
||||
|
||||
@@ -35,6 +35,11 @@ public class PackageManagerWrapperImpl implements PackageManagerWrapper {
|
||||
return mPm.getInstalledApplicationsAsUser(flags, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSystemFeature(String name) {
|
||||
return mPm.hasSystemFeature(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, int flags, int userId) {
|
||||
return mPm.queryIntentActivitiesAsUser(intent, flags, userId);
|
||||
|
||||
Reference in New Issue
Block a user