自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
ITokenProvider
public
interface
ITokenProvider
com.android.tradefed.invoker.shard.token.ITokenProvider
|
介面可說明可提供特定裝置符記的物件。每個實作項目都可以檢查一或多個符記。
符記是特定裝置上的特殊屬性。
權杖會在切割期間使用,確保要求特定權杖的測試會在提供權杖的裝置上執行。
摘要
公用方法
hasToken
public abstract boolean hasToken (ITestDevice device,
TokenProperty token)
查詢並傳回裝置是否有特定權杖。
參數 |
device |
ITestDevice :裝置查詢其權杖。 |
token |
TokenProperty :要檢查的權杖 |
傳回 |
boolean |
如果裝置有憑證,則傳回「是」;否則傳回「否」。 |
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# ITokenProvider\n==============\n\n\n`\npublic\n\n\ninterface\nITokenProvider\n`\n\n\n`\n\n\n`\n\n|---------------------------------------------------------|\n| com.android.tradefed.invoker.shard.token.ITokenProvider |\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [CecControllerTokenProvider](../../../../../../../../reference/tradefed/com/android/tradefed/invoker/shard/token/CecControllerTokenProvider.html), [TelephonyTokenProvider](../../../../../../../../reference/tradefed/com/android/tradefed/invoker/shard/token/TelephonyTokenProvider.html) |---------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------| | [CecControllerTokenProvider](../../../../../../../../reference/tradefed/com/android/tradefed/invoker/shard/token/CecControllerTokenProvider.html) | Token provider for Consumer Electronics Control (CEC) related tokens. | | [TelephonyTokenProvider](../../../../../../../../reference/tradefed/com/android/tradefed/invoker/shard/token/TelephonyTokenProvider.html) | Token provider for telephony related tokens. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface describing an object that can provide the tokens of a particular device. Each\nimplementation can check one or several tokens.\n\nA token is a special property present on the particular device.\n\nTokens are used during sharding to ensure tests requesting a particular tokens are run against\nthe device providing the token.\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[hasToken](../../../../../../../../reference/tradefed/com/android/tradefed/invoker/shard/token/ITokenProvider.html#hasToken(com.android.tradefed.device.ITestDevice,%20com.android.tradefed.invoker.shard.token.TokenProperty))`(`[ITestDevice](../../../../../../../../reference/tradefed/com/android/tradefed/device/ITestDevice.html)` device, `[TokenProperty](../../../../../../../../reference/tradefed/com/android/tradefed/invoker/shard/token/TokenProperty.html)` token) ` Query and return whether or not the device has a particular token. |\n\nPublic methods\n--------------\n\n### hasToken\n\n```\npublic abstract boolean hasToken (ITestDevice device, \n TokenProperty token)\n```\n\nQuery and return whether or not the device has a particular token.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------|------------------------------------------------------|\n| `device` | `ITestDevice`: Device queried for its tokens. \u003cbr /\u003e |\n| `token` | `TokenProperty`: The token to check \u003cbr /\u003e |\n\n| Returns ||\n|-----------|-----------------------------------------------------------|\n| `boolean` | True if the device has the token, false otherwise. \u003cbr /\u003e |"]]