0

I am trying to enable Task locking by setting up a device owner. This is the guide by Google.

Full instructions and commands below:

1. Attach a device running an Android userdebug build to your development machine.
2. Install your device owner app.
3. Create a device_owner.xml file and save it to the /data/system directory on the device.

$ adb root
$ adb shell stop
$ rm /tmp/device_owner.xml
$ echo "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>"
>> /tmp/device_owner.xml
$ echo "<device-owner package=\"<your_device_owner_package>\"
name=\"*<your_organization_name>\" />" >> /tmp/device_owner.xml
$ adb push /tmp/device_owner.xml /data/system/device_owner.xml
$ adb reboot

I have a problem. I tried to do the commands using GitBash on Windows but that fails when I try to do adb push because it can't find the right path to the xml, I found out that I need to do them through a Linux Terminal. So I got Virtual Machine and when I try to do adb push it says I don't have permission. Then I tried to do adb shell + su but then that leads my device to stop being mounted.

J_Strauton
  • 2,270
  • 3
  • 28
  • 70
  • The code you show is creating the XML file. As far as the device owner package, I'm guessing that you should use the java package where you develop your applications. I agree the documentation is limited so far, but remember this is a preview release you are looking at -- by definition not ready for prime time. – Dale Wilson Oct 13 '14 at 20:25
  • Oh and I hope you have a really good reason to want to task lock the device. This is going to be a really annoying feature when it is used for the wrong purposes. (Just wanting to learn counts as a good reason, though.) – Dale Wilson Oct 13 '14 at 20:27
  • I do, it is both for learning and a kiosk mode. – J_Strauton Oct 13 '14 at 20:33
  • See a similar [question](http://stackoverflow.com/questions/26358689/how-to-use-android-l-task-locking) I posted. I got task locking working on a Nexus 7. – tagy22 Oct 15 '14 at 11:34
  • @tagy22 I saw your post, but it didn't help me much. Could you post as an answer here all the steps you took to get yours working? Including what version of Ubuntu, the commands and anything else you had to use? I would deeply appreciate it. Specially this part: `Create device_owner.xml [make sure the app will be present before u push device_owner.xml ]` – J_Strauton Oct 15 '14 at 18:06
  • @J_Strauton I am not sure where you are getting stuck. `Create device_owner.xml [make sure the app will be present before u push device_owner.xml ]` just means make the xml file using a text editor, and make sure you have installed your App before you push it. Do you have a rooted Android-L device? – tagy22 Oct 15 '14 at 18:43
  • @tagy22 Yes my device is rooted and has Android-L. Did you use Ubuntu for your commands? My biggest problem is adding that `xml` file inside the Android device. – J_Strauton Oct 16 '14 at 02:46
  • @J_Strauton I used OS X, I copied the file to sdcard/Download/ from my mac. Used the Root browser App to copy it to /data/system/ then `adb shell su` `cd /data/system/` `chown system:system device_owner.xml` – tagy22 Oct 16 '14 at 09:02

1 Answers1

0

Try these commands

adb root
adb remount

After these , adb push should work

Nivil Boban
  • 286
  • 1
  • 13