When Remove Account is disallowed, show dialog
When DISALLOW_MODIFY_ACCOUNT is set by a device admin, and the user wants to remove an account, show the support dialog instead of showing the confirm dialog. To use the O-API DPM.createAdminSupportIntent(), a wrapper needs to be used, because existing Robolectric tests otherwise don't compile. Bug: 37413849 Test: make RunSettingsRoboTests -j40 ROBOTEST_FILTER=*RemoveAccountPreferenceControllerTest Change-Id: If23ea304ab8b9df1748e6acf3032310843b04780
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.settings.enterprise;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.os.UserHandle;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
@@ -143,4 +144,11 @@ public interface DevicePolicyManagerWrapper {
|
||||
* @see android.app.admin.DevicePolicyManager#isUninstallInQueue
|
||||
*/
|
||||
boolean isUninstallInQueue(String packageName);
|
||||
|
||||
/**
|
||||
* Calls {@code DevicePolicyManager.createAdminSupportIntent()}.
|
||||
*
|
||||
* @see android.app.admin.DevicePolicyManager#createAdminSupportIntent
|
||||
*/
|
||||
Intent createAdminSupportIntent(String restriction);
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ package com.android.settings.enterprise;
|
||||
import android.annotation.NonNull;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.os.UserHandle;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
@@ -111,4 +112,9 @@ public class DevicePolicyManagerWrapperImpl implements DevicePolicyManagerWrappe
|
||||
public boolean isUninstallInQueue(String packageName) {
|
||||
return mDpm.isUninstallInQueue(packageName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Intent createAdminSupportIntent(@NonNull String restriction) {
|
||||
return mDpm.createAdminSupportIntent(restriction);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user