如何在为 afw#setup 注册创建注册令牌时添加 android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED

How to add android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED when creating enrollment token for afw#setup enrollment

我们可以成功地将 android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED:true 添加到 qrCode 包中,方法是在转换为 QR 码之前将 属性 注入返回的注册令牌,这确实会启用系统应用程序;但是,我希望可以选择使用 afw#setup DPC 注册方法注册设备,方法是输入返回的令牌值作为手动代码而不是创建二维码。

当通过方法enterprises.enrollmentTokens.create创建token时,有没有办法在创建token时传递android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED:true属性让这个属性生效手动输入令牌值?还是 属性 只允许影响二维码注册而不影响手动注册?

例如,我想通过手动输入代码但使用传递的 android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED:true

来使用此 DPC 标识符方法

这是文档:https://developers.google.com/android/management/provision-device#dpc_identifier_method

我尝试了多种方法在令牌创建期间设置 qrCode 值,但 属性 从未出现在返回的 enrollment_token 对象中。例如,如果我使用它来创建令牌:

            enrollment_token = (
            androidmanagement.enterprises()
            .enrollmentTokens()
            .create(
                parent=f"enterprises/{enterprise_name}",
                body={
                    "policyName": policy_name,
                    "user": {"accountIdentifier": f"{device_alias}"},
                    "oneTimeOnly": "TRUE",
                    "qrCode": '{"android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED":true,"android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "com.google.android.apps.work.clouddpc/.receivers.CloudDeviceAdminReceiver","android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "I5YvS0O5hXY46mb01BlRjq4oJJGs2kuUcHvVkAPEXlg","android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "https://play.google.com/managed/downloadManagingApp?identifier=setup","android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE":{"com.google.android.apps.work.clouddpc.EXTRA_ENROLLMENT_TOKEN": "ENROLLMENT_TOKEN"}}'
                })
            .execute()
        )

它总是 returns 没有 android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED:true 的对象,例如

  "name": "enterprises/enterprise_name/enrollmentTokens/SOME_TOKEN",
  "value": "SOME_VALUE",
  "expirationTimestamp": "2022-03-15T11:22:19.935Z",
  "qrCode": "{\"android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME\":\"com.google.android.apps.work.clouddpc/.receivers.CloudDeviceAdminReceiver\",\"android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM\":\"I5YvS0O5hXY46mb01BlRjq4oJJGs2kuUcHvVkAPEXlg\",\"android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION\":\"https://play.google.com/managed/downloadManagingApp?identifier=setup\",\"android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE\":{\"com.google.android.apps.work.clouddpc.EXTRA_ENROLLMENT_TOKEN\":\"SOME_TOKEN\"}}"

API 生成 qrCode 字段的内容。 在 afw#setup 注册期间手动输入注册令牌时,您不能使用 android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED.

等 DPC extras

Extras 仅在通过 QR 码或零接触配置设备时可用。

请参阅此 link 了解更多信息。 https://developers.google.com/android/management/provision-device#example_qr_code_bundle https://developers.google.com/android/work/play/emm-api/prov-devices#create_a_qr_code