Giter VIP home page Giter VIP logo

android-testdpc's Introduction

Test Device Policy Control (Test DPC) App

Test DPC is an app designed to help EMMs, ISVs, and OEMs to test their applications and platforms in a Android enterprise managed profile (i.e. work profile). It serves as both a sample Device Policy Controller and a testing application to flex the APIs available for Android enterprise. It supports devices running Android 5.0 Lollipop or later.

See the documentation to learn more about Android in the enterprise.

Getting Started

This sample uses the Bazel build system. To build this project, use the "bazel build testdpc" command.

This app can also be found on the Play store.

Provisioning

You can find various kinds of provisioning methods here. Let's take a few of them as an example.

QR code provisioing (Device Owner N+ only)

  1. Factory reset your device and tap the welcome screen in setup wizard 6 times.
  2. The setup wizard prompts the user to connect to the Internet so the setup wizard can download a QR code reader.
  3. Modify (if needed) and scan [this QR code] (http://down-box.appspot.com/qr/nQB0tw7b).
  4. Follow onscreen instructions

ADB command

Device Owner

  • Run the adb command:

    adb shell dpm set-device-owner com.afwsamples.testdpc/.DeviceAdminReceiver

Profile Owner

  • Create a managed profile by launching the “Set up TestDPC” app (if this app seems broken and you are in dark mode, switch to light mode)
  • Skip adding an account at the end of the flow

COPE Profile Owner

  • Create a managed profile by launching the “Set up TestDPC” app (if this app seems broken and you are in dark mode, switch to light mode)

  • Skip adding an account at the end of the flow

  • Run the adb command:

    adb shell dpm mark-profile-owner-on-organization-owned-device --user 10 com.afwsamples.testdpc/.DeviceAdminReceiver`

TestDPC as DM role holder

TestDPC v9.0.5+ can be setup as Device Management Role Holder.

  • Running the following adb commands:

    adb shell cmd role set-bypassing-role-qualification true
    adb shell cmd role add-role-holder android.app.role.DEVICE_POLICY_MANAGEMENT com.afwsamples.testdpc

    Note: unlike DO/PO, this change is not persisted so TestDPC needs to be marked as role holder again if the device reboots.

Android Studio import

To import this repository in Android Studio, you need to use the Bazel for IntelliJ Plugin.

When importing the project you have to select the folder containing the Bazel's BUILD file. When prompted to select a "project view", you can choose the option "Copy external" and choose the scripts/ij.bazelproject available in this repository.

Once Bazel has complete the import operation and the first sync of the project, you can create a "Run Configuration". Select "Bazel Command" as Configuration type and add //:testdpc as "target expression".

You can now run the project from inside Android Studio.

Support

If you've found an error in this sample, please file an issue: https://github.com/googlesamples/android-testdpc/issues

Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub.

License

Licensed under the Apache 2.0 license. See the LICENSE file for details.

How to make contributions?

Please read and follow the steps in the CONTRIB file.

android-testdpc's People

Contributors

tony-mak avatar jscott1989 avatar andrewscull avatar the-felipeal avatar hex539 avatar eranmes avatar alexchau-google avatar pfmaggi avatar bfranz avatar stevenckngaa avatar erictanggoogle avatar dtpeacock avatar sudheer17 avatar gvictor avatar charles92 avatar szatmz avatar vkuzkokov avatar ming030890 avatar arvindmaan avatar jamshid-m avatar brarcher-google avatar brandonweeks avatar fredast avatar jasonbayton avatar monkopedia avatar elevenfive avatar peletskyi avatar sm2a avatar s1204it avatar johnlee2898 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.