Use new RestrictedLockUtils API
This is made necessary by changes to the SystemAPI the lib relies on. Test: RunSettingsRoboTests Bug: 116798569 Change-Id: I2812ce9e58e3fb15a5579ddc10cd0edf33d0ed44
This commit is contained in:
@@ -31,6 +31,7 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.view.View;
|
||||
|
||||
@@ -67,7 +68,8 @@ public class BluetoothEnablerTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
sFakeEnforcedAdmin = new EnforcedAdmin(new ComponentName("test.package", "test.Class"), 10);
|
||||
sFakeEnforcedAdmin = new EnforcedAdmin(new ComponentName("test.package", "test.Class"),
|
||||
UserHandle.of(10));
|
||||
}
|
||||
|
||||
@Mock
|
||||
|
@@ -27,6 +27,7 @@ import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -76,7 +77,7 @@ public class ActionDisabledByAdminDialogHelperTest {
|
||||
final int userId = 123;
|
||||
final ComponentName component = new ComponentName("some.package.name",
|
||||
"some.package.name.SomeClass");
|
||||
final EnforcedAdmin admin = new EnforcedAdmin(component, userId);
|
||||
final EnforcedAdmin admin = new EnforcedAdmin(component, UserHandle.of(userId));
|
||||
|
||||
mHelper.showAdminPolicies(admin, mActivity);
|
||||
|
||||
@@ -90,7 +91,7 @@ public class ActionDisabledByAdminDialogHelperTest {
|
||||
@Test
|
||||
public void testShowAdminPoliciesWithoutComponent() {
|
||||
final int userId = 123;
|
||||
final EnforcedAdmin admin = new EnforcedAdmin(null, userId);
|
||||
final EnforcedAdmin admin = new EnforcedAdmin(null, UserHandle.of(userId));
|
||||
mHelper.showAdminPolicies(admin, mActivity);
|
||||
final Intent intent = mActivityShadow.getNextStartedActivity();
|
||||
assertEquals(intent.getComponent(), new ComponentName(mActivity,
|
||||
@@ -146,7 +147,7 @@ public class ActionDisabledByAdminDialogHelperTest {
|
||||
final ViewGroup view = new FrameLayout(mActivity);
|
||||
final ComponentName component = new ComponentName("some.package.name",
|
||||
"some.package.name.SomeClass");
|
||||
final EnforcedAdmin admin = new EnforcedAdmin(component, 123);
|
||||
final EnforcedAdmin admin = new EnforcedAdmin(component, UserHandle.of(123));
|
||||
final TextView textView = new TextView(mActivity);
|
||||
|
||||
textView.setId(R.id.admin_support_msg);
|
||||
@@ -169,7 +170,7 @@ public class ActionDisabledByAdminDialogHelperTest {
|
||||
final ShadowUserManager userManagerShadow = Shadow.extract(userManager);
|
||||
final ComponentName component = new ComponentName("some.package.name",
|
||||
"some.package.name.SomeClass");
|
||||
final EnforcedAdmin admin = new EnforcedAdmin(component, 123);
|
||||
final EnforcedAdmin admin = new EnforcedAdmin(component, UserHandle.of(123));
|
||||
|
||||
dpmShadow.setShortSupportMessageForUser(component, 123, "some message");
|
||||
dpmShadow.setIsAdminActiveAsUser(false);
|
||||
|
@@ -43,7 +43,7 @@ public class ActionDisabledByAdminDialogTest {
|
||||
public void testGetAdminDetailsFromIntent() {
|
||||
final int userId = 123;
|
||||
final ComponentName component = new ComponentName("com.some.package", ".SomeClass");
|
||||
final EnforcedAdmin expectedAdmin = new EnforcedAdmin(component, userId);
|
||||
final EnforcedAdmin expectedAdmin = new EnforcedAdmin(component, UserHandle.of(userId));
|
||||
|
||||
final Intent intent = new Intent();
|
||||
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, component);
|
||||
@@ -54,7 +54,7 @@ public class ActionDisabledByAdminDialogTest {
|
||||
@Test
|
||||
public void testGetAdminDetailsFromNullIntent() {
|
||||
final int userId = UserHandle.myUserId();
|
||||
final EnforcedAdmin expectedAdmin = new EnforcedAdmin(null, userId);
|
||||
final EnforcedAdmin expectedAdmin = new EnforcedAdmin(null, UserHandle.of(userId));
|
||||
|
||||
Assert.assertEquals(expectedAdmin, mDialog.getAdminDetailsFromIntent(null));
|
||||
}
|
||||
|
Reference in New Issue
Block a user