Dont throw exception if admin is null
For policy_suspend_packages(or for other policies which are not user restriction) admin component comes to be null always when fetched from DPMS and the code changed as part of this change used to throw exception. So handling this case to show generic learn more link in policy transparency dialog which opens settings showing list of all admins, if admin details are not found. Bug: 203564700 Test: com.android.cts.devicepolicy.MixedProfileOwnerTest#testSuspendPackage Change-Id: Ib3b4490eaa11ceab53f0004f4b7d089f3c0ba4fb
This commit is contained in:
@@ -52,7 +52,6 @@ public abstract class ActionDisabledLearnMoreButtonLauncher {
|
||||
public final void setupLearnMoreButtonToShowAdminPolicies(Context context,
|
||||
int enforcementAdminUserId, EnforcedAdmin enforcedAdmin) {
|
||||
requireNonNull(context, "context cannot be null");
|
||||
requireNonNull(enforcedAdmin, "enforcedAdmin cannot be null");
|
||||
|
||||
// The "Learn more" button appears only if the restriction is enforced by an admin in the
|
||||
// same profile group or by the device owner. Otherwise the admin package and its policies
|
||||
@@ -132,7 +131,7 @@ public abstract class ActionDisabledLearnMoreButtonLauncher {
|
||||
}
|
||||
|
||||
private void showAdminPolicies(Context context, EnforcedAdmin enforcedAdmin) {
|
||||
if (enforcedAdmin.component != null) {
|
||||
if (enforcedAdmin != null && enforcedAdmin.component != null) {
|
||||
launchShowAdminPolicies(context, enforcedAdmin.user, enforcedAdmin.component);
|
||||
} else {
|
||||
launchShowAdminSettings(context);
|
||||
|
||||
Reference in New Issue
Block a user