iot-core-azure-dm-client icon indicating copy to clipboard operation
iot-core-azure-dm-client copied to clipboard

CustomDeviceUiCSP::IsCustomUISupported

Open jezzsantos opened this issue 6 years ago • 7 comments

We have a device with an instance of the DmClient running, and the SystemConfigurator.exe running from the 'windows\system32' folder of device.

We have used the device twin to install a new 'foreground' app our device, and would like to start it, and make it foreground app that starts up, when the device reboots.

The app installs as a 'foreground' no problem, using the device twin. The app does not run when installed by device twin, so we issued the direct method (windows.manageAppLifeCycleAsync) for that. Which works fine and starts the app running,

However, the app is still not going to run when rebooted. So, we tried to use the device twin to set our app as 'startup=foreground' (and the 'IotCoreDefaultApplication' as 'startup=none'), as suggested by the docs Managing Application State and Reporting

for example:

{
	"desired": {
		"windows": {
			"apps": {
				"OurApp_wx6rjk4rabqa6": {
					"pkgFamilyName": "OurApp_wx6rjk4rabqa6",
					"version": "0.0.1.0",
					"startUp": "foreground"
				},
				"16454Windows10IOTCore_IOTCoreDefaultApplication_rz84sjny4rf58": {
					"pkgFamilyName": "16454Windows10IOTCore.IOTCoreDefaultApplication_rz84sjny4rf58",
					"startUp": "none"
				}
			}
		}
	}
}

However, that does not work properly, and SystemConfigurator.exe reports this error (in the ETW logs): Cannot set a startup application on this sku..

If we look up that error in the source code of SystemConfigurator, CommandProcessor is throwing the exception.

Digging into CustomDeviceUiCsp we see that the exception is caused by a missing setting ./Vendor/MSFT/CustomDeviceUI/StartupAppID?list=StructData.

My question is, what does all this mean, and how do we get CustomDeviceUiCSP::IsCustomUISupported() to return 'true' for our device?

jezzsantos avatar Feb 07 '19 22:02 jezzsantos

Hi jezzsantos,

Which Windows sku are you running the client on?

The start-up is only supported on Windows IoT Core.

gmileka avatar Feb 13 '19 01:02 gmileka

Hi, can you list my SKU options for that?

Sorry, I did not create the *.ffu, so until i can contact that person( who may also not know) I May need to know how i could easily find out the answer, if there is one?

jezzsantos avatar Feb 13 '19 05:02 jezzsantos

I believe we are using a test image from back in October , does that help? (Sorry, I don't have any technical details, apart form the fact that I do get a warning displayed in Device Portal - see attached)

image

jezzsantos avatar Feb 19 '19 00:02 jezzsantos

Hi jezzsantos,

Apologies for the delay. Is this still an issue?

gmileka avatar Mar 27 '19 18:03 gmileka

We are also experiencing this issue. When trying to install a new foreground app (upgrades to existing foreground app work).

Windows version is v.10.0.17763.437

Here's a prettified log ETW trace:

04/11/2019-14:18:41.6934672,sc.exe,"Request received..."
04/11/2019-14:18:41.6935440,sc.exe,"    request tag:8"
04/11/2019-14:18:41.6936112,sc.exe,"    request json:{\"AppId\":\"family_name_here\",\"IsBackgroundApplication\":false}"
04/11/2019-14:18:41.6939488,sc.exe,"ProcessCommand"
04/11/2019-14:18:41.6939984,sc.exe,"HandleAddRemoveAppForStartup"
04/11/2019-14:18:41.6940512,sc.exe,"CustomDeviceUiCSP::IsCustomUISupported"
04/11/2019-14:18:41.6940944,sc.exe,"Utils::GetDmUserSid"
04/11/2019-14:18:41.6941392,sc.exe,"Utils::GetShellUserInfo"
04/11/2019-14:18:41.6986512,sc.exe,"Exception: Cannot set a startup application on this sku."
04/11/2019-14:18:41.6987424,sc.exe,"Exception error code: -1"
04/11/2019-14:18:41.6993072,sc.exe,"Response generated..."
04/11/2019-14:18:41.6993600,sc.exe,"response tag :43"
04/11/2019-14:18:41.6994288,sc.exe,"response json: {\"Status\":1,\"SubSystem\":0,\"ErrorCode\":-1,\"ErrorMessage\":\"Cannot set a startup application on this sku.\"}"

The relevant part of DeviceTwin desired is:

"apps": {
          "AmazingOrg_AmazingApp_00xfq0dct0ttr": {
            "pkgFamilyName": "AmazingOrg.AmazingApp_00xfq0dct0ttr",
            "version": "2.0.18020.0",
            "startUp": "foreground",
            "appxSource": "AmazingApp2-18020/AmazingOrg.AmazingApp_2.0.18020.0_ARM.appx",
            "depsSources": "AmazingApp2-18020/Microsoft.NET.CoreRuntime.2.1.appx;AmazingApp2-18020/Microsoft.VCLibs.ARM.14.00.appx",
            "certSource": "AmazingApp2-18020/AmazingOrg.AmazingApp_2.0.18020.0_ARM.cer",
            "certStore": "./Device/Vendor/MSFT/RootCATrustedCertificates/TrustedPeople"
          },
          "IoTUAPOOBE_cw5n1h2txyewy": {
            "pkgFamilyName": "IoTUAPOOBE_cw5n1h2txyewy",
            "version": "1.0.0.0",
            "startUp": "background"
          }
        },

tymtam2 avatar Apr 11 '19 04:04 tymtam2

When debugging SystemConfigurator I noticed that CustomDeviceUiCSP::IsCustomUISupported generates the following 'ML' request when calling

 wstring appId = MdmProvision::RunGetString(
                sid.c_str(),
                L"./Vendor/MSFT/CustomDeviceUI/StartupAppID?list=StructData");
SyncMLServer - Request : 
        <SyncBody>
            <Get>
              <CmdID>1</CmdID>
              <Item>
                <Target>
                  <LocURI>S-1-5-21-2702878673-795188819-444038987-503</LocURI>
                </Target>
                <Meta>
                    <Type xmlns=\"syncml:metinf\">text/plain</Type>
                </Meta>
              </Item>
            </Get>
        </SyncBody>

I would say that the LocURI should be './Vendor/MSFT/CustomDeviceUI/StartupAppID?list=StructData'

It looks like wrong RunGetString is called.

It's should be:

            wstring appId = MdmProvision::RunGetString(
                sid.c_str(),
                L"./Vendor/MSFT/CustomDeviceUI/StartupAppID?list=StructData", 
                false);

not

            wstring appId = MdmProvision::RunGetString(
                sid.c_str(),
                L"./Vendor/MSFT/CustomDeviceUI/StartupAppID?list=StructData");

tymtam2 avatar Apr 12 '19 02:04 tymtam2

Hi, @gmileka, would the pull request 306 be merged to fix this issue?

tymtam2 avatar Jul 31 '19 22:07 tymtam2