├── .github ├── scripts │ └── gradlew_recursive.sh └── workflows │ ├── android.yml │ └── copy-branch.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── ManagedConfigurations ├── .google │ └── packaging.yaml ├── README.md ├── app │ ├── build.gradle.kts │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── android │ │ │ ├── common │ │ │ ├── activities │ │ │ │ └── SampleActivityBase.kt │ │ │ └── logger │ │ │ │ ├── Log.java │ │ │ │ ├── LogFragment.java │ │ │ │ ├── LogNode.java │ │ │ │ ├── LogView.java │ │ │ │ ├── LogWrapper.java │ │ │ │ └── MessageOnlyLogFilter.java │ │ │ └── managedconfigurations │ │ │ ├── EnterpriseReporter.kt │ │ │ ├── MainActivity.kt │ │ │ └── ManagedConfigurationsFragment.kt │ │ └── res │ │ ├── drawable-hdpi │ │ └── tile.9.png │ │ ├── layout-w720dp │ │ └── activity_main.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ └── fragment_managed_configurations.xml │ │ ├── menu │ │ └── main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-sw600dp │ │ ├── dimens.xml │ │ └── styles.xml │ │ ├── values │ │ ├── dimens.xml │ │ ├── restriction_values.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── app_restrictions.xml ├── build.gradle.kts ├── gradle.properties ├── gradle │ ├── libs.versions.toml │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── screenshots │ ├── app_feedback.gif │ ├── big_icon.png │ ├── main.png │ ├── setup_testdpc.gif │ └── update_managed_configurations.gif └── settings.gradle.kts ├── README.md ├── Work-profile-codelab ├── .gitignore ├── LICENSE ├── README.md ├── app-finished │ ├── .gitignore │ ├── build.gradle.kts │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── workprofile │ │ │ └── ExampleInstrumentedTest.kt │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── workprofile │ │ │ │ ├── ContactsAdapter.kt │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v24 │ │ │ ├── ic_launcher_foreground.xml │ │ │ └── ic_person_primary_40dp.xml │ │ │ ├── drawable │ │ │ ├── ic_launcher_background.xml │ │ │ └── ic_person_green_40dp.xml │ │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ └── contact_item_layout.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── workprofile │ │ └── ExampleUnitTest.kt ├── app-starter │ ├── .gitignore │ ├── build.gradle.kts │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── workprofile │ │ │ └── ExampleInstrumentedTest.kt │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── workprofile │ │ │ │ ├── ContactsAdapter.kt │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v24 │ │ │ ├── ic_launcher_foreground.xml │ │ │ └── ic_person_primary_40dp.xml │ │ │ ├── drawable │ │ │ ├── ic_launcher_background.xml │ │ │ └── ic_person_green_40dp.xml │ │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ └── contact_item_layout.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── workprofile │ │ └── ExampleUnitTest.kt ├── build.gradle.kts ├── gradle.properties ├── gradle │ ├── libs.versions.toml │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts └── renovate.json /.github/scripts/gradlew_recursive.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (C) 2020 The Android Open Source Project 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -xe 18 | 19 | # Default Gradle settings are not optimal for Android builds, override them 20 | # here to make the most out of the GitHub Actions build servers 21 | GRADLE_OPTS="$GRADLE_OPTS -Xms4g -Xmx4g" 22 | GRADLE_OPTS="$GRADLE_OPTS -XX:+HeapDumpOnOutOfMemoryError" 23 | GRADLE_OPTS="$GRADLE_OPTS -Dorg.gradle.daemon=false" 24 | GRADLE_OPTS="$GRADLE_OPTS -Dorg.gradle.workers.max=2" 25 | GRADLE_OPTS="$GRADLE_OPTS -Dkotlin.incremental=false" 26 | GRADLE_OPTS="$GRADLE_OPTS -Dkotlin.compiler.execution.strategy=in-process" 27 | GRADLE_OPTS="$GRADLE_OPTS -Dfile.encoding=UTF-8" 28 | export GRADLE_OPTS 29 | 30 | # Crawl all gradlew files which indicate an Android project 31 | # You may edit this if your repo has a different project structure 32 | for GRADLEW in `find . -name "gradlew"` ; do 33 | SAMPLE=$(dirname "${GRADLEW}") 34 | # Tell Gradle that this is a CI environment and disable parallel compilation 35 | bash "$GRADLEW" -p "$SAMPLE" -Pci --no-parallel --stacktrace $@ 36 | done 37 | -------------------------------------------------------------------------------- /.github/workflows/android.yml: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2020 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: Android CI 16 | 17 | on: 18 | workflow_dispatch: 19 | push: 20 | branches: [ main ] 21 | pull_request: 22 | branches: [ main ] 23 | 24 | jobs: 25 | 26 | build: 27 | name: Build 28 | runs-on: ubuntu-latest 29 | 30 | steps: 31 | - uses: actions/checkout@v2 32 | - name: set up JDK 21 33 | uses: actions/setup-java@v4 34 | with: 35 | distribution: 'jetbrains' 36 | java-version: '21' 37 | - name: Build project 38 | run: .github/scripts/gradlew_recursive.sh assembleDebug 39 | - name: Zip artifacts 40 | run: zip -r assemble.zip . -i '**/build/*.apk' '**/build/*.aab' '**/build/*.aar' '**/build/*.so' 41 | - name: Upload artifacts 42 | uses: actions/upload-artifact@v4 43 | with: 44 | name: assemble 45 | path: assemble.zip 46 | -------------------------------------------------------------------------------- /.github/workflows/copy-branch.yml: -------------------------------------------------------------------------------- 1 | # Duplicates default main branch to the old master branch 2 | 3 | name: Duplicates main to old master branch 4 | 5 | # Controls when the action will run. Triggers the workflow on push or pull request 6 | # events but only for the main branch 7 | on: 8 | workflow_dispatch: 9 | push: 10 | branches: [ main ] 11 | 12 | # Add this permissions block at the workflow level 13 | permissions: 14 | contents: write # Allows the GITHUB_TOKEN to write to the repository contents 15 | 16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 17 | jobs: 18 | # This workflow contains a single job called "copy-branch" 19 | copy-branch: 20 | # The type of runner that the job will run on 21 | runs-on: ubuntu-latest 22 | 23 | # Steps represent a sequence of tasks that will be executed as part of the job 24 | steps: 25 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it, 26 | # but specifies master branch (old default). 27 | - uses: actions/checkout@v2 28 | with: 29 | fetch-depth: 0 30 | ref: master 31 | 32 | - run: | 33 | git config user.name github-actions 34 | git config user.email github-actions@github.com 35 | git merge origin/main 36 | git push 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Mac files 6 | .DS_Store 7 | 8 | # files for the dex VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # generated files 15 | bin/ 16 | gen/ 17 | 18 | # Ignore gradle files 19 | .gradle/ 20 | build/ 21 | 22 | # Local configuration file (sdk path, etc) 23 | local.properties 24 | 25 | # Proguard folder generated by Eclipse 26 | proguard/ 27 | proguard-project.txt 28 | 29 | # Eclipse files 30 | .project 31 | .classpath 32 | .settings/ 33 | 34 | # Android Studio/IDEA 35 | *.iml 36 | .idea 37 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We'd love to accept your patches and contributions to this project. There are 4 | just a few small guidelines you need to follow. 5 | 6 | ## Contributor License Agreement 7 | 8 | Contributions to this project must be accompanied by a Contributor License 9 | Agreement. You (or your employer) retain the copyright to your contribution; 10 | this simply gives us permission to use and redistribute your contributions as 11 | part of the project. Head over to to see 12 | your current agreements on file or to sign a new one. 13 | 14 | You generally only need to submit a CLA once, so if you've already submitted one 15 | (even if it was for a different project), you probably don't need to do it 16 | again. 17 | 18 | ## Code reviews 19 | 20 | All submissions, including submissions by project members, require review. We 21 | use GitHub pull requests for this purpose. Consult 22 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more 23 | information on using pull requests. 24 | 25 | ## Community Guidelines 26 | 27 | This project follows 28 | [Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | Copyright [yyyy] [name of copyright owner] 179 | 180 | Licensed under the Apache License, Version 2.0 (the "License"); 181 | you may not use this file except in compliance with the License. 182 | You may obtain a copy of the License at 183 | 184 | http://www.apache.org/licenses/LICENSE-2.0 185 | 186 | Unless required by applicable law or agreed to in writing, software 187 | distributed under the License is distributed on an "AS IS" BASIS, 188 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 189 | See the License for the specific language governing permissions and 190 | limitations under the License. 191 | 192 | -------------------------------------------------------------------------------- /ManagedConfigurations/.google/packaging.yaml: -------------------------------------------------------------------------------- 1 | 2 | # GOOGLE SAMPLE PACKAGING DATA 3 | # 4 | # This file is used by Google as part of our samples packaging process. 5 | # End users may safely ignore this file. It has no relevance to other systems. 6 | --- 7 | status: PUBLISHED 8 | technologies: [Android] 9 | categories: [Enterprise] 10 | languages: [Java] 11 | solutions: [Mobile] 12 | github: android/enterprise 13 | level: ADVANCED 14 | icon: screenshots/big_icon.png 15 | apiRefs: 16 | - android:android.content.RestrictionsManager 17 | license: apache2 18 | -------------------------------------------------------------------------------- /ManagedConfigurations/README.md: -------------------------------------------------------------------------------- 1 | 2 | Android Managed Configuration Sample 3 | ==================================== 4 | 5 | A basic app showing how to allow a device administrator to configurate 6 | an application using the Android Device Administration API. 7 | The app exports a managed configuration that enables or disables a UI control. Device Administration applications are able to enforce a specific value for this policy, as directed by enterprise administrators. 8 | 9 | Introduction 10 | ------------ 11 | 12 | Managed configurations, previously known as application restrictions, allow the organization's IT admin to remotely specify settings for apps. This capability is particularly useful for organization-approved apps deployed to a work profile. 13 | 14 | For example, an organization might require that approved apps allow the IT admin to: 15 | 16 | * Allow or block URLs for a web browser 17 | * Configure whether an app is allowed to sync content via cellular, or just by Wi-Fi 18 | * Configure the app's email settings 19 | 20 | You can find additional information about Managed configurations in the [Set up managed configurations][1] article. 21 | 22 | * Screenshots 23 | 24 | Screenshot 25 | 26 | 27 | [1]: https://developer.android.com/work/managed-configurations 28 | 29 | Application Feedback 30 | -------------------- 31 | 32 | The sample application uses the Jetpack Enterprise's app feedback API to send a messages back to the EMM when a new configuration is received for a couple of the available options. 33 | 34 | Testing 35 | ------- 36 | 37 | The application can be tested locally using the TestDPC application available on the [Play Store][2] and on [github][3]. 38 | 39 | You can follow he guide on github to understand how to setup TestDPC on a device and how to update the manage configuration of this demo application when installed in an a managed profile. We're providing here a couple of animations to show this process: 40 | 41 | * Setup TestDPC 42 | 43 | Setup TestDPC 44 | 45 | * Update Managed Configurations 46 | 47 | Update Managed Configurations 48 | 49 | * Receive App Feedback 50 | 51 | Receive App Feedback 52 | 53 | [2]: https://play.google.com/store/apps/details?id=com.afwsamples.testdpc 54 | [3]: https://github.com/googlesamples/android-testdpc 55 | 56 | Pre-requisites 57 | -------------- 58 | 59 | - Android Studio Dolphin | 2021.3.1 60 | 61 | Getting Started 62 | --------------- 63 | 64 | This sample uses the Gradle build system. To build this project, use the 65 | "gradlew build" command or use "Import Project" in Android Studio. 66 | 67 | Support 68 | ------- 69 | 70 | - Stack Overflow: http://stackoverflow.com/questions/tagged/android 71 | 72 | If you've found an error in this sample, please file an issue: 73 | https://github.com/android/enterprise-samples/issues 74 | 75 | Patches are encouraged, and may be submitted by forking this project and 76 | submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. 77 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | plugins { 18 | alias(libs.plugins.android.application) 19 | alias(libs.plugins.kotlin.android) 20 | } 21 | 22 | android { 23 | namespace = "com.example.android.managedconfigurations" 24 | compileSdk = 35 25 | 26 | defaultConfig { 27 | applicationId = "com.example.android.managedconfigurations" 28 | minSdk = 21 29 | targetSdk = 35 30 | versionCode = 1 31 | versionName = "1.0" 32 | 33 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 34 | } 35 | 36 | buildTypes { 37 | release { 38 | isMinifyEnabled = false 39 | proguardFiles( 40 | getDefaultProguardFile("proguard-android-optimize.txt"), 41 | "proguard-rules.pro" 42 | ) 43 | } 44 | } 45 | compileOptions { 46 | sourceCompatibility = JavaVersion.VERSION_11 47 | targetCompatibility = JavaVersion.VERSION_11 48 | } 49 | kotlinOptions { 50 | jvmTarget = "11" 51 | } 52 | buildFeatures { 53 | viewBinding = true 54 | } 55 | } 56 | 57 | dependencies { 58 | implementation(libs.androidx.core.ktx) 59 | implementation(libs.androidx.appcompat) 60 | implementation(libs.material) 61 | implementation(libs.androidx.activity) 62 | implementation(libs.androidx.constraintlayout) 63 | implementation(libs.jetbrains.kotlin.stdlib.jdk7) 64 | implementation(libs.androidx.enterprise.feedback) 65 | // For testing enterprise feedback in isolation 66 | testImplementation(libs.androidx.enterprise.feedback.testing) 67 | testImplementation(libs.junit) 68 | androidTestImplementation(libs.androidx.junit) 69 | androidTestImplementation(libs.androidx.espresso.core) 70 | } 71 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | 28 | 29 | 32 | 33 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/java/com/example/android/common/activities/SampleActivityBase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.android.common.activities 17 | 18 | import androidx.appcompat.app.AppCompatActivity 19 | import com.example.android.common.logger.Log 20 | import com.example.android.common.logger.LogWrapper 21 | 22 | /** 23 | * Base launcher activity, to handle most of the common plumbing for samples. 24 | */ 25 | abstract class SampleActivityBase : AppCompatActivity() { 26 | 27 | override fun onStart() { 28 | super.onStart() 29 | initializeLogging() 30 | } 31 | 32 | /** 33 | * Set up targets to receive log data 34 | */ 35 | open fun initializeLogging() { 36 | // Using Log, front-end to the logging chain, emulates android.util.log method signatures. 37 | // Wraps Android's native log framework 38 | val logWrapper = LogWrapper() 39 | Log.setLogNode(logWrapper) 40 | Log.i(TAG, "Ready") 41 | } 42 | 43 | companion object { 44 | const val TAG = "SampleActivityBase" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/java/com/example/android/common/logger/Log.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.android.common.logger; 17 | 18 | /** 19 | * Helper class for a list (or tree) of LoggerNodes. 20 | * 21 | *

