RunOnSecondaryUserTargetPreparer

public class RunOnSecondaryUserTargetPreparer
extends BaseTargetPreparer

java.lang.Object
   ↳ com.android.tradefed.targetprep.BaseTargetPreparer
     ↳ com.android.tradefed.targetprep.RunOnSecondaryUserTargetPreparer


ITargetPreparer,確保測試以次要使用者身分執行。此外,如果選項為 ERROR(/#START_BACKGROUND_USER),且目前使用者已是次要使用者,系統會確保次要螢幕上顯示背景次要使用者。true

如果目標次要使用者不存在,系統會建立新使用者,並在拆除時移除。否則,系統會使用該檔案,而非建立新檔案,且不會在拆解時移除該檔案。

如果裝置沒有容量在需要時建立新使用者,則會設定檢測引數 skip-tests-reason,且使用者不會變更。在裝置上執行的測試可以讀取這個引數,以回應這個狀態。

摘要

欄位

protected boolean mStartBackgroundUser

protected List<String> mTestPackages

protected int originalUserId

protected int secondaryUserId

公用建構函式

RunOnSecondaryUserTargetPreparer()

公用方法

void setUp(TestInformation testInfo)
void tearDown(TestInformation testInfo, Throwable e)

受保護的方法

boolean canCreateAdditionalSecondaryUsers(ITestDevice device, int numberOfUsers)

檢查是否可以建立所需數量的次要使用者。

欄位

mStartBackgroundUser

protected boolean mStartBackgroundUser

mTestPackages

protected List<String> mTestPackages

originalUserId

protected int originalUserId

secondaryUserId

protected int secondaryUserId

公用建構函式

RunOnSecondaryUserTargetPreparer

public RunOnSecondaryUserTargetPreparer ()

公用方法

setUp

public void setUp (TestInformation testInfo)

參數
testInfo TestInformation

擲回
DeviceNotAvailableException
TargetSetupError

tearDown

public void tearDown (TestInformation testInfo, 
                Throwable e)

參數
testInfo TestInformation

e Throwable

擲回
DeviceNotAvailableException

受保護的方法

canCreateAdditionalSecondaryUsers

protected boolean canCreateAdditionalSecondaryUsers (ITestDevice device, 
                int numberOfUsers)

檢查是否可以建立所需數量的次要使用者。

參數
device ITestDevice

numberOfUsers int

傳回
boolean

擲回
DeviceNotAvailableException