Merge "Fix BackupRestoreTest" into sc-dev
This commit is contained in:
@@ -35,6 +35,7 @@ import android.app.backup.BackupManager;
|
||||
import android.content.pm.PackageInstaller;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
|
||||
@@ -64,17 +65,11 @@ public class BackupRestoreTest {
|
||||
private static final long OLD_WORK_PROFILE_ID = 11;
|
||||
private static final int WORK_PROFILE_ID = 10;
|
||||
|
||||
private static final int SYSTEM_USER = 0;
|
||||
private static final int FLAG_SYSTEM = 0x00000800;
|
||||
private static final int FLAG_PROFILE = 0x00001000;
|
||||
|
||||
private ShadowUserManager mUserManager;
|
||||
private BackupManager mBackupManager;
|
||||
private LauncherModelHelper mModelHelper;
|
||||
private SQLiteDatabase mDb;
|
||||
private InvariantDeviceProfile mIdp;
|
||||
private UserHandle mMainProfileUser;
|
||||
private UserHandle mWorkProfileUser;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@@ -90,17 +85,15 @@ public class BackupRestoreTest {
|
||||
final UserManager userManager = RuntimeEnvironment.application.getSystemService(
|
||||
UserManager.class);
|
||||
mUserManager = Shadow.extract(userManager);
|
||||
// sign in to primary user
|
||||
mMainProfileUser = mUserManager.addUser(SYSTEM_USER, "me", FLAG_SYSTEM);
|
||||
// sign in to work profile
|
||||
mWorkProfileUser = mUserManager.addUser(WORK_PROFILE_ID, "work", FLAG_PROFILE);
|
||||
mUserManager.addUser(WORK_PROFILE_ID, "work", ShadowUserManager.FLAG_MANAGED_PROFILE);
|
||||
}
|
||||
|
||||
private void setupBackupManager() {
|
||||
mBackupManager = new BackupManager(RuntimeEnvironment.application);
|
||||
final LShadowBackupManager bm = Shadow.extract(mBackupManager);
|
||||
bm.addProfile(MY_OLD_PROFILE_ID, mMainProfileUser);
|
||||
bm.addProfile(OLD_WORK_PROFILE_ID, mWorkProfileUser);
|
||||
bm.addProfile(MY_OLD_PROFILE_ID, Process.myUserHandle());
|
||||
bm.addProfile(OLD_WORK_PROFILE_ID, UserHandle.of(WORK_PROFILE_ID));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user