When this is set as the head of the list, 22 | * an instance of it can function as a drop-in replacement for {@link android.util.Log}. 23 | * Most of the methods in this class server only to map a method call in Log to its equivalent 24 | * in LogNode.

25 | */ 26 | public class Log { 27 | // Grabbing the native values from Android's native logging facilities, 28 | // to make for easy migration and interop. 29 | public static final int NONE = -1; 30 | public static final int VERBOSE = android.util.Log.VERBOSE; 31 | public static final int DEBUG = android.util.Log.DEBUG; 32 | public static final int INFO = android.util.Log.INFO; 33 | public static final int WARN = android.util.Log.WARN; 34 | public static final int ERROR = android.util.Log.ERROR; 35 | public static final int ASSERT = android.util.Log.ASSERT; 36 | 37 | // Stores the beginning of the LogNode topology. 38 | private static LogNode mLogNode; 39 | 40 | /** 41 | * Returns the next LogNode in the linked list. 42 | */ 43 | public static LogNode getLogNode() { 44 | return mLogNode; 45 | } 46 | 47 | /** 48 | * Sets the LogNode data will be sent to. 49 | */ 50 | public static void setLogNode(LogNode node) { 51 | mLogNode = node; 52 | } 53 | 54 | /** 55 | * Instructs the LogNode to print the log data provided. Other LogNodes can 56 | * be chained to the end of the LogNode as desired. 57 | * 58 | * @param priority Log level of the data being logged. Verbose, Error, etc. 59 | * @param tag Tag for for the log data. Can be used to organize log statements. 60 | * @param msg The actual message to be logged. 61 | * @param tr If an exception was thrown, this can be sent along for the logging facilities 62 | * to extract and print useful information. 63 | */ 64 | public static void println(int priority, String tag, String msg, Throwable tr) { 65 | if (mLogNode != null) { 66 | mLogNode.println(priority, tag, msg, tr); 67 | } 68 | } 69 | 70 | /** 71 | * Instructs the LogNode to print the log data provided. Other LogNodes can 72 | * be chained to the end of the LogNode as desired. 73 | * 74 | * @param priority Log level of the data being logged. Verbose, Error, etc. 75 | * @param tag Tag for for the log data. Can be used to organize log statements. 76 | * @param msg The actual message to be logged. The actual message to be logged. 77 | */ 78 | public static void println(int priority, String tag, String msg) { 79 | println(priority, tag, msg, null); 80 | } 81 | 82 | /** 83 | * Prints a message at VERBOSE priority. 84 | * 85 | * @param tag Tag for for the log data. Can be used to organize log statements. 86 | * @param msg The actual message to be logged. 87 | * @param tr If an exception was thrown, this can be sent along for the logging facilities 88 | * to extract and print useful information. 89 | */ 90 | public static void v(String tag, String msg, Throwable tr) { 91 | println(VERBOSE, tag, msg, tr); 92 | } 93 | 94 | /** 95 | * Prints a message at VERBOSE priority. 96 | * 97 | * @param tag Tag for for the log data. Can be used to organize log statements. 98 | * @param msg The actual message to be logged. 99 | */ 100 | public static void v(String tag, String msg) { 101 | v(tag, msg, null); 102 | } 103 | 104 | 105 | /** 106 | * Prints a message at DEBUG priority. 107 | * 108 | * @param tag Tag for for the log data. Can be used to organize log statements. 109 | * @param msg The actual message to be logged. 110 | * @param tr If an exception was thrown, this can be sent along for the logging facilities 111 | * to extract and print useful information. 112 | */ 113 | public static void d(String tag, String msg, Throwable tr) { 114 | println(DEBUG, tag, msg, tr); 115 | } 116 | 117 | /** 118 | * Prints a message at DEBUG priority. 119 | * 120 | * @param tag Tag for for the log data. Can be used to organize log statements. 121 | * @param msg The actual message to be logged. 122 | */ 123 | public static void d(String tag, String msg) { 124 | d(tag, msg, null); 125 | } 126 | 127 | /** 128 | * Prints a message at INFO priority. 129 | * 130 | * @param tag Tag for for the log data. Can be used to organize log statements. 131 | * @param msg The actual message to be logged. 132 | * @param tr If an exception was thrown, this can be sent along for the logging facilities 133 | * to extract and print useful information. 134 | */ 135 | public static void i(String tag, String msg, Throwable tr) { 136 | println(INFO, tag, msg, tr); 137 | } 138 | 139 | /** 140 | * Prints a message at INFO priority. 141 | * 142 | * @param tag Tag for for the log data. Can be used to organize log statements. 143 | * @param msg The actual message to be logged. 144 | */ 145 | public static void i(String tag, String msg) { 146 | i(tag, msg, null); 147 | } 148 | 149 | /** 150 | * Prints a message at WARN priority. 151 | * 152 | * @param tag Tag for for the log data. Can be used to organize log statements. 153 | * @param msg The actual message to be logged. 154 | * @param tr If an exception was thrown, this can be sent along for the logging facilities 155 | * to extract and print useful information. 156 | */ 157 | public static void w(String tag, String msg, Throwable tr) { 158 | println(WARN, tag, msg, tr); 159 | } 160 | 161 | /** 162 | * Prints a message at WARN priority. 163 | * 164 | * @param tag Tag for for the log data. Can be used to organize log statements. 165 | * @param msg The actual message to be logged. 166 | */ 167 | public static void w(String tag, String msg) { 168 | w(tag, msg, null); 169 | } 170 | 171 | /** 172 | * Prints a message at WARN priority. 173 | * 174 | * @param tag Tag for for the log data. Can be used to organize log statements. 175 | * @param tr If an exception was thrown, this can be sent along for the logging facilities 176 | * to extract and print useful information. 177 | */ 178 | public static void w(String tag, Throwable tr) { 179 | w(tag, null, tr); 180 | } 181 | 182 | /** 183 | * Prints a message at ERROR priority. 184 | * 185 | * @param tag Tag for for the log data. Can be used to organize log statements. 186 | * @param msg The actual message to be logged. 187 | * @param tr If an exception was thrown, this can be sent along for the logging facilities 188 | * to extract and print useful information. 189 | */ 190 | public static void e(String tag, String msg, Throwable tr) { 191 | println(ERROR, tag, msg, tr); 192 | } 193 | 194 | /** 195 | * Prints a message at ERROR priority. 196 | * 197 | * @param tag Tag for for the log data. Can be used to organize log statements. 198 | * @param msg The actual message to be logged. 199 | */ 200 | public static void e(String tag, String msg) { 201 | e(tag, msg, null); 202 | } 203 | 204 | /** 205 | * Prints a message at ASSERT priority. 206 | * 207 | * @param tag Tag for for the log data. Can be used to organize log statements. 208 | * @param msg The actual message to be logged. 209 | * @param tr If an exception was thrown, this can be sent along for the logging facilities 210 | * to extract and print useful information. 211 | */ 212 | public static void wtf(String tag, String msg, Throwable tr) { 213 | println(ASSERT, tag, msg, tr); 214 | } 215 | 216 | /** 217 | * Prints a message at ASSERT priority. 218 | * 219 | * @param tag Tag for for the log data. Can be used to organize log statements. 220 | * @param msg The actual message to be logged. 221 | */ 222 | public static void wtf(String tag, String msg) { 223 | wtf(tag, msg, null); 224 | } 225 | 226 | /** 227 | * Prints a message at ASSERT priority. 228 | * 229 | * @param tag Tag for for the log data. Can be used to organize log statements. 230 | * @param tr If an exception was thrown, this can be sent along for the logging facilities 231 | * to extract and print useful information. 232 | */ 233 | public static void wtf(String tag, Throwable tr) { 234 | wtf(tag, null, tr); 235 | } 236 | } 237 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/java/com/example/android/common/logger/LogFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | package com.example.android.common.logger; 19 | 20 | import android.graphics.Typeface; 21 | import android.os.Build; 22 | import android.os.Bundle; 23 | import androidx.fragment.app.Fragment; 24 | import android.text.Editable; 25 | import android.text.TextWatcher; 26 | import android.view.Gravity; 27 | import android.view.LayoutInflater; 28 | import android.view.View; 29 | import android.view.ViewGroup; 30 | import android.widget.ScrollView; 31 | 32 | /** 33 | * Simple fraggment which contains a LogView and uses is to output log data it receives 34 | * through the LogNode interface. 35 | */ 36 | public class LogFragment extends Fragment { 37 | 38 | private LogView mLogView; 39 | private ScrollView mScrollView; 40 | 41 | public LogFragment() {} 42 | 43 | @SuppressWarnings("deprecation") 44 | public View inflateViews() { 45 | mScrollView = new ScrollView(getActivity()); 46 | ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams( 47 | ViewGroup.LayoutParams.MATCH_PARENT, 48 | ViewGroup.LayoutParams.MATCH_PARENT); 49 | mScrollView.setLayoutParams(scrollParams); 50 | 51 | mLogView = new LogView(getActivity()); 52 | ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams); 53 | logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT; 54 | mLogView.setLayoutParams(logParams); 55 | mLogView.setClickable(true); 56 | mLogView.setFocusable(true); 57 | mLogView.setTypeface(Typeface.MONOSPACE); 58 | 59 | // Want to set padding as 16 dips, setPadding takes pixels. Hooray math! 60 | int paddingDips = 16; 61 | double scale = getResources().getDisplayMetrics().density; 62 | int paddingPixels = (int) ((paddingDips * (scale)) + .5); 63 | mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels); 64 | mLogView.setCompoundDrawablePadding(paddingPixels); 65 | 66 | mLogView.setGravity(Gravity.BOTTOM); 67 | if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 68 | mLogView.setTextAppearance(android.R.style.TextAppearance_Holo_Medium); 69 | } else { 70 | mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium); 71 | } 72 | 73 | mScrollView.addView(mLogView); 74 | return mScrollView; 75 | } 76 | 77 | @Override 78 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 79 | Bundle savedInstanceState) { 80 | 81 | View result = inflateViews(); 82 | 83 | mLogView.addTextChangedListener(new TextWatcher() { 84 | @Override 85 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {} 86 | 87 | @Override 88 | public void onTextChanged(CharSequence s, int start, int before, int count) {} 89 | 90 | @Override 91 | public void afterTextChanged(Editable s) { 92 | mScrollView.fullScroll(ScrollView.FOCUS_DOWN); 93 | } 94 | }); 95 | return result; 96 | } 97 | 98 | public LogView getLogView() { 99 | return mLogView; 100 | } 101 | } -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/java/com/example/android/common/logger/LogNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.android.common.logger; 17 | 18 | /** 19 | * Basic interface for a logging system that can output to one or more targets. 20 | * Note that in addition to classes that will output these logs in some format, 21 | * one can also implement this interface over a filter and insert that in the chain, 22 | * such that no targets further down see certain data, or see manipulated forms of the data. 23 | * You could, for instance, write a "ToHtmlLoggerNode" that just converted all the log data 24 | * it received to HTML and sent it along to the next node in the chain, without printing it 25 | * anywhere. 26 | */ 27 | public interface LogNode { 28 | 29 | /** 30 | * Instructs first LogNode in the list to print the log data provided. 31 | * @param priority Log level of the data being logged. Verbose, Error, etc. 32 | * @param tag Tag for for the log data. Can be used to organize log statements. 33 | * @param msg The actual message to be logged. The actual message to be logged. 34 | * @param tr If an exception was thrown, this can be sent along for the logging facilities 35 | * to extract and print useful information. 36 | */ 37 | public void println(int priority, String tag, String msg, Throwable tr); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/java/com/example/android/common/logger/LogView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.android.common.logger; 17 | 18 | import android.app.Activity; 19 | import android.content.Context; 20 | import android.util.AttributeSet; 21 | import androidx.appcompat.widget.AppCompatTextView; 22 | 23 | /** Simple TextView which is used to output log data received through the LogNode interface. 24 | */ 25 | public class LogView extends AppCompatTextView implements LogNode { 26 | 27 | public LogView(Context context) { 28 | super(context); 29 | } 30 | 31 | public LogView(Context context, AttributeSet attrs) { 32 | super(context, attrs); 33 | } 34 | 35 | public LogView(Context context, AttributeSet attrs, int defStyle) { 36 | super(context, attrs, defStyle); 37 | } 38 | 39 | /** 40 | * Formats the log data and prints it out to the LogView. 41 | * @param priority Log level of the data being logged. Verbose, Error, etc. 42 | * @param tag Tag for for the log data. Can be used to organize log statements. 43 | * @param msg The actual message to be logged. The actual message to be logged. 44 | * @param tr If an exception was thrown, this can be sent along for the logging facilities 45 | * to extract and print useful information. 46 | */ 47 | @Override 48 | public void println(int priority, String tag, String msg, Throwable tr) { 49 | 50 | 51 | String priorityStr = null; 52 | 53 | // For the purposes of this View, we want to print the priority as readable text. 54 | switch(priority) { 55 | case android.util.Log.VERBOSE: 56 | priorityStr = "VERBOSE"; 57 | break; 58 | case android.util.Log.DEBUG: 59 | priorityStr = "DEBUG"; 60 | break; 61 | case android.util.Log.INFO: 62 | priorityStr = "INFO"; 63 | break; 64 | case android.util.Log.WARN: 65 | priorityStr = "WARN"; 66 | break; 67 | case android.util.Log.ERROR: 68 | priorityStr = "ERROR"; 69 | break; 70 | case android.util.Log.ASSERT: 71 | priorityStr = "ASSERT"; 72 | break; 73 | default: 74 | break; 75 | } 76 | 77 | // Handily, the Log class has a facility for converting a stack trace into a usable string. 78 | String exceptionStr = null; 79 | if (tr != null) { 80 | exceptionStr = android.util.Log.getStackTraceString(tr); 81 | } 82 | 83 | // Take the priority, tag, message, and exception, and concatenate as necessary 84 | // into one usable line of text. 85 | final StringBuilder outputBuilder = new StringBuilder(); 86 | 87 | String delimiter = "\t"; 88 | appendIfNotNull(outputBuilder, priorityStr, delimiter); 89 | appendIfNotNull(outputBuilder, tag, delimiter); 90 | appendIfNotNull(outputBuilder, msg, delimiter); 91 | appendIfNotNull(outputBuilder, exceptionStr, delimiter); 92 | 93 | // In case this was originally called from an AsyncTask or some other off-UI thread, 94 | // make sure the update occurs within the UI thread. 95 | ((Activity) getContext()).runOnUiThread( (new Thread(new Runnable() { 96 | @Override 97 | public void run() { 98 | // Display the text we just generated within the LogView. 99 | appendToLog(outputBuilder.toString()); 100 | } 101 | }))); 102 | 103 | if (mNext != null) { 104 | mNext.println(priority, tag, msg, tr); 105 | } 106 | } 107 | 108 | public LogNode getNext() { 109 | return mNext; 110 | } 111 | 112 | public void setNext(LogNode node) { 113 | mNext = node; 114 | } 115 | 116 | /** Takes a string and adds to it, with a separator, if the bit to be added isn't null. Since 117 | * the logger takes so many arguments that might be null, this method helps cut out some of the 118 | * agonizing tedium of writing the same 3 lines over and over. 119 | * @param source StringBuilder containing the text to append to. 120 | * @param addStr The String to append 121 | * @param delimiter The String to separate the source and appended strings. A tab or comma, 122 | * for instance. 123 | * @return The fully concatenated String as a StringBuilder 124 | */ 125 | private StringBuilder appendIfNotNull(StringBuilder source, String addStr, String delimiter) { 126 | if (addStr != null) { 127 | if (addStr.length() == 0) { 128 | delimiter = ""; 129 | } 130 | 131 | return source.append(addStr).append(delimiter); 132 | } 133 | return source; 134 | } 135 | 136 | // The next LogNode in the chain. 137 | LogNode mNext; 138 | 139 | /** Outputs the string as a new line of log data in the LogView. */ 140 | public void appendToLog(String s) { 141 | append("\n" + s); 142 | } 143 | 144 | 145 | } 146 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/java/com/example/android/common/logger/LogWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.android.common.logger; 17 | 18 | import android.util.Log; 19 | 20 | /** 21 | * Helper class which wraps Android's native Log utility in the Logger interface. This way 22 | * normal DDMS output can be one of the many targets receiving and outputting logs simultaneously. 23 | */ 24 | public class LogWrapper implements LogNode { 25 | 26 | // For piping: The next node to receive Log data after this one has done its work. 27 | private LogNode mNext; 28 | 29 | /** 30 | * Returns the next LogNode in the linked list. 31 | */ 32 | public LogNode getNext() { 33 | return mNext; 34 | } 35 | 36 | /** 37 | * Sets the LogNode data will be sent to.. 38 | */ 39 | public void setNext(LogNode node) { 40 | mNext = node; 41 | } 42 | 43 | /** 44 | * Prints data out to the console using Android's native log mechanism. 45 | * @param priority Log level of the data being logged. Verbose, Error, etc. 46 | * @param tag Tag for for the log data. Can be used to organize log statements. 47 | * @param msg The actual message to be logged. The actual message to be logged. 48 | * @param tr If an exception was thrown, this can be sent along for the logging facilities 49 | * to extract and print useful information. 50 | */ 51 | @Override 52 | public void println(int priority, String tag, String msg, Throwable tr) { 53 | // There actually are log methods that don't take a msg parameter. For now, 54 | // if that's the case, just convert null to the empty string and move on. 55 | String useMsg = msg; 56 | if (useMsg == null) { 57 | useMsg = ""; 58 | } 59 | 60 | // If an exeption was provided, convert that exception to a usable string and attach 61 | // it to the end of the msg method. 62 | if (tr != null) { 63 | msg += "\n" + Log.getStackTraceString(tr); 64 | } 65 | 66 | // This is functionally identical to Log.x(tag, useMsg); 67 | // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) 68 | Log.println(priority, tag, useMsg); 69 | 70 | // If this isn't the last node in the chain, move things along. 71 | if (mNext != null) { 72 | mNext.println(priority, tag, msg, tr); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.android.common.logger; 17 | 18 | /** 19 | * Simple {@link LogNode} filter, removes everything except the message. 20 | * Useful for situations like on-screen log output where you don't want a lot of metadata displayed, 21 | * just easy-to-read message updates as they're happening. 22 | */ 23 | public class MessageOnlyLogFilter implements LogNode { 24 | 25 | LogNode mNext; 26 | 27 | /** 28 | * Takes the "next" LogNode as a parameter, to simplify chaining. 29 | * 30 | * @param next The next LogNode in the pipeline. 31 | */ 32 | public MessageOnlyLogFilter(LogNode next) { 33 | mNext = next; 34 | } 35 | 36 | public MessageOnlyLogFilter() { 37 | } 38 | 39 | @Override 40 | public void println(int priority, String tag, String msg, Throwable tr) { 41 | if (mNext != null) { 42 | getNext().println(Log.NONE, null, msg, null); 43 | } 44 | } 45 | 46 | /** 47 | * Returns the next LogNode in the chain. 48 | */ 49 | public LogNode getNext() { 50 | return mNext; 51 | } 52 | 53 | /** 54 | * Sets the LogNode data will be sent to.. 55 | */ 56 | public void setNext(LogNode node) { 57 | mNext = node; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/java/com/example/android/managedconfigurations/EnterpriseReporter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.example.android.managedconfigurations 18 | 19 | import android.content.Context 20 | import android.util.Log 21 | import androidx.enterprise.feedback.KeyedAppState 22 | import androidx.enterprise.feedback.KeyedAppStatesCallback 23 | import androidx.enterprise.feedback.KeyedAppStatesCallback.STATUS_EXCEEDED_BUFFER_ERROR 24 | import androidx.enterprise.feedback.KeyedAppStatesCallback.STATUS_SUCCESS 25 | import androidx.enterprise.feedback.KeyedAppStatesCallback.STATUS_TRANSACTION_TOO_LARGE_ERROR 26 | import androidx.enterprise.feedback.KeyedAppStatesCallback.STATUS_UNKNOWN_ERROR 27 | import androidx.enterprise.feedback.KeyedAppStatesReporter 28 | 29 | /** 30 | * Sends feedback to device management apps. 31 | */ 32 | fun Context.enterpriseFeedback( 33 | key: String, 34 | message: String, 35 | data: String, 36 | severity: Int = KeyedAppState.SEVERITY_ERROR 37 | ) { 38 | val keyedAppStatesReporter = KeyedAppStatesReporter.create(this) 39 | val keyedAppStateMessage = KeyedAppState.builder() 40 | .setSeverity(severity) 41 | .setKey(key) 42 | .setMessage(message) 43 | .setData(data) 44 | .build() 45 | val list: MutableList = ArrayList() 46 | list.add(keyedAppStateMessage) 47 | keyedAppStatesReporter.setStates(list, Callback()) 48 | } 49 | 50 | internal class Callback : KeyedAppStatesCallback { 51 | override fun onResult(state: Int, throwable: Throwable?) { 52 | when (state) { 53 | STATUS_SUCCESS -> 54 | Log.i("ErrorReporter", "KeyedAppStatesCallback status: SUCCESS ") 55 | STATUS_UNKNOWN_ERROR -> 56 | Log.i("ErrorReporter", "KeyedAppStatesCallback status: UNKNOWN_ERROR ") 57 | STATUS_TRANSACTION_TOO_LARGE_ERROR -> 58 | Log.i("ErrorReporter", "KeyedAppStatesCallback status: TRANSACTION_TOO_LARGE_ERROR ") 59 | STATUS_EXCEEDED_BUFFER_ERROR -> 60 | Log.i("ErrorReporter", "KeyedAppStatesCallback status: EXCEEDED_BUFFER_ERROR ") 61 | else -> 62 | Log.i("ErrorReporter", "KeyedAppStatesCallback status: $state ") 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/java/com/example/android/managedconfigurations/MainActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.android.managedconfigurations 17 | 18 | import android.os.Bundle 19 | import android.view.Menu 20 | import android.view.MenuItem 21 | import android.widget.ViewAnimator 22 | import androidx.activity.enableEdgeToEdge 23 | import androidx.core.view.ViewCompat 24 | import androidx.core.view.WindowInsetsCompat 25 | import com.example.android.managedconfigurations.databinding.ActivityMainBinding 26 | import com.example.android.common.activities.SampleActivityBase 27 | import com.example.android.common.logger.Log 28 | import com.example.android.common.logger.LogFragment 29 | import com.example.android.common.logger.LogWrapper 30 | import com.example.android.common.logger.MessageOnlyLogFilter 31 | 32 | /** 33 | * A simple launcher activity containing a summary sample description, sample log and a custom 34 | * [Fragment] which can display a view. 35 | * 36 | * 37 | * For devices with displays with a width of 720dp or greater, the sample log is always visible, 38 | * on other devices it's visibility is controlled by an item on the Action Bar. 39 | */ 40 | class MainActivity : SampleActivityBase() { 41 | // Whether the Log Fragment is currently shown 42 | private var logShown = false 43 | 44 | private lateinit var binding: ActivityMainBinding 45 | 46 | override fun onCreate(savedInstanceState: Bundle?) { 47 | super.onCreate(savedInstanceState) 48 | enableEdgeToEdge() 49 | binding = ActivityMainBinding.inflate(layoutInflater) 50 | setContentView(binding.root) 51 | ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, insets -> 52 | val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) 53 | v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) 54 | insets 55 | } 56 | if (savedInstanceState == null) { 57 | val transaction = supportFragmentManager.beginTransaction() 58 | val fragment = ManagedConfigurationsFragment() 59 | transaction.replace(R.id.sample_content_fragment, fragment) 60 | transaction.commit() 61 | } 62 | } 63 | 64 | override fun onCreateOptionsMenu(menu: Menu): Boolean { 65 | menuInflater.inflate(R.menu.main, menu) 66 | return true 67 | } 68 | 69 | override fun onPrepareOptionsMenu(menu: Menu): Boolean { 70 | val logToggle = menu.findItem(R.id.menu_toggle_log) 71 | logToggle.isVisible = binding.sampleOutput is ViewAnimator 72 | logToggle.setTitle(if (logShown) R.string.sample_hide_log else R.string.sample_show_log) 73 | return super.onPrepareOptionsMenu(menu) 74 | } 75 | 76 | override fun onOptionsItemSelected(item: MenuItem) = 77 | when (item.itemId) { 78 | R.id.menu_toggle_log -> { 79 | logShown = !logShown 80 | val output = binding.sampleOutput as ViewAnimator 81 | output.displayedChild = if (logShown) { 82 | 1 83 | } else { 84 | 0 85 | } 86 | invalidateOptionsMenu() 87 | true 88 | } 89 | else -> super.onOptionsItemSelected(item) 90 | } 91 | 92 | /** 93 | * Create a chain of targets that will receive log data 94 | */ 95 | override fun initializeLogging() { 96 | // Wraps Android's native log framework. 97 | val logWrapper = LogWrapper() 98 | // Using Log, front-end to the logging chain, emulates android.util.log method signatures. 99 | Log.setLogNode(logWrapper) 100 | 101 | // Filter strips out everything except the message text. 102 | val msgFilter = MessageOnlyLogFilter() 103 | logWrapper.next = msgFilter 104 | 105 | // On screen logging via a fragment with a TextView. 106 | val logFragment = supportFragmentManager 107 | .findFragmentById(R.id.log_fragment) as LogFragment? 108 | logFragment?.let { 109 | msgFilter.next = logFragment.logView 110 | Log.i(TAG, "Ready") 111 | } 112 | } 113 | 114 | companion object { 115 | const val TAG = "MainActivity" 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/java/com/example/android/managedconfigurations/ManagedConfigurationsFragment.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.example.android.managedconfigurations 17 | 18 | import android.content.BroadcastReceiver 19 | import android.content.Context 20 | import android.content.Intent 21 | import android.content.IntentFilter 22 | import android.content.RestrictionEntry 23 | import android.content.RestrictionsManager 24 | import android.os.Build 25 | import android.os.Bundle 26 | import android.view.LayoutInflater 27 | import android.view.View 28 | import android.view.ViewGroup 29 | import android.widget.Toast 30 | import androidx.fragment.app.Fragment 31 | import com.example.android.managedconfigurations.databinding.FragmentManagedConfigurationsBinding 32 | import com.example.android.common.logger.Log 33 | import java.lang.StringBuilder 34 | 35 | /** 36 | * Pressing the button on this fragment pops up a simple Toast message. The button is enabled or 37 | * disabled according to the restrictions set by device/profile owner. You can use the 38 | * AppRestrictionEnforcer sample as a profile owner for this. 39 | */ 40 | class ManagedConfigurationsFragment : Fragment(), View.OnClickListener { 41 | // Message to show when the button is clicked (String restriction) 42 | private var message: String? = null 43 | 44 | // Observes restriction changes 45 | private var broadcastReceiver: BroadcastReceiver? = null 46 | 47 | private var _binding: FragmentManagedConfigurationsBinding? = null 48 | 49 | // This property is only valid between onCreateView and onDestroyView. 50 | private val binding get() = _binding!! 51 | 52 | override fun onCreateView( 53 | inflater: LayoutInflater, 54 | container: ViewGroup?, 55 | savedInstanceState: Bundle? 56 | ): View { 57 | _binding = FragmentManagedConfigurationsBinding.inflate(inflater, container, false) 58 | return binding.root 59 | } 60 | 61 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 62 | binding.sayHello.setOnClickListener(this) 63 | if (BUNDLE_SUPPORTED) { 64 | binding.yourItems.visibility = View.VISIBLE 65 | } else { 66 | binding.yourItems.visibility = View.GONE 67 | } 68 | } 69 | 70 | override fun onResume() { 71 | super.onResume() 72 | resolveRestrictions() 73 | } 74 | 75 | override fun onStart() { 76 | super.onStart() 77 | broadcastReceiver = object : BroadcastReceiver() { 78 | override fun onReceive(context: Context, intent: Intent) { 79 | resolveRestrictions() 80 | } 81 | } 82 | requireActivity().registerReceiver( 83 | broadcastReceiver, 84 | IntentFilter(Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED) 85 | ) 86 | } 87 | 88 | override fun onStop() { 89 | super.onStop() 90 | if (broadcastReceiver != null) { 91 | requireActivity().unregisterReceiver(broadcastReceiver) 92 | broadcastReceiver = null 93 | } 94 | } 95 | 96 | override fun onDestroyView() { 97 | super.onDestroyView() 98 | _binding = null 99 | } 100 | 101 | private fun resolveRestrictions() { 102 | val manager = 103 | requireActivity().getSystemService(Context.RESTRICTIONS_SERVICE) as RestrictionsManager 104 | val restrictions = manager.applicationRestrictions 105 | val entries = manager.getManifestRestrictions( 106 | requireActivity().applicationContext.packageName 107 | ) 108 | 109 | for (entry in entries) { 110 | val key = entry.key 111 | Log.d(TAG, "key: $key") 112 | when (key) { 113 | KEY_CAN_SAY_HELLO -> { 114 | updateCanSayHello(entry, restrictions) 115 | } 116 | KEY_MESSAGE -> { 117 | updateMessage(entry, restrictions) 118 | } 119 | KEY_NUMBER -> { 120 | updateNumber(entry, restrictions) 121 | } 122 | KEY_RANK -> { 123 | updateRank(entry, restrictions) 124 | } 125 | KEY_APPROVALS -> { 126 | updateApprovals(entry, restrictions) 127 | } 128 | KEY_ITEMS -> { 129 | updateItems(restrictions) 130 | } 131 | } 132 | } 133 | } 134 | 135 | private fun updateCanSayHello(entry: RestrictionEntry, restrictions: Bundle?) { 136 | val canSayHello = 137 | if (restrictions == null || !restrictions.containsKey(KEY_CAN_SAY_HELLO)) { 138 | entry.selectedState 139 | } else { 140 | restrictions.getBoolean(KEY_CAN_SAY_HELLO) 141 | } 142 | activity?.enterpriseFeedback(KEY_CAN_SAY_HELLO, "Value is $canSayHello", "$canSayHello") 143 | binding.sayHello.setText( 144 | if (canSayHello) { 145 | R.string.explanation_can_say_hello_true 146 | } else { 147 | R.string.explanation_can_say_hello_false 148 | } 149 | ) 150 | binding.sayHello.isEnabled = canSayHello 151 | } 152 | 153 | private fun updateMessage(entry: RestrictionEntry, restrictions: Bundle?) { 154 | message = 155 | if (restrictions == null || !restrictions.containsKey(KEY_MESSAGE)) { 156 | entry.selectedString 157 | } else { 158 | restrictions.getString(KEY_MESSAGE) 159 | } 160 | activity?.enterpriseFeedback(KEY_MESSAGE, "Value is $message", "$message") 161 | } 162 | 163 | private fun updateNumber(entry: RestrictionEntry, restrictions: Bundle?) { 164 | val number = if (restrictions == null || !restrictions.containsKey(KEY_NUMBER)) { 165 | entry.intValue 166 | } else { 167 | restrictions.getInt(KEY_NUMBER) 168 | } 169 | binding.yourNumber.text = getString(R.string.your_number, number) 170 | } 171 | 172 | private fun updateRank(entry: RestrictionEntry, restrictions: Bundle?) { 173 | val rank = if (restrictions == null || !restrictions.containsKey(KEY_RANK)) { 174 | entry.selectedString 175 | } else { 176 | restrictions.getString(KEY_RANK) 177 | } 178 | binding.yourRank.text = getString(R.string.your_rank, rank) 179 | } 180 | 181 | private fun updateApprovals(entry: RestrictionEntry, restrictions: Bundle?) { 182 | val approvals = if (restrictions == null || !restrictions.containsKey(KEY_APPROVALS)) { 183 | entry.allSelectedStrings 184 | } else { 185 | restrictions.getStringArray(KEY_APPROVALS) 186 | } 187 | val text: String = if (approvals.isNullOrEmpty()) { 188 | getString(R.string.none) 189 | } else { 190 | approvals.joinToString(", ") 191 | } 192 | binding.approvalsYouHave.text = getString(R.string.approvals_you_have, text) 193 | } 194 | 195 | private fun updateItems(restrictions: Bundle?) { 196 | if (!BUNDLE_SUPPORTED) { 197 | return 198 | } 199 | val builder = StringBuilder() 200 | if (restrictions != null) { 201 | val parcelables = restrictions.getParcelableArray(KEY_ITEMS) 202 | if (!parcelables.isNullOrEmpty()) { 203 | val items = arrayOfNulls(parcelables.size) 204 | for (i in parcelables.indices) { 205 | items[i] = parcelables[i] as Bundle 206 | } 207 | var first = true 208 | for (item in items) { 209 | if (!item!!.containsKey(KEY_ITEM_KEY) || !item.containsKey(KEY_ITEM_VALUE)) { 210 | continue 211 | } 212 | if (first) { 213 | first = false 214 | } else { 215 | builder.append(", ") 216 | } 217 | builder.append(item.getString(KEY_ITEM_KEY)) 218 | builder.append(":") 219 | builder.append(item.getString(KEY_ITEM_VALUE)) 220 | } 221 | } else { 222 | builder.append(getString(R.string.none)) 223 | } 224 | } else { 225 | builder.append(getString(R.string.none)) 226 | } 227 | binding.yourItems.text = getString(R.string.your_items, builder) 228 | } 229 | 230 | override fun onClick(view: View) { 231 | when (view.id) { 232 | R.id.say_hello -> { 233 | Toast.makeText( 234 | activity, 235 | getString(R.string.message, message), 236 | Toast.LENGTH_SHORT 237 | ).show() 238 | } 239 | } 240 | } 241 | 242 | companion object { 243 | // Tag for the logger 244 | private const val TAG = "ManagedConfigurations" 245 | private const val KEY_CAN_SAY_HELLO = "can_say_hello" 246 | private const val KEY_MESSAGE = "message" 247 | private const val KEY_NUMBER = "number" 248 | private const val KEY_RANK = "rank" 249 | private const val KEY_APPROVALS = "approvals" 250 | private const val KEY_ITEMS = "items" 251 | private const val KEY_ITEM_KEY = "key" 252 | private const val KEY_ITEM_VALUE = "value" 253 | private val BUNDLE_SUPPORTED = Build.VERSION.SDK_INT >= 23 254 | } 255 | } 256 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/res/drawable-hdpi/tile.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/enterprise-samples/d3ac0d67c0c73d487b350d811da04913d546e0f6/ManagedConfigurations/app/src/main/res/drawable-hdpi/tile.9.png -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/res/layout-w720dp/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 23 | 24 | 30 | 31 | 35 | 36 | 45 | 46 | 47 | 51 | 52 | 58 | 59 | 60 | 61 | 65 | 66 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 23 | 24 | 29 | 30 | 34 | 35 | 44 | 45 | 46 | 51 | 52 | 53 | 54 | 58 | 59 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /ManagedConfigurations/app/src/main/res/layout/fragment_managed_configurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | 27 | 28 | 34 | 35 |