1 package com.android.managedprovisioning.contracts
2
3 import android.content.ComponentName
4 import android.os.Bundle
5 import com.android.managedprovisioning.model.DisclaimersParam
6 import com.android.managedprovisioning.model.PackageDownloadInfo
7 import com.android.managedprovisioning.model.ProvisioningParams
8 import com.android.managedprovisioning.model.WifiInfo
9 import com.android.onboarding.contracts.provisioning.ACTIONS
10 import com.android.onboarding.contracts.provisioning.FLAGS
11 import com.android.onboarding.contracts.setupwizard.SuwArguments
12
13 /**
14 * Stub [SuwArguments] prebuilt for testing. Further customisation is available via
15 * [SuwArguments.copy] method
16 */
17 val aSuwArguments =
18 SuwArguments(
19 isSubactivityFirstLaunched = true,
20 isSuwSuggestedActionFlow = true,
21 isSetupFlow = true,
22 preDeferredSetup = true,
23 deferredSetup = false,
24 firstRun = true,
25 portalSetup = false,
26 hasMultipleUsers = false,
27 theme = "dark",
28 wizardBundle = Bundle.EMPTY
29 )
30
<lambda>null31 val aProvisioningParams: ProvisioningParams = run {
32 val flowType = FlowType.AdminIntegrated
33 val deviceAdminDownloadInfo =
34 PackageDownloadInfo.Builder()
35 .setLocation("some/body")
36 .setMinVersion(69)
37 .setPackageChecksum("checksum".toByteArray())
38 .build()
39 val deviceAdminComponentName = ComponentName("org.test", "Test")
40 val wifiInfo = WifiInfo.Builder().setSsid("MyFi").setPassword("secret").build()
41 val packageDownloadInfo = PackageDownloadInfo.Builder()
42 .setLocation("http://test.local")
43 .setMinVersion(420)
44 .setSignatureChecksum("69".toByteArray())
45 .setCookieHeader("I'm a cookie monster, gimmie all your cookies or else!")
46 .build()
47 ProvisioningParams.Builder()
48 .setProvisioningAction(ACTIONS.ACTION_PROVISION_MANAGED_PROFILE)
49 .setDeviceAdminComponentName(ComponentName("org.test", "local"))
50 .setFlowType(flowType.ordinal)
51 .setDeviceAdminDownloadInfo(deviceAdminDownloadInfo)
52 .setDeviceAdminComponentName(deviceAdminComponentName)
53 .setWifiInfo(wifiInfo)
54 .setUseMobileData(true)
55 .setIsNfc(true)
56 .setIsQrProvisioning(true)
57 .setSupportUrl("https://help.test")
58 .setInitiatorRequestedProvisioningModes(
59 FLAGS.FLAG_SUPPORTED_MODES_ORGANIZATION_OWNED or FLAGS.FLAG_SUPPORTED_MODES_DEVICE_OWNER
60 )
61 .setDisclaimersParam(
62 DisclaimersParam.Builder()
63 .setDisclaimers(
64 arrayOf(
65 DisclaimersParam.Disclaimer("a", "a.html"),
66 DisclaimersParam.Disclaimer("b", "b.html"),
67 )
68 )
69 .build()
70 )
71 .setRoleHolderDownloadInfo(packageDownloadInfo)
72 .setIsOrganizationOwnedProvisioning(true)
73 .setSkipEducationScreens(true)
74 .setReturnBeforePolicyCompliance(true)
75 .setDeviceOwnerPermissionGrantOptOut(true)
76 .setAllowProvisioningAfterUserSetupComplete(true)
77 .build()
78 }
79
80 val aProvisioningArguments: BaseProvisioningArguments = BaseProvisioningArguments(
81 provisioningParams = aProvisioningParams,
82 flowType = FlowType.entries[aProvisioningParams.flowType],
83 deviceAdminDownloadInfo = aProvisioningParams.deviceAdminDownloadInfo,
84 deviceAdminComponentName = aProvisioningParams.deviceAdminComponentName,
85 wifiInfo = aProvisioningParams.wifiInfo,
86 useMobileData = aProvisioningParams.useMobileData,
87 isNfc = aProvisioningParams.isNfc,
88 isQr = aProvisioningParams.isQrProvisioning,
89 )
90