0

I am attempting to test whether task locking in Android L Preview can be accomplished by rooting the device rather than building a custom ROM.

I've created a 'device_owner.xml' file and placed in \data\system.

<?xml version='1.0' encoding='utf-8'?>
<device-owner>
    package="com.ta.instrumentcontroller"
    name="TA Instrument Controller"
</device-owner>

Upon reboot, the Nexus 7 2013 tablet just sits at the 'Bouncing Android Balls' logo. If I go into TWRP and delete the file, the boot sequence completes.

Does anyone know what might be going on?

MrEngineer13
  • 38,642
  • 13
  • 74
  • 93
vedavis
  • 958
  • 1
  • 13
  • 22
  • 1
    Please see my similar [question](http://stackoverflow.com/questions/26358689/how-to-use-android-l-task-locking/26374354#26374354) and the accepted answer. I have got task locking working on a rooted device. – tagy22 Oct 15 '14 at 08:27

1 Answers1

0

I don't believe what I am attempting is possible, because it was not built in the system image.

At this Google Git page, DevicePolicyManagerService.java, in function isInstalled():

static boolean isInstalled(String packageName, PackageManager pm) {
    try {
        PackageInfo pi;
        if ((pi = pm.getPackageInfo(packageName, 0)) != null) {
            if ((pi.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
                return true;
            }
        }
    } catch (NameNotFoundException nnfe) {
        Slog.w(TAG, "Device Owner package " + packageName + " not installed.");
    }
    return false;
}

The package info must contain ApplicationInfo.FLAG_SYSTEM, which means is must be part of the system image. ApplicationInfo

vedavis
  • 958
  • 1
  • 13
  • 22
  • You are referencing to android 4.3 here. Your question was about Android L aka 5.0. 5.0 implements it differently here: [DeviceOwner.java](https://android.googlesource.com/platform/frameworks/base.git/+/android-5.0.0_r2/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java) To become device owner, you need to perform a provisioning process via NFC. Read the [Docs](https://developer.android.com/about/versions/android-5.0.html) – Nappy Nov 05 '14 at 17:13
  • Nappy, no I was referencing Lollipop. I already know about the NFC provisioning. If you would have referenced how to implement NFC, that would have been better than just pointing out my lack of knowledge. – vedavis Nov 10 '14 at 13:09
  • I was able to get Device Ownership wading through various websites. I am using NFC to download a device_owner app and task lock it. It works very well, once you put all the pieces together. – vedavis Nov 25 '14 at 19:55