Add bp subtitle for WiFi sharing
Move the screen lock message selection logic to Utils and update the related strings as suzannechen@ suggested. Test: manual (see bug) Test: atest UtilsTest Fixes: 291307701 Change-Id: I346c25426395eea1320edc07ce2d962efeb8daa6
This commit is contained in:
@@ -1852,7 +1852,7 @@
|
|||||||
<!-- Title for the fragment to show that the QR code is for sharing Wi-Fi hotspot network [CHAR LIMIT=50] -->
|
<!-- Title for the fragment to show that the QR code is for sharing Wi-Fi hotspot network [CHAR LIMIT=50] -->
|
||||||
<string name="wifi_dpp_share_hotspot">Share hotspot</string>
|
<string name="wifi_dpp_share_hotspot">Share hotspot</string>
|
||||||
<!-- Title for Wi-Fi DPP lockscreen title [CHAR LIMIT=50] -->
|
<!-- Title for Wi-Fi DPP lockscreen title [CHAR LIMIT=50] -->
|
||||||
<string name="wifi_dpp_lockscreen_title">Verify that it\u0027s you</string>
|
<string name="wifi_dpp_lockscreen_title">Verify it\u0027s you</string>
|
||||||
<!-- Hint for Wi-Fi password [CHAR LIMIT=50] -->
|
<!-- Hint for Wi-Fi password [CHAR LIMIT=50] -->
|
||||||
<string name="wifi_dpp_wifi_password">Wi\u2011Fi password: <xliff:g id="password" example="my password">%1$s</xliff:g></string>
|
<string name="wifi_dpp_wifi_password">Wi\u2011Fi password: <xliff:g id="password" example="my password">%1$s</xliff:g></string>
|
||||||
<!-- Hint for Wi-Fi hotspot password [CHAR LIMIT=50] -->
|
<!-- Hint for Wi-Fi hotspot password [CHAR LIMIT=50] -->
|
||||||
@@ -3423,16 +3423,16 @@
|
|||||||
|
|
||||||
<!-- Message to be used to explain the users that they need to enter their pattern to continue a
|
<!-- Message to be used to explain the users that they need to enter their pattern to continue a
|
||||||
particular operation. [CHAR LIMIT=70]-->
|
particular operation. [CHAR LIMIT=70]-->
|
||||||
<string name="lockpassword_confirm_your_pattern_generic">Use your device pattern to continue</string>
|
<string name="lockpassword_confirm_your_pattern_generic">Draw your pattern to continue</string>
|
||||||
<!-- Message to be used to explain the users that they need to enter their PIN to continue a
|
<!-- Message to be used to explain the users that they need to enter their PIN to continue a
|
||||||
particular operation. [CHAR LIMIT=70]-->
|
particular operation. [CHAR LIMIT=70]-->
|
||||||
<string name="lockpassword_confirm_your_pin_generic">Enter your device PIN to continue</string>
|
<string name="lockpassword_confirm_your_pin_generic">Enter your PIN to continue</string>
|
||||||
<!-- Message to be used to explain the users that they need to enter their password to continue a
|
<!-- Message to be used to explain the users that they need to enter their password to continue a
|
||||||
particular operation. [CHAR LIMIT=70]-->
|
particular operation. [CHAR LIMIT=70]-->
|
||||||
<string name="lockpassword_confirm_your_password_generic">Enter your device password to continue</string>
|
<string name="lockpassword_confirm_your_password_generic">Enter your password to continue</string>
|
||||||
<!-- Message to be used to explain the users that they need to enter their work pattern to continue a
|
<!-- Message to be used to explain the users that they need to enter their work pattern to continue a
|
||||||
particular operation. [CHAR LIMIT=70]-->
|
particular operation. [CHAR LIMIT=70]-->
|
||||||
<string name="lockpassword_confirm_your_pattern_generic_profile">Use your work pattern to continue</string>
|
<string name="lockpassword_confirm_your_pattern_generic_profile">Draw your work pattern to continue</string>
|
||||||
<!-- Message to be used to explain the users that they need to enter their work PIN to continue a
|
<!-- Message to be used to explain the users that they need to enter their work PIN to continue a
|
||||||
particular operation. [CHAR LIMIT=70]-->
|
particular operation. [CHAR LIMIT=70]-->
|
||||||
<string name="lockpassword_confirm_your_pin_generic_profile">Enter your work PIN to continue</string>
|
<string name="lockpassword_confirm_your_pin_generic_profile">Enter your work PIN to continue</string>
|
||||||
|
@@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
|
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_CONFIRM_PASSWORD;
|
||||||
|
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_CONFIRM_PATTERN;
|
||||||
|
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_CONFIRM_PIN;
|
||||||
import static android.content.Intent.EXTRA_USER;
|
import static android.content.Intent.EXTRA_USER;
|
||||||
import static android.content.Intent.EXTRA_USER_ID;
|
import static android.content.Intent.EXTRA_USER_ID;
|
||||||
import static android.text.format.DateUtils.FORMAT_ABBREV_MONTH;
|
import static android.text.format.DateUtils.FORMAT_ABBREV_MONTH;
|
||||||
@@ -782,6 +785,47 @@ public final class Utils extends com.android.settingslib.Utils {
|
|||||||
return lpu.getCredentialTypeForUser(userId);
|
return lpu.getCredentialTypeForUser(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the confirmation credential string of the given user id.
|
||||||
|
*/
|
||||||
|
@Nullable public static String getConfirmCredentialStringForUser(@NonNull Context context,
|
||||||
|
int userId, @LockPatternUtils.CredentialType int credentialType) {
|
||||||
|
final int effectiveUserId = UserManager.get(context).getCredentialOwnerProfile(userId);
|
||||||
|
final boolean isEffectiveUserManagedProfile = UserManager.get(context)
|
||||||
|
.isManagedProfile(effectiveUserId);
|
||||||
|
final DevicePolicyManager devicePolicyManager = context
|
||||||
|
.getSystemService(DevicePolicyManager.class);
|
||||||
|
switch (credentialType) {
|
||||||
|
case LockPatternUtils.CREDENTIAL_TYPE_PIN:
|
||||||
|
if (isEffectiveUserManagedProfile) {
|
||||||
|
return devicePolicyManager.getResources().getString(WORK_PROFILE_CONFIRM_PIN,
|
||||||
|
() -> context.getString(
|
||||||
|
R.string.lockpassword_confirm_your_pin_generic_profile));
|
||||||
|
}
|
||||||
|
|
||||||
|
return context.getString(R.string.lockpassword_confirm_your_pin_generic);
|
||||||
|
case LockPatternUtils.CREDENTIAL_TYPE_PATTERN:
|
||||||
|
if (isEffectiveUserManagedProfile) {
|
||||||
|
return devicePolicyManager.getResources().getString(
|
||||||
|
WORK_PROFILE_CONFIRM_PATTERN,
|
||||||
|
() -> context.getString(
|
||||||
|
R.string.lockpassword_confirm_your_pattern_generic_profile));
|
||||||
|
}
|
||||||
|
|
||||||
|
return context.getString(R.string.lockpassword_confirm_your_pattern_generic);
|
||||||
|
case LockPatternUtils.CREDENTIAL_TYPE_PASSWORD:
|
||||||
|
if (isEffectiveUserManagedProfile) {
|
||||||
|
return devicePolicyManager.getResources().getString(
|
||||||
|
WORK_PROFILE_CONFIRM_PASSWORD,
|
||||||
|
() -> context.getString(
|
||||||
|
R.string.lockpassword_confirm_your_password_generic_profile));
|
||||||
|
}
|
||||||
|
|
||||||
|
return context.getString(R.string.lockpassword_confirm_your_password_generic);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private static final StringBuilder sBuilder = new StringBuilder(50);
|
private static final StringBuilder sBuilder = new StringBuilder(50);
|
||||||
private static final java.util.Formatter sFormatter = new java.util.Formatter(
|
private static final java.util.Formatter sFormatter = new java.util.Formatter(
|
||||||
sBuilder, Locale.getDefault());
|
sBuilder, Locale.getDefault());
|
||||||
|
@@ -20,9 +20,6 @@ package com.android.settings.password;
|
|||||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PASSWORD_HEADER;
|
import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PASSWORD_HEADER;
|
||||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PATTERN_HEADER;
|
import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PATTERN_HEADER;
|
||||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PIN_HEADER;
|
import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PIN_HEADER;
|
||||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_CONFIRM_PASSWORD;
|
|
||||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_CONFIRM_PATTERN;
|
|
||||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_CONFIRM_PIN;
|
|
||||||
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
|
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@@ -211,7 +208,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
}
|
}
|
||||||
if (mDetails == null) {
|
if (mDetails == null) {
|
||||||
promptInfo.setDeviceCredentialSubtitle(
|
promptInfo.setDeviceCredentialSubtitle(
|
||||||
getDetailsFromCredentialType(credentialType, isEffectiveUserManagedProfile));
|
Utils.getConfirmCredentialStringForUser(this, mUserId, credentialType));
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean launchedBiometric = false;
|
boolean launchedBiometric = false;
|
||||||
@@ -342,39 +339,6 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDetailsFromCredentialType(@LockPatternUtils.CredentialType int credentialType,
|
|
||||||
boolean isEffectiveUserManagedProfile) {
|
|
||||||
switch (credentialType) {
|
|
||||||
case LockPatternUtils.CREDENTIAL_TYPE_PIN:
|
|
||||||
if (isEffectiveUserManagedProfile) {
|
|
||||||
return mDevicePolicyManager.getResources().getString(WORK_PROFILE_CONFIRM_PIN,
|
|
||||||
() -> getString(
|
|
||||||
R.string.lockpassword_confirm_your_pin_generic_profile));
|
|
||||||
}
|
|
||||||
|
|
||||||
return getString(R.string.lockpassword_confirm_your_pin_generic);
|
|
||||||
case LockPatternUtils.CREDENTIAL_TYPE_PATTERN:
|
|
||||||
if (isEffectiveUserManagedProfile) {
|
|
||||||
return mDevicePolicyManager.getResources().getString(
|
|
||||||
WORK_PROFILE_CONFIRM_PATTERN,
|
|
||||||
() -> getString(
|
|
||||||
R.string.lockpassword_confirm_your_pattern_generic_profile));
|
|
||||||
}
|
|
||||||
|
|
||||||
return getString(R.string.lockpassword_confirm_your_pattern_generic);
|
|
||||||
case LockPatternUtils.CREDENTIAL_TYPE_PASSWORD:
|
|
||||||
if (isEffectiveUserManagedProfile) {
|
|
||||||
return mDevicePolicyManager.getResources().getString(
|
|
||||||
WORK_PROFILE_CONFIRM_PASSWORD,
|
|
||||||
() -> getString(
|
|
||||||
R.string.lockpassword_confirm_your_password_generic_profile));
|
|
||||||
}
|
|
||||||
|
|
||||||
return getString(R.string.lockpassword_confirm_your_password_generic);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
@@ -27,11 +27,13 @@ import android.net.wifi.WifiManager;
|
|||||||
import android.os.CancellationSignal;
|
import android.os.CancellationSignal;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.os.VibrationEffect;
|
import android.os.VibrationEffect;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.Utils;
|
||||||
import com.android.settingslib.wifi.AccessPoint;
|
import com.android.settingslib.wifi.AccessPoint;
|
||||||
import com.android.wifitrackerlib.WifiEntry;
|
import com.android.wifitrackerlib.WifiEntry;
|
||||||
|
|
||||||
@@ -391,11 +393,19 @@ public class WifiDppUtils {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
final int userId = UserHandle.myUserId();
|
||||||
|
|
||||||
final BiometricPrompt.Builder builder = new BiometricPrompt.Builder(context)
|
final BiometricPrompt.Builder builder = new BiometricPrompt.Builder(context)
|
||||||
.setTitle(context.getText(R.string.wifi_dpp_lockscreen_title));
|
.setTitle(context.getText(R.string.wifi_dpp_lockscreen_title))
|
||||||
|
.setUseDefaultSubtitle();
|
||||||
|
|
||||||
if (keyguardManager.isDeviceSecure()) {
|
if (keyguardManager.isDeviceSecure()) {
|
||||||
builder.setDeviceCredentialAllowed(true);
|
builder.setDeviceCredentialAllowed(true);
|
||||||
|
builder.setTextForDeviceCredential(
|
||||||
|
null /* title */,
|
||||||
|
Utils.getConfirmCredentialStringForUser(
|
||||||
|
context, userId, Utils.getCredentialType(context, userId)),
|
||||||
|
null /* description */);
|
||||||
}
|
}
|
||||||
|
|
||||||
final BiometricPrompt bp = builder.build();
|
final BiometricPrompt bp = builder.build();
|
||||||
|
@@ -16,9 +16,15 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
|
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_CONFIRM_PASSWORD;
|
||||||
|
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_CONFIRM_PATTERN;
|
||||||
|
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_CONFIRM_PIN;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertThrows;
|
import static org.junit.Assert.assertThrows;
|
||||||
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
@@ -31,6 +37,7 @@ import static org.mockito.Mockito.when;
|
|||||||
|
|
||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
|
import android.app.admin.DevicePolicyResourcesManager;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
@@ -60,6 +67,7 @@ import android.widget.TextView;
|
|||||||
import androidx.core.graphics.drawable.IconCompat;
|
import androidx.core.graphics.drawable.IconCompat;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
|
import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
@@ -94,6 +102,8 @@ public class UtilsTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private DevicePolicyManager mDevicePolicyManager;
|
private DevicePolicyManager mDevicePolicyManager;
|
||||||
@Mock
|
@Mock
|
||||||
|
private DevicePolicyResourcesManager mDevicePolicyResourcesManager;
|
||||||
|
@Mock
|
||||||
private UserManager mMockUserManager;
|
private UserManager mMockUserManager;
|
||||||
@Mock
|
@Mock
|
||||||
private PackageManager mPackageManager;
|
private PackageManager mPackageManager;
|
||||||
@@ -348,4 +358,103 @@ public class UtilsTest {
|
|||||||
SecurityException.class,
|
SecurityException.class,
|
||||||
() -> Utils.checkUserOwnsFrpCredential(mContext, 123));
|
() -> Utils.checkUserOwnsFrpCredential(mContext, 123));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getConfirmCredentialStringForUser_Pin_shouldReturnCorrectString() {
|
||||||
|
setUpForConfirmCredentialString(false /* isEffectiveUserManagedProfile */);
|
||||||
|
|
||||||
|
when(mContext.getString(R.string.lockpassword_confirm_your_pin_generic))
|
||||||
|
.thenReturn("PIN");
|
||||||
|
|
||||||
|
String confirmCredentialString = Utils.getConfirmCredentialStringForUser(mContext,
|
||||||
|
USER_ID, LockPatternUtils.CREDENTIAL_TYPE_PIN);
|
||||||
|
|
||||||
|
assertThat(confirmCredentialString).isEqualTo("PIN");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getConfirmCredentialStringForUser_Pattern_shouldReturnCorrectString() {
|
||||||
|
setUpForConfirmCredentialString(false /* isEffectiveUserManagedProfile */);
|
||||||
|
|
||||||
|
when(mContext.getString(R.string.lockpassword_confirm_your_pattern_generic))
|
||||||
|
.thenReturn("PATTERN");
|
||||||
|
|
||||||
|
String confirmCredentialString = Utils.getConfirmCredentialStringForUser(mContext,
|
||||||
|
USER_ID, LockPatternUtils.CREDENTIAL_TYPE_PATTERN);
|
||||||
|
|
||||||
|
assertThat(confirmCredentialString).isEqualTo("PATTERN");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getConfirmCredentialStringForUser_Password_shouldReturnCorrectString() {
|
||||||
|
setUpForConfirmCredentialString(false /* isEffectiveUserManagedProfile */);
|
||||||
|
|
||||||
|
when(mContext.getString(R.string.lockpassword_confirm_your_password_generic))
|
||||||
|
.thenReturn("PASSWORD");
|
||||||
|
|
||||||
|
String confirmCredentialString = Utils.getConfirmCredentialStringForUser(mContext,
|
||||||
|
USER_ID, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD);
|
||||||
|
|
||||||
|
assertThat(confirmCredentialString).isEqualTo("PASSWORD");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getConfirmCredentialStringForUser_workPin_shouldReturnCorrectString() {
|
||||||
|
setUpForConfirmCredentialString(true /* isEffectiveUserManagedProfile */);
|
||||||
|
|
||||||
|
when(mDevicePolicyResourcesManager
|
||||||
|
.getString(eq(WORK_PROFILE_CONFIRM_PIN), any()))
|
||||||
|
.thenReturn("WORK PIN");
|
||||||
|
|
||||||
|
String confirmCredentialString = Utils.getConfirmCredentialStringForUser(mContext,
|
||||||
|
USER_ID, LockPatternUtils.CREDENTIAL_TYPE_PIN);
|
||||||
|
|
||||||
|
assertThat(confirmCredentialString).isEqualTo("WORK PIN");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getConfirmCredentialStringForUser_workPattern_shouldReturnCorrectString() {
|
||||||
|
setUpForConfirmCredentialString(true /* isEffectiveUserManagedProfile */);
|
||||||
|
|
||||||
|
when(mDevicePolicyResourcesManager
|
||||||
|
.getString(eq(WORK_PROFILE_CONFIRM_PATTERN), any()))
|
||||||
|
.thenReturn("WORK PATTERN");
|
||||||
|
|
||||||
|
String confirmCredentialString = Utils.getConfirmCredentialStringForUser(mContext,
|
||||||
|
USER_ID, LockPatternUtils.CREDENTIAL_TYPE_PATTERN);
|
||||||
|
|
||||||
|
assertThat(confirmCredentialString).isEqualTo("WORK PATTERN");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getConfirmCredentialStringForUser_workPassword_shouldReturnCorrectString() {
|
||||||
|
setUpForConfirmCredentialString(true /* isEffectiveUserManagedProfile */);
|
||||||
|
|
||||||
|
when(mDevicePolicyResourcesManager
|
||||||
|
.getString(eq(WORK_PROFILE_CONFIRM_PASSWORD), any()))
|
||||||
|
.thenReturn("WORK PASSWORD");
|
||||||
|
|
||||||
|
String confirmCredentialString = Utils.getConfirmCredentialStringForUser(mContext,
|
||||||
|
USER_ID, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD);
|
||||||
|
|
||||||
|
assertThat(confirmCredentialString).isEqualTo("WORK PASSWORD");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getConfirmCredentialStringForUser_credentialTypeNone_shouldReturnNull() {
|
||||||
|
setUpForConfirmCredentialString(false /* isEffectiveUserManagedProfile */);
|
||||||
|
|
||||||
|
String confirmCredentialString = Utils.getConfirmCredentialStringForUser(mContext,
|
||||||
|
USER_ID, LockPatternUtils.CREDENTIAL_TYPE_NONE);
|
||||||
|
|
||||||
|
assertNull(confirmCredentialString);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setUpForConfirmCredentialString(boolean isEffectiveUserManagedProfile) {
|
||||||
|
when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mMockUserManager);
|
||||||
|
when(mMockUserManager.getCredentialOwnerProfile(USER_ID)).thenReturn(USER_ID);
|
||||||
|
when(mMockUserManager.isManagedProfile(USER_ID)).thenReturn(isEffectiveUserManagedProfile);
|
||||||
|
when(mContext.getSystemService(DevicePolicyManager.class)).thenReturn(mDevicePolicyManager);
|
||||||
|
when(mDevicePolicyManager.getResources()).thenReturn(mDevicePolicyResourcesManager);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user