Merge "Handle listing of PS apps in Apps > Special App Access > Device Admin Apps" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
12ff61b3c7
@@ -32,6 +32,7 @@ import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.UserProperties;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
@@ -156,12 +157,23 @@ public class DeviceAdminListPreferenceController extends BasePreferenceControlle
|
||||
mAdmins.clear();
|
||||
final List<UserHandle> profiles = mUm.getUserProfiles();
|
||||
for (UserHandle profile : profiles) {
|
||||
if (shouldSkipProfile(profile)) {
|
||||
continue;
|
||||
}
|
||||
final int profileId = profile.getIdentifier();
|
||||
updateAvailableAdminsForProfile(profileId);
|
||||
}
|
||||
Collections.sort(mAdmins);
|
||||
}
|
||||
|
||||
private boolean shouldSkipProfile(UserHandle profile) {
|
||||
return android.os.Flags.allowPrivateProfile()
|
||||
&& android.multiuser.Flags.handleInterleavedSettingsForPrivateSpace()
|
||||
&& mUm.isQuietModeEnabled(profile)
|
||||
&& mUm.getUserProperties(profile).getShowInQuietMode()
|
||||
== UserProperties.SHOW_IN_QUIET_MODE_HIDDEN;
|
||||
}
|
||||
|
||||
private void refreshUI() {
|
||||
if (mPreferenceGroup == null) {
|
||||
return;
|
||||
|
@@ -26,6 +26,7 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.content.pm.UserProperties;
|
||||
import android.content.res.Resources;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.VpnManager;
|
||||
@@ -220,6 +221,9 @@ public class EnterprisePrivacyFeatureProviderImpl implements EnterprisePrivacyFe
|
||||
public int getNumberOfActiveDeviceAdminsForCurrentUserAndManagedProfile() {
|
||||
int activeAdmins = 0;
|
||||
for (final UserInfo userInfo : mUm.getProfiles(MY_USER_ID)) {
|
||||
if (shouldSkipProfile(userInfo)) {
|
||||
continue;
|
||||
}
|
||||
final List<ComponentName> activeAdminsForUser
|
||||
= mDpm.getActiveAdminsAsUser(userInfo.id);
|
||||
if (activeAdminsForUser != null) {
|
||||
@@ -250,6 +254,14 @@ public class EnterprisePrivacyFeatureProviderImpl implements EnterprisePrivacyFe
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean shouldSkipProfile(UserInfo userInfo) {
|
||||
return android.os.Flags.allowPrivateProfile()
|
||||
&& android.multiuser.Flags.handleInterleavedSettingsForPrivateSpace()
|
||||
&& userInfo.isQuietModeEnabled()
|
||||
&& mUm.getUserProperties(userInfo.getUserHandle()).getShowInQuietMode()
|
||||
== UserProperties.SHOW_IN_QUIET_MODE_HIDDEN;
|
||||
}
|
||||
|
||||
private Intent getParentalControlsIntent() {
|
||||
final ComponentName componentName =
|
||||
mDpm.getProfileOwnerOrDeviceOwnerSupervisionComponent(new UserHandle(MY_USER_ID));
|
||||
|
Reference in New Issue
Block a user