コード例 #1
0
        protected override int VisualMain()
        {
            IProcessBasedCommandResult step1Result = null, step2Result = null;

            step1Result = CmdStation.GetSuCommand(TargetDevice, "rm -rf /data/system/device_policies.xml")
                          .To(OutputPrinter)
                          .Execute();
            WriteExitCode(step1Result.ExitCode);
            step2Result = CmdStation.GetSuCommand(TargetDevice, "rm -rf /data/system/device_owner_2.xml")
                          .To(OutputPrinter)
                          .Execute();
            WriteExitCode(step2Result.ExitCode);

            if (step1Result.ExitCode == 0 && step2Result.ExitCode == 0)
            {
                bool rebootToSystem = Ux.DoYN(Res("EDeviceOwnerRemoverYNReboot"));
                if (rebootToSystem)
                {
                    TargetDevice.Reboot2System();
                }
                return(0);
            }
            else
            {
                return(1);
            }
        }