diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c9a5de6a669c047a5c93e4ba38b973a12dfe2a76..7a3263e1de348905bdb8a607b6463e6be2657d2b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -15,4 +15,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip diff --git a/prebuilts/gradle/ActionBarCompat-Basic/Application/build.gradle b/prebuilts/gradle/ActionBarCompat-Basic/Application/build.gradle index cd73ee7031a0eb8007c7f5a796221b3decd6fabe..6d60152c18084dfb84a4e70fac567a03f920d9d0 100644 --- a/prebuilts/gradle/ActionBarCompat-Basic/Application/build.gradle +++ b/prebuilts/gradle/ActionBarCompat-Basic/Application/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile "com.android.support:support-v4:23.0.0" - compile "com.android.support:gridlayout-v7:23.0.0" - compile "com.android.support:cardview-v7:23.0.0" + compile "com.android.support:support-v4:23.1.0" + compile "com.android.support:gridlayout-v7:23.1.0" + compile "com.android.support:cardview-v7:23.1.0" compile 'com.android.support:appcompat-v7:21.0.2' } @@ -32,7 +32,7 @@ List dirs = [ android { compileSdkVersion 23 - buildToolsVersion "23.0.0" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 7 @@ -57,18 +57,3 @@ android { } } - - - - - - - - - - - - - - - diff --git a/prebuilts/gradle/ActionBarCompat-Basic/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/ActionBarCompat-Basic/Application/src/main/res/values-v11/template-styles.xml index f261bb5c2962bbd334d7a3d9bf4f7a7fc83b57d8..8c1ea66f28907ac211f355f4220ff4582cfb31eb 100644 --- a/prebuilts/gradle/ActionBarCompat-Basic/Application/src/main/res/values-v11/template-styles.xml +++ b/prebuilts/gradle/ActionBarCompat-Basic/Application/src/main/res/values-v11/template-styles.xml @@ -17,6 +17,6 @@ - diff --git a/prebuilts/gradle/ActionBarCompat-Basic/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/ActionBarCompat-Basic/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/ActionBarCompat-Basic/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/ActionBarCompat-Basic/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/ActionBarCompat-ListPopupMenu/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/ActionBarCompat-ListPopupMenu/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/ActionBarCompat-ListPopupMenu/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/ActionBarCompat-ListPopupMenu/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/ActionBarCompat-ShareActionProvider/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/ActionBarCompat-ShareActionProvider/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/ActionBarCompat-ShareActionProvider/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/ActionBarCompat-ShareActionProvider/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/ActionBarCompat-Styled/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/ActionBarCompat-Styled/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/ActionBarCompat-Styled/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/ActionBarCompat-Styled/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/ActiveNotifications/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/ActiveNotifications/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/ActiveNotifications/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/ActiveNotifications/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/ActivityInstrumentation/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/ActivityInstrumentation/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/ActivityInstrumentation/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/ActivityInstrumentation/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/ActivitySceneTransitionBasic/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/ActivitySceneTransitionBasic/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/ActivitySceneTransitionBasic/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/ActivitySceneTransitionBasic/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/AdvancedImmersiveMode/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/AdvancedImmersiveMode/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/AdvancedImmersiveMode/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/AdvancedImmersiveMode/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/AgendaData/Application/src/main/res/values/base-strings.xml b/prebuilts/gradle/AgendaData/Application/src/main/res/values/base-strings.xml index acc40cf947977336e4b2237d0362abbd14ec07ac..3f806d0a4562c740694bb093be6350c01b317852 100644 --- a/prebuilts/gradle/AgendaData/Application/src/main/res/values/base-strings.xml +++ b/prebuilts/gradle/AgendaData/Application/src/main/res/values/base-strings.xml @@ -22,10 +22,10 @@ Syncs calendar events to your wearable at the press of a button, using the Wearable - DataApi to transmit data such as event time, description, and background image. The DataItems can be - deleted individually via an action on the event notifications, or all at once via a button on the - companion. When deleted using the notification action, a ConfirmationActivity is used to indicate - success or failure. + DataApi to transmit data such as event time, description, and background image. The + DataItems can be deleted individually via an action on the event notifications, or all + at once via a button on the companion. When deleted using the notification action, a + ConfirmationActivity is used to indicate success or failure. ]]> diff --git a/prebuilts/gradle/AgendaData/Application/src/main/res/values/strings.xml b/prebuilts/gradle/AgendaData/Application/src/main/res/values/strings.xml index 9969f4f24bcf75db8f867ff95b41804c507a8d7d..84cb60dba2ba2c36e8dbd7bfc5252755024343a5 100644 --- a/prebuilts/gradle/AgendaData/Application/src/main/res/values/strings.xml +++ b/prebuilts/gradle/AgendaData/Application/src/main/res/values/strings.xml @@ -17,5 +17,9 @@ Sync calendar events to wearable Delete calendar events from wearable - Log + Deletion Log: + Permissions granted. Send Calendar events to Wear device. + Permission requests were denied. Can\'t send calendar events. + + OK diff --git a/prebuilts/gradle/AgendaData/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/AgendaData/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/AgendaData/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/AgendaData/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/AppRestrictionEnforcer/Application/src/main/res/values/strings.xml b/prebuilts/gradle/AppRestrictionEnforcer/Application/src/main/res/values/strings.xml index e35daee3ada878c0160897b96bfce007459091aa..ead415275131bdb3fd27af5ddd90b31b1db324fd 100644 --- a/prebuilts/gradle/AppRestrictionEnforcer/Application/src/main/res/values/strings.xml +++ b/prebuilts/gradle/AppRestrictionEnforcer/Application/src/main/res/values/strings.xml @@ -29,4 +29,14 @@ Number: Rank: Approvals: + Profile: + Name + Age + Items: + Add + Key + Value + Remove + %1$s: %2$s + Add a new item diff --git a/prebuilts/gradle/AppRestrictionEnforcer/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/AppRestrictionEnforcer/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/AppRestrictionEnforcer/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/AppRestrictionEnforcer/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/AppRestrictionSchema/Application/src/main/res/values/restriction_values.xml b/prebuilts/gradle/AppRestrictionSchema/Application/src/main/res/values/restriction_values.xml index 558d097ff49631175619d225cce0bc78e83aa205..53be746699ef110d70a50fd7594a0c7b798cb9c1 100644 --- a/prebuilts/gradle/AppRestrictionSchema/Application/src/main/res/values/restriction_values.xml +++ b/prebuilts/gradle/AppRestrictionSchema/Application/src/main/res/values/restriction_values.xml @@ -74,4 +74,23 @@ limitations under the License. This restriction is hidden and will not be shown to the administrator. (Hidden restriction must have some default value) + + Sample profile + Profile + + John + The name of this person + Name + + 25 + The age of this person + Age + + + Sample items + Items + Item + Key + Value + diff --git a/prebuilts/gradle/AppRestrictionSchema/Application/src/main/res/values/strings.xml b/prebuilts/gradle/AppRestrictionSchema/Application/src/main/res/values/strings.xml index 6dce123f595cbcadc1df20b4a3a2528942f649c6..1ec68d54c1c05f1afa8cc7aec5bd6a7326a2eba5 100644 --- a/prebuilts/gradle/AppRestrictionSchema/Application/src/main/res/values/strings.xml +++ b/prebuilts/gradle/AppRestrictionSchema/Application/src/main/res/values/strings.xml @@ -25,5 +25,7 @@ limitations under the License. Your rank: %s Approvals you have: %s none + Your profile: %1$s (%2$d) + Your items: %s diff --git a/prebuilts/gradle/AppRestrictionSchema/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/AppRestrictionSchema/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/AppRestrictionSchema/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/AppRestrictionSchema/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/AppRestrictions/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/AppRestrictions/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/AppRestrictions/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/AppRestrictions/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/AppUsageStatistics/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/AppUsageStatistics/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/AppUsageStatistics/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/AppUsageStatistics/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - + + diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values-v11/template-styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..8c1ea66f28907ac211f355f4220ff4582cfb31eb --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values-v11/template-styles.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/base-strings.xml b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/base-strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..72dabc1d2b049436b8f8b413b6166d745f5c87e0 --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/base-strings.xml @@ -0,0 +1,30 @@ + + + + + AsymmetricFingerprintDialog + + + + diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/colors.xml b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/colors.xml new file mode 100644 index 0000000000000000000000000000000000000000..a24f3c8fc2522d495ac224d01f6f018452c837a6 --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/colors.xml @@ -0,0 +1,21 @@ + + + + #f4511e + #42000000 + #009688 + diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/strings.xml b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..f44c06d68739d8250ae22405ab5f6040878f1247 --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/strings.xml @@ -0,0 +1,39 @@ + + + + Settings + Cancel + Use password + Sign in + Ok + Password + Confirm fingerprint to continue + Touch sensor + Enter your store password to continue + Purchase + Fingerprint not recognized. Try again + Fingerprint recognized + White Mesh Pluto Backpack + $62.68 + Mesh backpack in white. Black textile trim throughout. + Purchase successful + Purchase failed + A new fingerprint was added to this device, so your password is required. + Use fingerprint in the future + Use fingerprint to authenticate + use_fingerprint_to_authenticate_key + diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/template-dimens.xml b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/template-dimens.xml new file mode 100644 index 0000000000000000000000000000000000000000..39e710b5ca358c1ed04c4a95fc859861b318ae7e --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/template-dimens.xml @@ -0,0 +1,32 @@ + + + + + + + 4dp + 8dp + 16dp + 32dp + 64dp + + + + @dimen/margin_medium + @dimen/margin_medium + + diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/template-styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/values/template-styles.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/xml/preferences.xml b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/xml/preferences.xml new file mode 100644 index 0000000000000000000000000000000000000000..761391d5ab1a35257b0cf9600e09a9fca81746bd --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/Application/src/main/res/xml/preferences.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/CONTRIBUTING.md b/prebuilts/gradle/AsymmetricFingerprintDialog/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..faa8b5c68f00e5472421ffa27503da611782f4c0 --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# How to become a contributor and submit your own code + +## Contributor License Agreements + +We'd love to accept your sample apps and patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement (CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual CLA] + (https://cla.developers.google.com). + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA] + (https://cla.developers.google.com). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Ensure that your code adheres to the existing style in the sample to which + you are contributing. Refer to the + [Android Code Style Guide] + (https://source.android.com/source/code-style.html) for the + recommended coding standards for this organization. +1. Ensure that your code has an appropriate set of unit tests which all pass. +1. Submit a pull request. + diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/LICENSE b/prebuilts/gradle/AsymmetricFingerprintDialog/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..4f229463d3ec8464e7b6e635fc4f000bf9b7517a --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/LICENSE @@ -0,0 +1,647 @@ +Apache License +-------------- + + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +All image and audio files (including *.png, *.jpg, *.svg, *.mp3, *.wav +and *.ogg) are licensed under the CC-BY-NC license. All other files are +licensed under the Apache 2 license. + +CC-BY-NC License +---------------- + +Attribution-NonCommercial-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International +Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-NonCommercial-ShareAlike 4.0 International Public License +("Public License"). To the extent this Public License may be +interpreted as a contract, You are granted the Licensed Rights in +consideration of Your acceptance of these terms and conditions, and the +Licensor grants You such rights in consideration of benefits the +Licensor receives from making the Licensed Material available under +these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-NC-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution, NonCommercial, and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. NonCommercial means not primarily intended for or directed towards + commercial advantage or monetary compensation. For purposes of + this Public License, the exchange of the Licensed Material for + other material subject to Copyright and Similar Rights by digital + file-sharing or similar means is NonCommercial provided there is + no payment of monetary compensation in connection with the + exchange. + + l. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + m. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + n. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part, for NonCommercial purposes only; and + + b. produce, reproduce, and Share Adapted Material for + NonCommercial purposes only. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties, including when + the Licensed Material is used other than for NonCommercial + purposes. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-NC-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database for NonCommercial purposes + only; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + including for purposes of Section 3(b); and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + +======================================================================= + +Creative Commons is not a party to its public licenses. +Notwithstanding, Creative Commons may elect to apply one of its public +licenses to material it publishes and in those instances will be +considered the "Licensor." Except for the limited purpose of indicating +that material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the public +licenses. + +Creative Commons may be contacted at creativecommons.org. + diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/README.md b/prebuilts/gradle/AsymmetricFingerprintDialog/README.md new file mode 100644 index 0000000000000000000000000000000000000000..316d87300e682668a9266c2b1797881ce40f59ee --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/README.md @@ -0,0 +1,86 @@ + +Android AsymmetricFingerprintDialog Sample +=================================== + +A sample that demonstrates to use registered fingerprints to authenticate the user in your app + +Introduction +------------ + +This sample demonstrates how you can use registered fingerprints in your app to authenticate the +user before proceeding some actions such as purchasing an item. + +First you need to create an asymmetric key pair in the Android Key Store using [KeyPairGenerator][1] +in the way that its private key can only be used after the user has authenticated with fingerprint +and transmit the public key to your backend with the user verified password (In a real world, the +app should show proper UIs). + +By setting [KeyGenParameterSpec.Builder.setUserAuthenticationRequired][2] to true, you can permit the +use of the key only after the user authenticate it including when authenticated with the user's +fingerprint. + +Then start listening to a fingerprint on the fingerprint sensor by calling +[FingerprintManager.authenticate][3] with a [Signature][4] initialized with the asymmetric key pair +created. Or alternatively you can fall back to server-side verified password as an authenticator. + +Once the fingerprint (or password) is verified, the +[FingerprintManager.AuthenticationCallback#onAuthenticationSucceeded()][5] callback is called. + +Then you can verify the purchase transaction on server side with the public key passed from the +client, by verifying the piece of data signed by the Signature. + +[1]: https://developer.android.com/reference/java/security/KeyPairGenerator.html +[2]: https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.Builder.html#setUserAuthenticationRequired%28boolean%29 +[3]: https://developer.android.com/reference/android/hardware/fingerprint/FingerprintManager.html#authenticate%28android.hardware.fingerprint.FingerprintManager.CryptoObject,%20android.os.CancellationSignal,%20int,%20android.hardware.fingerprint.FingerprintManager.AuthenticationCallback,%20android.os.Handler%29 +[4]: https://developer.android.com/reference/java/security/Signature.html +[5]: https://developer.android.com/reference/android/hardware/fingerprint/FingerprintManager.AuthenticationCallback.html#onAuthenticationSucceeded%28android.hardware.fingerprint.FingerprintManager.AuthenticationResult%29 + +Pre-requisites +-------------- + +- Android SDK v23 +- Android Build Tools v23.0.2 +- Android Support Repository + +Screenshots +------------- + +Screenshot Screenshot Screenshot Screenshot + +Getting Started +--------------- + +This sample uses the Gradle build system. To build this project, use the +"gradlew build" command or use "Import Project" in Android Studio. + +Support +------- + +- Google+ Community: https://plus.google.com/communities/105153134372062985968 +- Stack Overflow: http://stackoverflow.com/questions/tagged/android + +If you've found an error in this sample, please file an issue: +https://github.com/googlesamples/android-AsymmetricFingerprintDialog + +Patches are encouraged, and may be submitted by forking this project and +submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. + +License +------- + +Copyright 2014 The Android Open Source Project, Inc. + +Licensed to the Apache Software Foundation (ASF) under one or more contributor +license agreements. See the NOTICE file distributed with this work for +additional information regarding copyright ownership. The ASF licenses this +file to you under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/build.gradle b/prebuilts/gradle/AsymmetricFingerprintDialog/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..1dac6def475897204170c39bc31939ebfe2c931e --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/build.gradle @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/gradle/wrapper/gradle-wrapper.jar b/prebuilts/gradle/AsymmetricFingerprintDialog/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..8c0fb64a8698b08ecc4158d828ca593c4928e9dd Binary files /dev/null and b/prebuilts/gradle/AsymmetricFingerprintDialog/gradle/wrapper/gradle-wrapper.jar differ diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/AsymmetricFingerprintDialog/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..203da3aae709c7e95ec28c930e7c66aaf59bada0 --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Apr 27 11:28:32 JST 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/gradlew b/prebuilts/gradle/AsymmetricFingerprintDialog/gradlew new file mode 100755 index 0000000000000000000000000000000000000000..91a7e269e19dfc62e27137a0b57ef3e430cee4fd --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/gradlew.bat b/prebuilts/gradle/AsymmetricFingerprintDialog/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..aec99730b4e8fcd90b57a0e8e01544fea7c31a89 --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/1-purchase-screen.png b/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/1-purchase-screen.png new file mode 100644 index 0000000000000000000000000000000000000000..0bf03bd0be755c5d1b4859d169c4ab493144f53e Binary files /dev/null and b/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/1-purchase-screen.png differ diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/2-fingerprint-dialog.png b/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/2-fingerprint-dialog.png new file mode 100644 index 0000000000000000000000000000000000000000..5e681f96564f5578f4d2945db1f05c2cd884ea0f Binary files /dev/null and b/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/2-fingerprint-dialog.png differ diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/3-fingerprint-authenticated.png b/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/3-fingerprint-authenticated.png new file mode 100644 index 0000000000000000000000000000000000000000..d485b1dd57a8c5f077131a849fbccd418fff61cc Binary files /dev/null and b/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/3-fingerprint-authenticated.png differ diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/4-new-fingerprint-enrolled.png b/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/4-new-fingerprint-enrolled.png new file mode 100644 index 0000000000000000000000000000000000000000..7dcf0800850264911c4286d9e84077fd0f5f4b19 Binary files /dev/null and b/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/4-new-fingerprint-enrolled.png differ diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/big-icon.png b/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/big-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1063d0b6648b9c63c8fefb8e7d4f3e57390265d4 Binary files /dev/null and b/prebuilts/gradle/AsymmetricFingerprintDialog/screenshots/big-icon.png differ diff --git a/prebuilts/gradle/AsymmetricFingerprintDialog/settings.gradle b/prebuilts/gradle/AsymmetricFingerprintDialog/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..9464a359356df07cafaec1bfd44fa30eb2623dde --- /dev/null +++ b/prebuilts/gradle/AsymmetricFingerprintDialog/settings.gradle @@ -0,0 +1 @@ +include 'Application' diff --git a/prebuilts/gradle/AutoBackupForApps/Application/build.gradle b/prebuilts/gradle/AutoBackupForApps/Application/build.gradle index 4e8f709cfe42b81cc2581d5815659947aeff1c01..de3e4f9e0c13b236feb5c3acc678b39f385e7455 100644 --- a/prebuilts/gradle/AutoBackupForApps/Application/build.gradle +++ b/prebuilts/gradle/AutoBackupForApps/Application/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile "com.android.support:support-v4:23.0.0" - compile "com.android.support:support-v13:23.0.0" - compile "com.android.support:cardview-v7:23.0.0" + compile "com.android.support:support-v4:23.1.0" + compile "com.android.support:support-v13:23.1.0" + compile "com.android.support:cardview-v7:23.1.0" } // The sample build uses multiple directories to @@ -31,7 +31,7 @@ List dirs = [ android { compileSdkVersion 23 - buildToolsVersion "23.0.0" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 23 @@ -56,18 +56,3 @@ android { } } - - - - - - - - - - - - - - - diff --git a/prebuilts/gradle/AutoBackupForApps/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/AutoBackupForApps/Application/src/main/res/values-v11/template-styles.xml index f261bb5c2962bbd334d7a3d9bf4f7a7fc83b57d8..8c1ea66f28907ac211f355f4220ff4582cfb31eb 100644 --- a/prebuilts/gradle/AutoBackupForApps/Application/src/main/res/values-v11/template-styles.xml +++ b/prebuilts/gradle/AutoBackupForApps/Application/src/main/res/values-v11/template-styles.xml @@ -17,6 +17,6 @@ - diff --git a/prebuilts/gradle/AutoBackupForApps/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/AutoBackupForApps/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/AutoBackupForApps/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/AutoBackupForApps/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BasicAccessibility/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BasicAccessibility/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BasicAccessibility/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BasicAccessibility/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BasicAndroidKeyStore/README.md b/prebuilts/gradle/BasicAndroidKeyStore/README.md index 6902dd9cea585b0dcfc56e27b7785f9fcd5adb05..f86c9cf31769b5742b1cb1b2748e6b4779a72812 100644 --- a/prebuilts/gradle/BasicAndroidKeyStore/README.md +++ b/prebuilts/gradle/BasicAndroidKeyStore/README.md @@ -24,7 +24,7 @@ Pre-requisites -------------- - Android SDK v23 -- Android Build Tools v23.0.0 +- Android Build Tools v23.0.2 - Android Support Repository Screenshots diff --git a/prebuilts/gradle/BasicAndroidKeyStore/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/BasicAndroidKeyStore/gradle/wrapper/gradle-wrapper.properties index 0c71e760dc93830dd3411fe50d6f5c86bf0a8f4d..07fc193f6aeea23337d8fe9f098980cdec5f95c5 100644 --- a/prebuilts/gradle/BasicAndroidKeyStore/gradle/wrapper/gradle-wrapper.properties +++ b/prebuilts/gradle/BasicAndroidKeyStore/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/prebuilts/gradle/BasicContactables/Application/build.gradle b/prebuilts/gradle/BasicContactables/Application/build.gradle index 839adc5ce05bb02a4262ff794fe7ba7a25450ee8..90f75598b76ff3a7f187b8075d49e7865a797369 100644 --- a/prebuilts/gradle/BasicContactables/Application/build.gradle +++ b/prebuilts/gradle/BasicContactables/Application/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile "com.android.support:support-v4:23.0.0" - compile "com.android.support:support-v13:23.0.0" - compile "com.android.support:cardview-v7:23.0.0" + compile "com.android.support:support-v4:23.1.0" + compile "com.android.support:support-v13:23.1.0" + compile "com.android.support:cardview-v7:23.1.0" } // The sample build uses multiple directories to @@ -31,7 +31,7 @@ List dirs = [ android { compileSdkVersion 23 - buildToolsVersion "23.0.0" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 18 @@ -56,18 +56,3 @@ android { } } - - - - - - - - - - - - - - - diff --git a/prebuilts/gradle/BasicContactables/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/BasicContactables/Application/src/main/res/values-v11/template-styles.xml index f261bb5c2962bbd334d7a3d9bf4f7a7fc83b57d8..8c1ea66f28907ac211f355f4220ff4582cfb31eb 100644 --- a/prebuilts/gradle/BasicContactables/Application/src/main/res/values-v11/template-styles.xml +++ b/prebuilts/gradle/BasicContactables/Application/src/main/res/values-v11/template-styles.xml @@ -17,6 +17,6 @@ - diff --git a/prebuilts/gradle/BasicContactables/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BasicContactables/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BasicContactables/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BasicContactables/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BasicGestureDetect/README.md b/prebuilts/gradle/BasicGestureDetect/README.md index fbaba31530eab59360520f7b1e2a48a34065f17d..d9ae0fa2be246bbf8a377eabf2868fc337dce5b4 100644 --- a/prebuilts/gradle/BasicGestureDetect/README.md +++ b/prebuilts/gradle/BasicGestureDetect/README.md @@ -25,7 +25,7 @@ Pre-requisites -------------- - Android SDK v23 -- Android Build Tools v23.0.0 +- Android Build Tools v23.0.2 - Android Support Repository Screenshots diff --git a/prebuilts/gradle/BasicGestureDetect/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/BasicGestureDetect/gradle/wrapper/gradle-wrapper.properties index 0c71e760dc93830dd3411fe50d6f5c86bf0a8f4d..07fc193f6aeea23337d8fe9f098980cdec5f95c5 100644 --- a/prebuilts/gradle/BasicGestureDetect/gradle/wrapper/gradle-wrapper.properties +++ b/prebuilts/gradle/BasicGestureDetect/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/prebuilts/gradle/BasicImmersiveMode/Application/build.gradle b/prebuilts/gradle/BasicImmersiveMode/Application/build.gradle index e13952859317100fa46170bac55637dd821ef41e..1b5df4e3a6cb47b68e308034f2ac13b6ae9dde43 100644 --- a/prebuilts/gradle/BasicImmersiveMode/Application/build.gradle +++ b/prebuilts/gradle/BasicImmersiveMode/Application/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile "com.android.support:support-v4:23.0.0" - compile "com.android.support:support-v13:23.0.0" - compile "com.android.support:cardview-v7:23.0.0" + compile "com.android.support:support-v4:23.1.0" + compile "com.android.support:support-v13:23.1.0" + compile "com.android.support:cardview-v7:23.1.0" } // The sample build uses multiple directories to @@ -31,7 +31,7 @@ List dirs = [ android { compileSdkVersion 23 - buildToolsVersion "23.0.0" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 19 @@ -56,18 +56,3 @@ android { } } - - - - - - - - - - - - - - - diff --git a/prebuilts/gradle/BasicImmersiveMode/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/BasicImmersiveMode/Application/src/main/res/values-v11/template-styles.xml index f261bb5c2962bbd334d7a3d9bf4f7a7fc83b57d8..8c1ea66f28907ac211f355f4220ff4582cfb31eb 100644 --- a/prebuilts/gradle/BasicImmersiveMode/Application/src/main/res/values-v11/template-styles.xml +++ b/prebuilts/gradle/BasicImmersiveMode/Application/src/main/res/values-v11/template-styles.xml @@ -17,6 +17,6 @@ - diff --git a/prebuilts/gradle/BasicImmersiveMode/README.md b/prebuilts/gradle/BasicImmersiveMode/README.md index 613833c5fcd2e2b50dd4580dfc87424e1098f74f..d7fa1a235158c781c9a860fa82dc754bebbaa2eb 100644 --- a/prebuilts/gradle/BasicImmersiveMode/README.md +++ b/prebuilts/gradle/BasicImmersiveMode/README.md @@ -20,7 +20,7 @@ Pre-requisites -------------- - Android SDK v23 -- Android Build Tools v23.0.0 +- Android Build Tools v23.0.2 - Android Support Repository Screenshots diff --git a/prebuilts/gradle/BasicImmersiveMode/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/BasicImmersiveMode/gradle/wrapper/gradle-wrapper.properties index 0c71e760dc93830dd3411fe50d6f5c86bf0a8f4d..07fc193f6aeea23337d8fe9f098980cdec5f95c5 100644 --- a/prebuilts/gradle/BasicImmersiveMode/gradle/wrapper/gradle-wrapper.properties +++ b/prebuilts/gradle/BasicImmersiveMode/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/prebuilts/gradle/BasicManagedProfile/Application/build.gradle b/prebuilts/gradle/BasicManagedProfile/Application/build.gradle index c0ed8ea6a96fd31b1ee1654d3a528b26797ec317..3bffd32d7772f133f22f90a207986bd105792dae 100644 --- a/prebuilts/gradle/BasicManagedProfile/Application/build.gradle +++ b/prebuilts/gradle/BasicManagedProfile/Application/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile "com.android.support:support-v4:23.0.0" - compile "com.android.support:support-v13:23.0.0" - compile "com.android.support:cardview-v7:23.0.0" + compile "com.android.support:support-v4:23.1.0" + compile "com.android.support:support-v13:23.1.0" + compile "com.android.support:cardview-v7:23.1.0" } // The sample build uses multiple directories to @@ -31,7 +31,7 @@ List dirs = [ android { compileSdkVersion 21 - buildToolsVersion "23.0.0" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 21 @@ -56,18 +56,3 @@ android { } } - - - - - - - - - - - - - - - diff --git a/prebuilts/gradle/BasicManagedProfile/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/BasicManagedProfile/Application/src/main/res/values-v11/template-styles.xml index f261bb5c2962bbd334d7a3d9bf4f7a7fc83b57d8..8c1ea66f28907ac211f355f4220ff4582cfb31eb 100644 --- a/prebuilts/gradle/BasicManagedProfile/Application/src/main/res/values-v11/template-styles.xml +++ b/prebuilts/gradle/BasicManagedProfile/Application/src/main/res/values-v11/template-styles.xml @@ -17,6 +17,6 @@ - diff --git a/prebuilts/gradle/BasicManagedProfile/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BasicManagedProfile/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BasicManagedProfile/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BasicManagedProfile/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BasicMediaDecoder/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BasicMediaDecoder/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BasicMediaDecoder/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BasicMediaDecoder/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BasicMediaRouter/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BasicMediaRouter/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BasicMediaRouter/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BasicMediaRouter/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BasicMultitouch/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BasicMultitouch/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BasicMultitouch/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BasicMultitouch/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BasicNetworking/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BasicNetworking/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BasicNetworking/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BasicNetworking/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BasicNotifications/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BasicNotifications/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BasicNotifications/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BasicNotifications/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BasicRenderScript/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BasicRenderScript/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BasicRenderScript/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BasicRenderScript/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BasicSyncAdapter/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BasicSyncAdapter/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BasicSyncAdapter/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BasicSyncAdapter/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BasicTransition/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BasicTransition/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BasicTransition/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BasicTransition/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BatchStepSensor/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BatchStepSensor/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BatchStepSensor/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BatchStepSensor/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BeamLargeFiles/README.md b/prebuilts/gradle/BeamLargeFiles/README.md index 72c228c793b91f1e0b8c8ddab8d6388c94ceb7c1..138aca18a781ce8d9424e38a9cf7f53b003187f5 100644 --- a/prebuilts/gradle/BeamLargeFiles/README.md +++ b/prebuilts/gradle/BeamLargeFiles/README.md @@ -16,7 +16,7 @@ Pre-requisites -------------- - Android SDK v23 -- Android Build Tools v23.0.0 +- Android Build Tools v23.0.2 - Android Support Repository Getting Started diff --git a/prebuilts/gradle/BeamLargeFiles/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/BeamLargeFiles/gradle/wrapper/gradle-wrapper.properties index 0c71e760dc93830dd3411fe50d6f5c86bf0a8f4d..07fc193f6aeea23337d8fe9f098980cdec5f95c5 100644 --- a/prebuilts/gradle/BeamLargeFiles/gradle/wrapper/gradle-wrapper.properties +++ b/prebuilts/gradle/BeamLargeFiles/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/prebuilts/gradle/BluetoothAdvertisements/Application/build.gradle b/prebuilts/gradle/BluetoothAdvertisements/Application/build.gradle index 2e56aeccce57d9dbab6159a1b827db8341f1e97c..ba404cccaaee842aee76b6c780ff67c1af153500 100644 --- a/prebuilts/gradle/BluetoothAdvertisements/Application/build.gradle +++ b/prebuilts/gradle/BluetoothAdvertisements/Application/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile "com.android.support:support-v4:23.0.0" - compile "com.android.support:support-v13:23.0.0" - compile "com.android.support:cardview-v7:23.0.0" + compile "com.android.support:support-v4:23.1.0" + compile "com.android.support:support-v13:23.1.0" + compile "com.android.support:cardview-v7:23.1.0" } // The sample build uses multiple directories to @@ -31,7 +31,7 @@ List dirs = [ android { compileSdkVersion 23 - buildToolsVersion "23.0.0" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 21 @@ -56,18 +56,3 @@ android { } } - - - - - - - - - - - - - - - diff --git a/prebuilts/gradle/BluetoothAdvertisements/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/BluetoothAdvertisements/Application/src/main/res/values-v11/template-styles.xml index f261bb5c2962bbd334d7a3d9bf4f7a7fc83b57d8..8c1ea66f28907ac211f355f4220ff4582cfb31eb 100644 --- a/prebuilts/gradle/BluetoothAdvertisements/Application/src/main/res/values-v11/template-styles.xml +++ b/prebuilts/gradle/BluetoothAdvertisements/Application/src/main/res/values-v11/template-styles.xml @@ -17,6 +17,6 @@ - diff --git a/prebuilts/gradle/BluetoothChat/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BluetoothChat/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BluetoothChat/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BluetoothChat/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BluetoothLeGatt/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BluetoothLeGatt/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BluetoothLeGatt/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BluetoothLeGatt/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/BorderlessButtons/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/BorderlessButtons/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/BorderlessButtons/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/BorderlessButtons/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/Camera2Basic/Application/src/main/res/values/strings.xml b/prebuilts/gradle/Camera2Basic/Application/src/main/res/values/strings.xml index 66f10008a500657fe55faedfda4db1c5e7380f69..7fdf6e6078e5e866a0fc3c7c24cd894febf1f198 100644 --- a/prebuilts/gradle/Camera2Basic/Application/src/main/res/values/strings.xml +++ b/prebuilts/gradle/Camera2Basic/Application/src/main/res/values/strings.xml @@ -16,4 +16,6 @@ Picture Info + This sample needs camera permission. + This device doesn\'t support Camera2 API. diff --git a/prebuilts/gradle/Camera2Basic/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/Camera2Basic/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/Camera2Basic/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/Camera2Basic/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/Camera2Raw/Application/src/main/res/values/strings.xml b/prebuilts/gradle/Camera2Raw/Application/src/main/res/values/strings.xml index 0f56ce9bb3625f39af249c5af2fd023b52003e94..84672a0829207e5bb90afa0b366e90a24a8a7e43 100644 --- a/prebuilts/gradle/Camera2Raw/Application/src/main/res/values/strings.xml +++ b/prebuilts/gradle/Camera2Raw/Application/src/main/res/values/strings.xml @@ -16,4 +16,5 @@ Picture Info + This app needs camera permission. diff --git a/prebuilts/gradle/Camera2Raw/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/Camera2Raw/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/Camera2Raw/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/Camera2Raw/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/Camera2Video/Application/src/main/res/values/strings.xml b/prebuilts/gradle/Camera2Video/Application/src/main/res/values/strings.xml index bf5e439da4d938364c97e4a0fe526300a7be4690..bce323f1a79a65efe64c26daec3950b310d0b3bb 100644 --- a/prebuilts/gradle/Camera2Video/Application/src/main/res/values/strings.xml +++ b/prebuilts/gradle/Camera2Video/Application/src/main/res/values/strings.xml @@ -3,4 +3,6 @@ Record Stop Info + This sample needs permission for camera and audio recording. + This device doesn\'t support Camera2 API. \ No newline at end of file diff --git a/prebuilts/gradle/Camera2Video/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/Camera2Video/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/Camera2Video/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/Camera2Video/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/CardEmulation/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/CardEmulation/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/CardEmulation/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/CardEmulation/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/CardReader/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/CardReader/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/CardReader/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/CardReader/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/CardView/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/CardView/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/CardView/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/CardView/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/ClippingBasic/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/ClippingBasic/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/ClippingBasic/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/ClippingBasic/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/ConfirmCredential/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/ConfirmCredential/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/ConfirmCredential/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/ConfirmCredential/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/CustomChoiceList/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/CustomChoiceList/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/CustomChoiceList/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/CustomChoiceList/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/CustomNotifications/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/CustomNotifications/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/CustomNotifications/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/CustomNotifications/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/CustomTransition/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/CustomTransition/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/CustomTransition/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/CustomTransition/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/DataLayer/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/DataLayer/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/DataLayer/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/DataLayer/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/DelayedConfirmation/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/DelayedConfirmation/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/DelayedConfirmation/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/DelayedConfirmation/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/DeviceOwner/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/DeviceOwner/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/DeviceOwner/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/DeviceOwner/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - + + diff --git a/prebuilts/gradle/DirectShare/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/DirectShare/Application/src/main/res/values-v11/template-styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..8c1ea66f28907ac211f355f4220ff4582cfb31eb --- /dev/null +++ b/prebuilts/gradle/DirectShare/Application/src/main/res/values-v11/template-styles.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/prebuilts/gradle/DirectShare/Application/src/main/res/values/base-strings.xml b/prebuilts/gradle/DirectShare/Application/src/main/res/values/base-strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..b3f15fbb1cc9087cd45215f13b707f95dc219d75 --- /dev/null +++ b/prebuilts/gradle/DirectShare/Application/src/main/res/values/base-strings.xml @@ -0,0 +1,30 @@ + + + + + DirectShare + + + + diff --git a/prebuilts/gradle/DirectShare/Application/src/main/res/values/colors.xml b/prebuilts/gradle/DirectShare/Application/src/main/res/values/colors.xml new file mode 100644 index 0000000000000000000000000000000000000000..c5a6a3db71b6039ec24134b16271bac938b22f21 --- /dev/null +++ b/prebuilts/gradle/DirectShare/Application/src/main/res/values/colors.xml @@ -0,0 +1,26 @@ + + + + #3F51B5 + #303F9F + #C5CAE9 + #00BCD4 + #212121 + #727272 + #FFFFFF + #B6B6B6 + diff --git a/prebuilts/gradle/DirectShare/Application/src/main/res/values/dimens.xml b/prebuilts/gradle/DirectShare/Application/src/main/res/values/dimens.xml new file mode 100644 index 0000000000000000000000000000000000000000..2d05f5d3b6f495de53f37d341a336bfafbd5a6c4 --- /dev/null +++ b/prebuilts/gradle/DirectShare/Application/src/main/res/values/dimens.xml @@ -0,0 +1,20 @@ + + + + 24dp + 8dp + diff --git a/prebuilts/gradle/DirectShare/Application/src/main/res/values/strings.xml b/prebuilts/gradle/DirectShare/Application/src/main/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..ddc858a965220842899ebc3f91d3ef4a5691d843 --- /dev/null +++ b/prebuilts/gradle/DirectShare/Application/src/main/res/values/strings.xml @@ -0,0 +1,39 @@ + + + + + + + + This app demonstrates how to implement Direct Share. Use some other app and share a text. + For your convenience, you can also use the input below to share the text. + + Hello! + Share + Send a message via: + + + + Sending a message + To: + Send + Body: + Edit your message. + Sent a message \"%1$s\" to %2$s. + Text to share + + diff --git a/prebuilts/gradle/DirectShare/Application/src/main/res/values/styles.xml b/prebuilts/gradle/DirectShare/Application/src/main/res/values/styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..ae312cc42d3f9c8338d40b558e3afdca7ad971e3 --- /dev/null +++ b/prebuilts/gradle/DirectShare/Application/src/main/res/values/styles.xml @@ -0,0 +1,31 @@ + + + + + + + + + diff --git a/prebuilts/gradle/DirectShare/Application/src/main/res/values/template-dimens.xml b/prebuilts/gradle/DirectShare/Application/src/main/res/values/template-dimens.xml new file mode 100644 index 0000000000000000000000000000000000000000..39e710b5ca358c1ed04c4a95fc859861b318ae7e --- /dev/null +++ b/prebuilts/gradle/DirectShare/Application/src/main/res/values/template-dimens.xml @@ -0,0 +1,32 @@ + + + + + + + 4dp + 8dp + 16dp + 32dp + 64dp + + + + @dimen/margin_medium + @dimen/margin_medium + + diff --git a/prebuilts/gradle/DirectShare/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/DirectShare/Application/src/main/res/values/template-styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec --- /dev/null +++ b/prebuilts/gradle/DirectShare/Application/src/main/res/values/template-styles.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + diff --git a/prebuilts/gradle/DirectShare/CONTRIBUTING.md b/prebuilts/gradle/DirectShare/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..faa8b5c68f00e5472421ffa27503da611782f4c0 --- /dev/null +++ b/prebuilts/gradle/DirectShare/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# How to become a contributor and submit your own code + +## Contributor License Agreements + +We'd love to accept your sample apps and patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement (CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual CLA] + (https://cla.developers.google.com). + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA] + (https://cla.developers.google.com). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Ensure that your code adheres to the existing style in the sample to which + you are contributing. Refer to the + [Android Code Style Guide] + (https://source.android.com/source/code-style.html) for the + recommended coding standards for this organization. +1. Ensure that your code has an appropriate set of unit tests which all pass. +1. Submit a pull request. + diff --git a/prebuilts/gradle/DirectShare/LICENSE b/prebuilts/gradle/DirectShare/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..4f229463d3ec8464e7b6e635fc4f000bf9b7517a --- /dev/null +++ b/prebuilts/gradle/DirectShare/LICENSE @@ -0,0 +1,647 @@ +Apache License +-------------- + + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +All image and audio files (including *.png, *.jpg, *.svg, *.mp3, *.wav +and *.ogg) are licensed under the CC-BY-NC license. All other files are +licensed under the Apache 2 license. + +CC-BY-NC License +---------------- + +Attribution-NonCommercial-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International +Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-NonCommercial-ShareAlike 4.0 International Public License +("Public License"). To the extent this Public License may be +interpreted as a contract, You are granted the Licensed Rights in +consideration of Your acceptance of these terms and conditions, and the +Licensor grants You such rights in consideration of benefits the +Licensor receives from making the Licensed Material available under +these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-NC-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution, NonCommercial, and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. NonCommercial means not primarily intended for or directed towards + commercial advantage or monetary compensation. For purposes of + this Public License, the exchange of the Licensed Material for + other material subject to Copyright and Similar Rights by digital + file-sharing or similar means is NonCommercial provided there is + no payment of monetary compensation in connection with the + exchange. + + l. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + m. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + n. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part, for NonCommercial purposes only; and + + b. produce, reproduce, and Share Adapted Material for + NonCommercial purposes only. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties, including when + the Licensed Material is used other than for NonCommercial + purposes. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-NC-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database for NonCommercial purposes + only; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + including for purposes of Section 3(b); and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + +======================================================================= + +Creative Commons is not a party to its public licenses. +Notwithstanding, Creative Commons may elect to apply one of its public +licenses to material it publishes and in those instances will be +considered the "Licensor." Except for the limited purpose of indicating +that material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the public +licenses. + +Creative Commons may be contacted at creativecommons.org. + diff --git a/prebuilts/gradle/DirectShare/README.md b/prebuilts/gradle/DirectShare/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6f36c02791413a7622bbfcba6e754f72dea6b097 --- /dev/null +++ b/prebuilts/gradle/DirectShare/README.md @@ -0,0 +1,76 @@ + +Android DirectShare Sample +=================================== + +Sample demonstrating how to show some options directly in the list of share intent candidates. + +Introduction +------------ + +[Direct Share][1] is a feature that allows apps to show their internal options directly in the +system Intent chooser dialog. This sample is a dummy messaging app, and just like any other +messaging apps, it receives intents for sharing a plain text. When a user shares some text from some +other app, this sample app will be listed as an option. Using the Direct Share feature, this app +also shows some of contacts directly in the chooser dialog. + +To enable Direct Share, apps need to implement a Service extending +[ChooserTargetService][2]. Override the method [onGetChooserTargets][3] and return a list of Direct +Share options. + +In your AndroidManifest.xml, add a meta-data tag in your Activity that receives the Intent. Specify +android:name as android.service.chooser.chooser_target_service, and point the android:value to the +Service. + +[1]: https://developer.android.com/reference/android/service/chooser/package-summary.html +[2]: https://developer.android.com/reference/android/service/chooser/ChooserTargetService.html +[3]: https://developer.android.com/reference/android/service/chooser/ChooserTargetService.html#onGetChooserTargets(android.content.ComponentName%2C%20android.content.IntentFilter) + +Pre-requisites +-------------- + +- Android SDK v23 +- Android Build Tools v23.0.2 +- Android Support Repository + +Screenshots +------------- + +Screenshot Screenshot Screenshot + +Getting Started +--------------- + +This sample uses the Gradle build system. To build this project, use the +"gradlew build" command or use "Import Project" in Android Studio. + +Support +------- + +- Google+ Community: https://plus.google.com/communities/105153134372062985968 +- Stack Overflow: http://stackoverflow.com/questions/tagged/android + +If you've found an error in this sample, please file an issue: +https://github.com/googlesamples/android-DirectShare + +Patches are encouraged, and may be submitted by forking this project and +submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. + +License +------- + +Copyright 2014 The Android Open Source Project, Inc. + +Licensed to the Apache Software Foundation (ASF) under one or more contributor +license agreements. See the NOTICE file distributed with this work for +additional information regarding copyright ownership. The ASF licenses this +file to you under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. diff --git a/prebuilts/gradle/DirectShare/build.gradle b/prebuilts/gradle/DirectShare/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..1901ba936e92369fd98ff950847ed40f8e1d694c --- /dev/null +++ b/prebuilts/gradle/DirectShare/build.gradle @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/prebuilts/gradle/DirectShare/gradle/wrapper/gradle-wrapper.jar b/prebuilts/gradle/DirectShare/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..8c0fb64a8698b08ecc4158d828ca593c4928e9dd Binary files /dev/null and b/prebuilts/gradle/DirectShare/gradle/wrapper/gradle-wrapper.jar differ diff --git a/prebuilts/gradle/DirectShare/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/DirectShare/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..07fc193f6aeea23337d8fe9f098980cdec5f95c5 --- /dev/null +++ b/prebuilts/gradle/DirectShare/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/prebuilts/gradle/DirectShare/gradlew b/prebuilts/gradle/DirectShare/gradlew new file mode 100755 index 0000000000000000000000000000000000000000..91a7e269e19dfc62e27137a0b57ef3e430cee4fd --- /dev/null +++ b/prebuilts/gradle/DirectShare/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/prebuilts/gradle/DirectShare/gradlew.bat b/prebuilts/gradle/DirectShare/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..aec99730b4e8fcd90b57a0e8e01544fea7c31a89 --- /dev/null +++ b/prebuilts/gradle/DirectShare/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/prebuilts/gradle/DirectShare/screenshots/1-main.png b/prebuilts/gradle/DirectShare/screenshots/1-main.png new file mode 100644 index 0000000000000000000000000000000000000000..a0d46e42f7c6c623028574e845d613cc08795d9e Binary files /dev/null and b/prebuilts/gradle/DirectShare/screenshots/1-main.png differ diff --git a/prebuilts/gradle/DirectShare/screenshots/2-intent.png b/prebuilts/gradle/DirectShare/screenshots/2-intent.png new file mode 100644 index 0000000000000000000000000000000000000000..4d6f7d0050c94454c8c12f9abb3698b89e06f0e5 Binary files /dev/null and b/prebuilts/gradle/DirectShare/screenshots/2-intent.png differ diff --git a/prebuilts/gradle/DirectShare/screenshots/3-message.png b/prebuilts/gradle/DirectShare/screenshots/3-message.png new file mode 100644 index 0000000000000000000000000000000000000000..54f9e9f727818e90c50ccdceb5d36b4293826d49 Binary files /dev/null and b/prebuilts/gradle/DirectShare/screenshots/3-message.png differ diff --git a/prebuilts/gradle/DirectShare/screenshots/icon-web.png b/prebuilts/gradle/DirectShare/screenshots/icon-web.png new file mode 100644 index 0000000000000000000000000000000000000000..ee7c5579d63dcd08ad56c9ca5001ebd80cf710e0 Binary files /dev/null and b/prebuilts/gradle/DirectShare/screenshots/icon-web.png differ diff --git a/prebuilts/gradle/DirectShare/settings.gradle b/prebuilts/gradle/DirectShare/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..0a5c310b26f1d4e5a402ccc23236d484c70ccfb0 --- /dev/null +++ b/prebuilts/gradle/DirectShare/settings.gradle @@ -0,0 +1,2 @@ + +include 'Application' diff --git a/prebuilts/gradle/DirectorySelection/Application/build.gradle b/prebuilts/gradle/DirectorySelection/Application/build.gradle index e06eb4ad7c579bc3b7d0d2c8093d4f5ad10fda6d..9b51d935f89e6ae0eef3b30f6a89bac2afe9d072 100644 --- a/prebuilts/gradle/DirectorySelection/Application/build.gradle +++ b/prebuilts/gradle/DirectorySelection/Application/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile "com.android.support:support-v4:23.0.0" - compile "com.android.support:support-v13:23.0.0" - compile "com.android.support:cardview-v7:23.0.0" + compile "com.android.support:support-v4:23.1.0" + compile "com.android.support:support-v13:23.1.0" + compile "com.android.support:cardview-v7:23.1.0" compile 'com.android.support:recyclerview-v7:+' } @@ -32,7 +32,7 @@ List dirs = [ android { compileSdkVersion 23 - buildToolsVersion "23.0.0" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 21 @@ -57,18 +57,3 @@ android { } } - - - - - - - - - - - - - - - diff --git a/prebuilts/gradle/DirectorySelection/Application/src/main/java/com/example/android/directoryselection/DirectorySelectionFragment.java b/prebuilts/gradle/DirectorySelection/Application/src/main/java/com/example/android/directoryselection/DirectorySelectionFragment.java index 4af55dbe1bb98c16c70812e7df19d6c9cb39b46e..075f39b776bf0875d648afebc4af57b5ce34cb37 100644 --- a/prebuilts/gradle/DirectorySelection/Application/src/main/java/com/example/android/directoryselection/DirectorySelectionFragment.java +++ b/prebuilts/gradle/DirectorySelection/Application/src/main/java/com/example/android/directoryselection/DirectorySelectionFragment.java @@ -27,7 +27,6 @@ import android.os.Bundle; import android.provider.DocumentsContract; import android.provider.DocumentsContract.Document; import android.support.v4.app.Fragment; -import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; @@ -124,8 +123,7 @@ public class DirectorySelectionFragment extends Fragment { } }); mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview_directory_entries); - mLayoutManager = new LinearLayoutManager(getActivity()); - mRecyclerView.setLayoutManager(mLayoutManager); + mLayoutManager = mRecyclerView.getLayoutManager(); mRecyclerView.scrollToPosition(0); mAdapter = new DirectoryEntryAdapter(new ArrayList()); mRecyclerView.setAdapter(mAdapter); diff --git a/prebuilts/gradle/DirectorySelection/Application/src/main/res/layout/fragment_directory_selection.xml b/prebuilts/gradle/DirectorySelection/Application/src/main/res/layout/fragment_directory_selection.xml index d63219c5d8646d74aa2bbc2b9c0f45f433a7f293..631a8fc407b46d6d81fe43584a42a19e677e0456 100644 --- a/prebuilts/gradle/DirectorySelection/Application/src/main/res/layout/fragment_directory_selection.xml +++ b/prebuilts/gradle/DirectorySelection/Application/src/main/res/layout/fragment_directory_selection.xml @@ -16,6 +16,7 @@ --> + android:layout_height="match_parent" + app:layoutManager="LinearLayoutManager" + /> diff --git a/prebuilts/gradle/DirectorySelection/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/DirectorySelection/Application/src/main/res/values-v11/template-styles.xml index f261bb5c2962bbd334d7a3d9bf4f7a7fc83b57d8..8c1ea66f28907ac211f355f4220ff4582cfb31eb 100644 --- a/prebuilts/gradle/DirectorySelection/Application/src/main/res/values-v11/template-styles.xml +++ b/prebuilts/gradle/DirectorySelection/Application/src/main/res/values-v11/template-styles.xml @@ -17,6 +17,6 @@ - diff --git a/prebuilts/gradle/DirectorySelection/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/DirectorySelection/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/DirectorySelection/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/DirectorySelection/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/DisplayingBitmaps/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/DisplayingBitmaps/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/DisplayingBitmaps/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/DisplayingBitmaps/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/DocumentCentricApps/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/DocumentCentricApps/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/DocumentCentricApps/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/DocumentCentricApps/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/DocumentCentricRelinquishIdentity/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/DocumentCentricRelinquishIdentity/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/DocumentCentricRelinquishIdentity/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/DocumentCentricRelinquishIdentity/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/DoneBar/README.md b/prebuilts/gradle/DoneBar/README.md index 7344e7115e0bd00511ffa1b5fddb3b15b7515627..5314ed6490bd7293a10b94ed19edf620736f2140 100644 --- a/prebuilts/gradle/DoneBar/README.md +++ b/prebuilts/gradle/DoneBar/README.md @@ -32,7 +32,7 @@ Pre-requisites -------------- - Android SDK v23 -- Android Build Tools v23.0.0 +- Android Build Tools v23.0.2 - Android Support Repository Screenshots diff --git a/prebuilts/gradle/DoneBar/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/DoneBar/gradle/wrapper/gradle-wrapper.properties index 0c71e760dc93830dd3411fe50d6f5c86bf0a8f4d..07fc193f6aeea23337d8fe9f098980cdec5f95c5 100644 --- a/prebuilts/gradle/DoneBar/gradle/wrapper/gradle-wrapper.properties +++ b/prebuilts/gradle/DoneBar/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/prebuilts/gradle/DrawableTinting/Application/build.gradle b/prebuilts/gradle/DrawableTinting/Application/build.gradle index 2e56aeccce57d9dbab6159a1b827db8341f1e97c..ba404cccaaee842aee76b6c780ff67c1af153500 100644 --- a/prebuilts/gradle/DrawableTinting/Application/build.gradle +++ b/prebuilts/gradle/DrawableTinting/Application/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile "com.android.support:support-v4:23.0.0" - compile "com.android.support:support-v13:23.0.0" - compile "com.android.support:cardview-v7:23.0.0" + compile "com.android.support:support-v4:23.1.0" + compile "com.android.support:support-v13:23.1.0" + compile "com.android.support:cardview-v7:23.1.0" } // The sample build uses multiple directories to @@ -31,7 +31,7 @@ List dirs = [ android { compileSdkVersion 23 - buildToolsVersion "23.0.0" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 21 @@ -56,18 +56,3 @@ android { } } - - - - - - - - - - - - - - - diff --git a/prebuilts/gradle/DrawableTinting/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/DrawableTinting/Application/src/main/res/values-v11/template-styles.xml index f261bb5c2962bbd334d7a3d9bf4f7a7fc83b57d8..8c1ea66f28907ac211f355f4220ff4582cfb31eb 100644 --- a/prebuilts/gradle/DrawableTinting/Application/src/main/res/values-v11/template-styles.xml +++ b/prebuilts/gradle/DrawableTinting/Application/src/main/res/values-v11/template-styles.xml @@ -17,6 +17,6 @@ - diff --git a/prebuilts/gradle/DrawableTinting/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/DrawableTinting/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/DrawableTinting/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/DrawableTinting/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/ElevationBasic/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/ElevationBasic/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/ElevationBasic/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/ElevationBasic/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/ElevationDrag/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/ElevationDrag/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/ElevationDrag/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/ElevationDrag/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/ElizaChat/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/ElizaChat/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/ElizaChat/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/ElizaChat/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/FindMyPhone/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/FindMyPhone/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/FindMyPhone/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/FindMyPhone/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/FingerprintDialog/Application/src/main/res/values/base-strings.xml b/prebuilts/gradle/FingerprintDialog/Application/src/main/res/values/base-strings.xml index f3545f5703fadf32be8c8f416982f0f4a6372c09..a4a93f7a44c8b35baaa437a3a7ad8c67fbd44a81 100644 --- a/prebuilts/gradle/FingerprintDialog/Application/src/main/res/values/base-strings.xml +++ b/prebuilts/gradle/FingerprintDialog/Application/src/main/res/values/base-strings.xml @@ -16,7 +16,7 @@ --> - Fingerprint Dialog Sample + FingerprintDialog - diff --git a/prebuilts/gradle/FloatingActionButtonBasic/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/FloatingActionButtonBasic/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/FloatingActionButtonBasic/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/FloatingActionButtonBasic/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/Geofencing/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/Geofencing/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/Geofencing/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/Geofencing/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/HdrViewfinder/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/HdrViewfinder/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/HdrViewfinder/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/HdrViewfinder/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/HorizontalPaging/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/HorizontalPaging/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/HorizontalPaging/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/HorizontalPaging/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/ImmersiveMode/README.md b/prebuilts/gradle/ImmersiveMode/README.md index 4002eb4c898463ae4965135c6e5cc1c9ad769896..80cb929907febd1c091234552d37b0eb5583e17d 100644 --- a/prebuilts/gradle/ImmersiveMode/README.md +++ b/prebuilts/gradle/ImmersiveMode/README.md @@ -10,7 +10,7 @@ Pre-requisites -------------- - Android SDK v23 -- Android Build Tools v23.0.0 +- Android Build Tools v23.0.2 - Android Support Repository Getting Started diff --git a/prebuilts/gradle/ImmersiveMode/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/ImmersiveMode/gradle/wrapper/gradle-wrapper.properties index 0c71e760dc93830dd3411fe50d6f5c86bf0a8f4d..07fc193f6aeea23337d8fe9f098980cdec5f95c5 100644 --- a/prebuilts/gradle/ImmersiveMode/gradle/wrapper/gradle-wrapper.properties +++ b/prebuilts/gradle/ImmersiveMode/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/prebuilts/gradle/Interpolator/Application/build.gradle b/prebuilts/gradle/Interpolator/Application/build.gradle index 2e56aeccce57d9dbab6159a1b827db8341f1e97c..ba404cccaaee842aee76b6c780ff67c1af153500 100644 --- a/prebuilts/gradle/Interpolator/Application/build.gradle +++ b/prebuilts/gradle/Interpolator/Application/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile "com.android.support:support-v4:23.0.0" - compile "com.android.support:support-v13:23.0.0" - compile "com.android.support:cardview-v7:23.0.0" + compile "com.android.support:support-v4:23.1.0" + compile "com.android.support:support-v13:23.1.0" + compile "com.android.support:cardview-v7:23.1.0" } // The sample build uses multiple directories to @@ -31,7 +31,7 @@ List dirs = [ android { compileSdkVersion 23 - buildToolsVersion "23.0.0" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 21 @@ -56,18 +56,3 @@ android { } } - - - - - - - - - - - - - - - diff --git a/prebuilts/gradle/Interpolator/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/Interpolator/Application/src/main/res/values-v11/template-styles.xml index f261bb5c2962bbd334d7a3d9bf4f7a7fc83b57d8..8c1ea66f28907ac211f355f4220ff4582cfb31eb 100644 --- a/prebuilts/gradle/Interpolator/Application/src/main/res/values-v11/template-styles.xml +++ b/prebuilts/gradle/Interpolator/Application/src/main/res/values-v11/template-styles.xml @@ -17,6 +17,6 @@ - diff --git a/prebuilts/gradle/Interpolator/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/Interpolator/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/Interpolator/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/Interpolator/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/JobScheduler/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/JobScheduler/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/JobScheduler/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/JobScheduler/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/LNotifications/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/LNotifications/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/LNotifications/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/LNotifications/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/MediaEffects/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/MediaEffects/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/MediaEffects/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/MediaEffects/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/MediaRecorder/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/MediaRecorder/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/MediaRecorder/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/MediaRecorder/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/MediaRouter/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/MediaRouter/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/MediaRouter/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/MediaRouter/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - + + diff --git a/prebuilts/gradle/MidiScope/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/MidiScope/Application/src/main/res/values-v11/template-styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..8c1ea66f28907ac211f355f4220ff4582cfb31eb --- /dev/null +++ b/prebuilts/gradle/MidiScope/Application/src/main/res/values-v11/template-styles.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/prebuilts/gradle/MidiScope/Application/src/main/res/values/base-strings.xml b/prebuilts/gradle/MidiScope/Application/src/main/res/values/base-strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..fb7d652fc4491faa06c74c6c313c0f588baaa0fd --- /dev/null +++ b/prebuilts/gradle/MidiScope/Application/src/main/res/values/base-strings.xml @@ -0,0 +1,30 @@ + + + + + MidiScope + + + + diff --git a/prebuilts/gradle/MidiScope/Application/src/main/res/values/colors.xml b/prebuilts/gradle/MidiScope/Application/src/main/res/values/colors.xml new file mode 100644 index 0000000000000000000000000000000000000000..eef48d8809b288960609cfeaf3de60eb617329aa --- /dev/null +++ b/prebuilts/gradle/MidiScope/Application/src/main/res/values/colors.xml @@ -0,0 +1,26 @@ + + + + #009688 + #00796B + #B2DFDB + #FFC107 + #212121 + #727272 + #FFFFFF + #B6B6B6 + diff --git a/prebuilts/gradle/MidiScope/Application/src/main/res/values/strings.xml b/prebuilts/gradle/MidiScope/Application/src/main/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..52beb4e1ade484dabe879aacd9a584f73d952f65 --- /dev/null +++ b/prebuilts/gradle/MidiScope/Application/src/main/res/values/strings.xml @@ -0,0 +1,24 @@ + + + + Select a MIDI source from the Spinner above or send messages to MidiScope. + Clear Log + Keep Screen On + + "none" + + diff --git a/prebuilts/gradle/MidiScope/Application/src/main/res/values/styles.xml b/prebuilts/gradle/MidiScope/Application/src/main/res/values/styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..0036009693465f54d46628e77146fd3e852cb03d --- /dev/null +++ b/prebuilts/gradle/MidiScope/Application/src/main/res/values/styles.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/prebuilts/gradle/MidiScope/Application/src/main/res/values/template-dimens.xml b/prebuilts/gradle/MidiScope/Application/src/main/res/values/template-dimens.xml new file mode 100644 index 0000000000000000000000000000000000000000..39e710b5ca358c1ed04c4a95fc859861b318ae7e --- /dev/null +++ b/prebuilts/gradle/MidiScope/Application/src/main/res/values/template-dimens.xml @@ -0,0 +1,32 @@ + + + + + + + 4dp + 8dp + 16dp + 32dp + 64dp + + + + @dimen/margin_medium + @dimen/margin_medium + + diff --git a/prebuilts/gradle/MidiScope/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/MidiScope/Application/src/main/res/values/template-styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec --- /dev/null +++ b/prebuilts/gradle/MidiScope/Application/src/main/res/values/template-styles.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + diff --git a/prebuilts/gradle/MidiScope/Application/src/main/res/xml/scope_device_info.xml b/prebuilts/gradle/MidiScope/Application/src/main/res/xml/scope_device_info.xml new file mode 100644 index 0000000000000000000000000000000000000000..f89f1109970f7e8dab7edb5e034a0a78d0613bee --- /dev/null +++ b/prebuilts/gradle/MidiScope/Application/src/main/res/xml/scope_device_info.xml @@ -0,0 +1,24 @@ + + + + + + + diff --git a/prebuilts/gradle/MidiScope/CONTRIBUTING.md b/prebuilts/gradle/MidiScope/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..faa8b5c68f00e5472421ffa27503da611782f4c0 --- /dev/null +++ b/prebuilts/gradle/MidiScope/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# How to become a contributor and submit your own code + +## Contributor License Agreements + +We'd love to accept your sample apps and patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement (CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual CLA] + (https://cla.developers.google.com). + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA] + (https://cla.developers.google.com). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Ensure that your code adheres to the existing style in the sample to which + you are contributing. Refer to the + [Android Code Style Guide] + (https://source.android.com/source/code-style.html) for the + recommended coding standards for this organization. +1. Ensure that your code has an appropriate set of unit tests which all pass. +1. Submit a pull request. + diff --git a/prebuilts/gradle/MidiScope/LICENSE b/prebuilts/gradle/MidiScope/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..4f229463d3ec8464e7b6e635fc4f000bf9b7517a --- /dev/null +++ b/prebuilts/gradle/MidiScope/LICENSE @@ -0,0 +1,647 @@ +Apache License +-------------- + + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +All image and audio files (including *.png, *.jpg, *.svg, *.mp3, *.wav +and *.ogg) are licensed under the CC-BY-NC license. All other files are +licensed under the Apache 2 license. + +CC-BY-NC License +---------------- + +Attribution-NonCommercial-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International +Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-NonCommercial-ShareAlike 4.0 International Public License +("Public License"). To the extent this Public License may be +interpreted as a contract, You are granted the Licensed Rights in +consideration of Your acceptance of these terms and conditions, and the +Licensor grants You such rights in consideration of benefits the +Licensor receives from making the Licensed Material available under +these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-NC-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution, NonCommercial, and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. NonCommercial means not primarily intended for or directed towards + commercial advantage or monetary compensation. For purposes of + this Public License, the exchange of the Licensed Material for + other material subject to Copyright and Similar Rights by digital + file-sharing or similar means is NonCommercial provided there is + no payment of monetary compensation in connection with the + exchange. + + l. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + m. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + n. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part, for NonCommercial purposes only; and + + b. produce, reproduce, and Share Adapted Material for + NonCommercial purposes only. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties, including when + the Licensed Material is used other than for NonCommercial + purposes. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-NC-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database for NonCommercial purposes + only; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + including for purposes of Section 3(b); and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + +======================================================================= + +Creative Commons is not a party to its public licenses. +Notwithstanding, Creative Commons may elect to apply one of its public +licenses to material it publishes and in those instances will be +considered the "Licensor." Except for the limited purpose of indicating +that material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the public +licenses. + +Creative Commons may be contacted at creativecommons.org. + diff --git a/prebuilts/gradle/MidiScope/README.md b/prebuilts/gradle/MidiScope/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0ffdf1fe8bc3b604f485f88901668240375a8fef --- /dev/null +++ b/prebuilts/gradle/MidiScope/README.md @@ -0,0 +1,67 @@ + +Android MidiScope Sample +=================================== + +Sample demonstrating how to use the MIDI API to receive and process MIDI signals coming from an +attached device. + +Introduction +------------ + +The Android MIDI API ([android.media.midi][1]) allows developers to connect a MIDI device to Android +and process MIDI signals coming from it. This sample demonstrates some basic features of the MIDI +API, such as enumeration of currently available devices (Information includes name, vendor, +capabilities, etc), notification when MIDI devices are plugged in or unplugged, and receiving MIDI +signals. This sample simply shows all the received MIDI signals to the screen log and does not play +any sound for them. +[1]: https://developer.android.com/reference/android/media/midi/package-summary.html + +Pre-requisites +-------------- + +- Android SDK v23 +- Android Build Tools v23.0.2 +- Android Support Repository + +Screenshots +------------- + +Screenshot Screenshot + +Getting Started +--------------- + +This sample uses the Gradle build system. To build this project, use the +"gradlew build" command or use "Import Project" in Android Studio. + +Support +------- + +- Google+ Community: https://plus.google.com/communities/105153134372062985968 +- Stack Overflow: http://stackoverflow.com/questions/tagged/android + +If you've found an error in this sample, please file an issue: +https://github.com/googlesamples/android-MidiScope + +Patches are encouraged, and may be submitted by forking this project and +submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. + +License +------- + +Copyright 2014 The Android Open Source Project, Inc. + +Licensed to the Apache Software Foundation (ASF) under one or more contributor +license agreements. See the NOTICE file distributed with this work for +additional information regarding copyright ownership. The ASF licenses this +file to you under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. diff --git a/prebuilts/gradle/MidiScope/build.gradle b/prebuilts/gradle/MidiScope/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..1901ba936e92369fd98ff950847ed40f8e1d694c --- /dev/null +++ b/prebuilts/gradle/MidiScope/build.gradle @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/prebuilts/gradle/MidiScope/gradle/wrapper/gradle-wrapper.jar b/prebuilts/gradle/MidiScope/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..8c0fb64a8698b08ecc4158d828ca593c4928e9dd Binary files /dev/null and b/prebuilts/gradle/MidiScope/gradle/wrapper/gradle-wrapper.jar differ diff --git a/prebuilts/gradle/MidiScope/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/MidiScope/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..07fc193f6aeea23337d8fe9f098980cdec5f95c5 --- /dev/null +++ b/prebuilts/gradle/MidiScope/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/prebuilts/gradle/MidiScope/gradlew b/prebuilts/gradle/MidiScope/gradlew new file mode 100755 index 0000000000000000000000000000000000000000..91a7e269e19dfc62e27137a0b57ef3e430cee4fd --- /dev/null +++ b/prebuilts/gradle/MidiScope/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/prebuilts/gradle/MidiScope/gradlew.bat b/prebuilts/gradle/MidiScope/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..aec99730b4e8fcd90b57a0e8e01544fea7c31a89 --- /dev/null +++ b/prebuilts/gradle/MidiScope/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/prebuilts/gradle/MidiScope/screenshots/1-main.png b/prebuilts/gradle/MidiScope/screenshots/1-main.png new file mode 100644 index 0000000000000000000000000000000000000000..0b4fb8e8723036d41c7c1cc9b752b269d34d7cef Binary files /dev/null and b/prebuilts/gradle/MidiScope/screenshots/1-main.png differ diff --git a/prebuilts/gradle/MidiScope/screenshots/2-signals.png b/prebuilts/gradle/MidiScope/screenshots/2-signals.png new file mode 100644 index 0000000000000000000000000000000000000000..7e4b443ea2457683da81fa52b86e8981a2e0a390 Binary files /dev/null and b/prebuilts/gradle/MidiScope/screenshots/2-signals.png differ diff --git a/prebuilts/gradle/MidiScope/screenshots/icon-web.png b/prebuilts/gradle/MidiScope/screenshots/icon-web.png new file mode 100644 index 0000000000000000000000000000000000000000..6daec5cd98e4ab0c948ca817bad8e149c6b8efea Binary files /dev/null and b/prebuilts/gradle/MidiScope/screenshots/icon-web.png differ diff --git a/prebuilts/gradle/MidiScope/settings.gradle b/prebuilts/gradle/MidiScope/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..0a5c310b26f1d4e5a402ccc23236d484c70ccfb0 --- /dev/null +++ b/prebuilts/gradle/MidiScope/settings.gradle @@ -0,0 +1,2 @@ + +include 'Application' diff --git a/prebuilts/gradle/MidiSynth/.google/packaging.yaml b/prebuilts/gradle/MidiSynth/.google/packaging.yaml new file mode 100644 index 0000000000000000000000000000000000000000..baa258ca6bcdaf4272cdae23729603b3e98f6aa1 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/.google/packaging.yaml @@ -0,0 +1,18 @@ + +# GOOGLE SAMPLE PACKAGING DATA +# +# This file is used by Google as part of our samples packaging process. +# End users may safely ignore this file. It has no relevance to other systems. +--- +status: PUBLISHED +technologies: [Android] +categories: [Media] +languages: [Java] +solutions: [Mobile] +github: android-MidiSynth +level: EXPERT +icon: screenshots/icon-web.png +apiRefs: + - android:android.media.midi.MidiManager + - android:android.media.midi.MidiReceiver +license: apache2 diff --git a/prebuilts/gradle/MidiSynth/Application/build.gradle b/prebuilts/gradle/MidiSynth/Application/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..de3e4f9e0c13b236feb5c3acc678b39f385e7455 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/build.gradle @@ -0,0 +1,58 @@ + +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:1.2.3' + } +} + +apply plugin: 'com.android.application' + +repositories { + jcenter() +} + +dependencies { + compile "com.android.support:support-v4:23.1.0" + compile "com.android.support:support-v13:23.1.0" + compile "com.android.support:cardview-v7:23.1.0" +} + +// The sample build uses multiple directories to +// keep boilerplate and common code separate from +// the main sample code. +List dirs = [ + 'main', // main sample code; look here for the interesting stuff. + 'common', // components that are reused by multiple samples + 'template'] // boilerplate code that is generated by the sample template process + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.2" + + defaultConfig { + minSdkVersion 23 + targetSdkVersion 23 + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + sourceSets { + main { + dirs.each { dir -> + java.srcDirs "src/${dir}/java" + res.srcDirs "src/${dir}/res" + } + } + androidTest.setRoot('tests') + androidTest.java.srcDirs = ['tests/src'] + + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/AndroidManifest.xml b/prebuilts/gradle/MidiSynth/Application/src/main/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..1002419205b6943c8f044b949e481a615fd52567 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/AndroidManifest.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/EventScheduler.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/EventScheduler.java new file mode 100644 index 0000000000000000000000000000000000000000..37c0140dc5f4e5b866897c07c0104deb71a22b6a --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/EventScheduler.java @@ -0,0 +1,243 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +import java.util.SortedMap; +import java.util.TreeMap; + +/** + * Store SchedulableEvents in a timestamped buffer. + * Events may be written in any order. + * Events will be read in sorted order. + * Events with the same timestamp will be read in the order they were added. + * + * Only one Thread can write into the buffer. + * And only one Thread can read from the buffer. + */ +public class EventScheduler { + private static final long NANOS_PER_MILLI = 1000000; + + private final Object lock = new Object(); + private SortedMap mEventBuffer; + // This does not have to be guarded. It is only set by the writing thread. + // If the reader sees a null right before being set then that is OK. + private FastEventQueue mEventPool = null; + private static final int MAX_POOL_SIZE = 200; + + public EventScheduler() { + mEventBuffer = new TreeMap(); + } + + // If we keep at least one node in the list then it can be atomic + // and non-blocking. + private class FastEventQueue { + // One thread takes from the beginning of the list. + volatile SchedulableEvent mFirst; + // A second thread returns events to the end of the list. + volatile SchedulableEvent mLast; + volatile long mEventsAdded; + volatile long mEventsRemoved; + + FastEventQueue(SchedulableEvent event) { + mFirst = event; + mLast = mFirst; + mEventsAdded = 1; // Always created with one event added. Never empty. + mEventsRemoved = 0; // None removed yet. + } + + int size() { + return (int)(mEventsAdded - mEventsRemoved); + } + + /** + * Do not call this unless there is more than one event + * in the list. + * @return first event in the list + */ + public SchedulableEvent remove() { + // Take first event. + mEventsRemoved++; + SchedulableEvent event = mFirst; + mFirst = event.mNext; + return event; + } + + /** + * @param event + */ + public void add(SchedulableEvent event) { + event.mNext = null; + mLast.mNext = event; + mLast = event; + mEventsAdded++; + } + } + + /** + * Base class for events that can be stored in the EventScheduler. + */ + public static class SchedulableEvent { + private long mTimestamp; + private SchedulableEvent mNext = null; + + /** + * @param timestamp + */ + public SchedulableEvent(long timestamp) { + mTimestamp = timestamp; + } + + /** + * @return timestamp + */ + public long getTimestamp() { + return mTimestamp; + } + + /** + * The timestamp should not be modified when the event is in the + * scheduling buffer. + */ + public void setTimestamp(long timestamp) { + mTimestamp = timestamp; + } + } + + /** + * Get an event from the pool. + * Always leave at least one event in the pool. + * @return event or null + */ + public SchedulableEvent removeEventfromPool() { + SchedulableEvent event = null; + if (mEventPool != null && (mEventPool.size() > 1)) { + event = mEventPool.remove(); + } + return event; + } + + /** + * Return events to a pool so they can be reused. + * + * @param event + */ + public void addEventToPool(SchedulableEvent event) { + if (mEventPool == null) { + mEventPool = new FastEventQueue(event); + // If we already have enough items in the pool then just + // drop the event. This prevents unbounded memory leaks. + } else if (mEventPool.size() < MAX_POOL_SIZE) { + mEventPool.add(event); + } + } + + /** + * Add an event to the scheduler. Events with the same time will be + * processed in order. + * + * @param event + */ + public void add(SchedulableEvent event) { + synchronized (lock) { + FastEventQueue list = mEventBuffer.get(event.getTimestamp()); + if (list == null) { + long lowestTime = mEventBuffer.isEmpty() ? Long.MAX_VALUE + : mEventBuffer.firstKey(); + list = new FastEventQueue(event); + mEventBuffer.put(event.getTimestamp(), list); + // If the event we added is earlier than the previous earliest + // event then notify any threads waiting for the next event. + if (event.getTimestamp() < lowestTime) { + lock.notify(); + } + } else { + list.add(event); + } + } + } + + // Caller must synchronize on lock before calling. + private SchedulableEvent removeNextEventLocked(long lowestTime) { + SchedulableEvent event; + FastEventQueue list = mEventBuffer.get(lowestTime); + // Remove list from tree if this is the last node. + if ((list.size() == 1)) { + mEventBuffer.remove(lowestTime); + } + event = list.remove(); + return event; + } + + /** + * Check to see if any scheduled events are ready to be processed. + * + * @param timestamp + * @return next event or null if none ready + */ + public SchedulableEvent getNextEvent(long time) { + SchedulableEvent event = null; + synchronized (lock) { + if (!mEventBuffer.isEmpty()) { + long lowestTime = mEventBuffer.firstKey(); + // Is it time for this list to be processed? + if (lowestTime <= time) { + event = removeNextEventLocked(lowestTime); + } + } + } + // Log.i(TAG, "getNextEvent: event = " + event); + return event; + } + + /** + * Return the next available event or wait until there is an event ready to + * be processed. This method assumes that the timestamps are in nanoseconds + * and that the current time is System.nanoTime(). + * + * @return event + * @throws InterruptedException + */ + public SchedulableEvent waitNextEvent() throws InterruptedException { + SchedulableEvent event = null; + while (true) { + long millisToWait = Integer.MAX_VALUE; + synchronized (lock) { + if (!mEventBuffer.isEmpty()) { + long now = System.nanoTime(); + long lowestTime = mEventBuffer.firstKey(); + // Is it time for the earliest list to be processed? + if (lowestTime <= now) { + event = removeNextEventLocked(lowestTime); + break; + } else { + // Figure out how long to sleep until next event. + long nanosToWait = lowestTime - now; + // Add 1 millisecond so we don't wake up before it is + // ready. + millisToWait = 1 + (nanosToWait / NANOS_PER_MILLI); + // Clip 64-bit value to 32-bit max. + if (millisToWait > Integer.MAX_VALUE) { + millisToWait = Integer.MAX_VALUE; + } + } + } + lock.wait((int) millisToWait); + } + } + return event; + } +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiConstants.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..38c25d505ea57c5c361b328bc86f11e8b9de5f53 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiConstants.java @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +/** + * MIDI related constants and static methods. + * These values are defined in the MIDI Standard 1.0 + * available from the MIDI Manufacturers Association. + */ +public class MidiConstants { + protected final static String TAG = "MidiTools"; + public static final byte STATUS_COMMAND_MASK = (byte) 0xF0; + public static final byte STATUS_CHANNEL_MASK = (byte) 0x0F; + + // Channel voice messages. + public static final byte STATUS_NOTE_OFF = (byte) 0x80; + public static final byte STATUS_NOTE_ON = (byte) 0x90; + public static final byte STATUS_POLYPHONIC_AFTERTOUCH = (byte) 0xA0; + public static final byte STATUS_CONTROL_CHANGE = (byte) 0xB0; + public static final byte STATUS_PROGRAM_CHANGE = (byte) 0xC0; + public static final byte STATUS_CHANNEL_PRESSURE = (byte) 0xD0; + public static final byte STATUS_PITCH_BEND = (byte) 0xE0; + + // System Common Messages. + public static final byte STATUS_SYSTEM_EXCLUSIVE = (byte) 0xF0; + public static final byte STATUS_MIDI_TIME_CODE = (byte) 0xF1; + public static final byte STATUS_SONG_POSITION = (byte) 0xF2; + public static final byte STATUS_SONG_SELECT = (byte) 0xF3; + public static final byte STATUS_TUNE_REQUEST = (byte) 0xF6; + public static final byte STATUS_END_SYSEX = (byte) 0xF7; + + // System Real-Time Messages + public static final byte STATUS_TIMING_CLOCK = (byte) 0xF8; + public static final byte STATUS_START = (byte) 0xFA; + public static final byte STATUS_CONTINUE = (byte) 0xFB; + public static final byte STATUS_STOP = (byte) 0xFC; + public static final byte STATUS_ACTIVE_SENSING = (byte) 0xFE; + public static final byte STATUS_RESET = (byte) 0xFF; + + /** Number of bytes in a message nc from 8c to Ec */ + public final static int CHANNEL_BYTE_LENGTHS[] = { 3, 3, 3, 3, 2, 2, 3 }; + + /** Number of bytes in a message Fn from F0 to FF */ + public final static int SYSTEM_BYTE_LENGTHS[] = { 1, 2, 3, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1 }; + + /** + * MIDI messages, except for SysEx, are 1,2 or 3 bytes long. + * You can tell how long a MIDI message is from the first status byte. + * Do not call this for SysEx, which has variable length. + * @param statusByte + * @return number of bytes in a complete message, zero if data byte passed + */ + public static int getBytesPerMessage(byte statusByte) { + // Java bytes are signed so we need to mask off the high bits + // to get a value between 0 and 255. + int statusInt = statusByte & 0xFF; + if (statusInt >= 0xF0) { + // System messages use low nibble for size. + return SYSTEM_BYTE_LENGTHS[statusInt & 0x0F]; + } else if(statusInt >= 0x80) { + // Channel voice messages use high nibble for size. + return CHANNEL_BYTE_LENGTHS[(statusInt >> 4) - 8]; + } else { + return 0; // data byte + } + } + + /** + * @param msg + * @param offset + * @param count + * @return true if the entire message is ActiveSensing commands + */ + public static boolean isAllActiveSensing(byte[] msg, int offset, + int count) { + // Count bytes that are not active sensing. + int goodBytes = 0; + for (int i = 0; i < count; i++) { + byte b = msg[offset + i]; + if (b != MidiConstants.STATUS_ACTIVE_SENSING) { + goodBytes++; + } + } + return (goodBytes == 0); + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiDispatcher.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiDispatcher.java new file mode 100644 index 0000000000000000000000000000000000000000..b7f1fe1e856321d6d3caf533e38b065cd0ccf4c0 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiDispatcher.java @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +import android.media.midi.MidiReceiver; +import android.media.midi.MidiSender; + +import java.io.IOException; +import java.util.concurrent.CopyOnWriteArrayList; + +/** + * Utility class for dispatching MIDI data to a list of {@link MidiReceiver}s. + * This class subclasses {@link MidiReceiver} and dispatches any data it receives + * to its receiver list. Any receivers that throw an exception upon receiving data will + * be automatically removed from the receiver list, but no IOException will be returned + * from the dispatcher's {@link MidiReceiver#onReceive} in that case. + */ +public final class MidiDispatcher extends MidiReceiver { + + private final CopyOnWriteArrayList mReceivers + = new CopyOnWriteArrayList(); + + private final MidiSender mSender = new MidiSender() { + /** + * Called to connect a {@link MidiReceiver} to the sender + * + * @param receiver the receiver to connect + */ + @Override + public void onConnect(MidiReceiver receiver) { + mReceivers.add(receiver); + } + + /** + * Called to disconnect a {@link MidiReceiver} from the sender + * + * @param receiver the receiver to disconnect + */ + @Override + public void onDisconnect(MidiReceiver receiver) { + mReceivers.remove(receiver); + } + }; + + /** + * Returns the number of {@link MidiReceiver}s this dispatcher contains. + * @return the number of receivers + */ + public int getReceiverCount() { + return mReceivers.size(); + } + + /** + * Returns a {@link MidiSender} which is used to add and remove + * {@link MidiReceiver}s + * to the dispatcher's receiver list. + * @return the dispatcher's MidiSender + */ + public MidiSender getSender() { + return mSender; + } + + @Override + public void onSend(byte[] msg, int offset, int count, long timestamp) throws IOException { + for (MidiReceiver receiver : mReceivers) { + try { + receiver.send(msg, offset, count, timestamp); + } catch (IOException e) { + // if the receiver fails we remove the receiver but do not propagate the exception + mReceivers.remove(receiver); + } + } + } + + @Override + public void flush() throws IOException { + for (MidiReceiver receiver : mReceivers) { + receiver.flush(); + } + } +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiEventScheduler.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiEventScheduler.java new file mode 100644 index 0000000000000000000000000000000000000000..513d3939bbe005a10cac4b520eeebdc06eaf2708 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiEventScheduler.java @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +import android.media.midi.MidiReceiver; + +import java.io.IOException; + +/** + * Add MIDI Events to an EventScheduler + */ +public class MidiEventScheduler extends EventScheduler { + private static final String TAG = "MidiEventScheduler"; + // Maintain a pool of scheduled events to reduce memory allocation. + // This pool increases performance by about 14%. + private final static int POOL_EVENT_SIZE = 16; + private MidiReceiver mReceiver = new SchedulingReceiver(); + + private class SchedulingReceiver extends MidiReceiver + { + /** + * Store these bytes in the EventScheduler to be delivered at the specified + * time. + */ + @Override + public void onSend(byte[] msg, int offset, int count, long timestamp) + throws IOException { + MidiEvent event = createScheduledEvent(msg, offset, count, timestamp); + if (event != null) { + add(event); + } + } + } + + public static class MidiEvent extends SchedulableEvent { + public int count = 0; + public byte[] data; + + private MidiEvent(int count) { + super(0); + data = new byte[count]; + } + + private MidiEvent(byte[] msg, int offset, int count, long timestamp) { + super(timestamp); + data = new byte[count]; + System.arraycopy(msg, offset, data, 0, count); + this.count = count; + } + + @Override + public String toString() { + String text = "Event: "; + for (int i = 0; i < count; i++) { + text += data[i] + ", "; + } + return text; + } + } + + /** + * Create an event that contains the message. + */ + private MidiEvent createScheduledEvent(byte[] msg, int offset, int count, + long timestamp) { + MidiEvent event; + if (count > POOL_EVENT_SIZE) { + event = new MidiEvent(msg, offset, count, timestamp); + } else { + event = (MidiEvent) removeEventfromPool(); + if (event == null) { + event = new MidiEvent(POOL_EVENT_SIZE); + } + System.arraycopy(msg, offset, event.data, 0, count); + event.count = count; + event.setTimestamp(timestamp); + } + return event; + } + + /** + * Return events to a pool so they can be reused. + * + * @param event + */ + @Override + public void addEventToPool(SchedulableEvent event) { + // Make sure the event is suitable for the pool. + if (event instanceof MidiEvent) { + MidiEvent midiEvent = (MidiEvent) event; + if (midiEvent.data.length == POOL_EVENT_SIZE) { + super.addEventToPool(event); + } + } + } + + /** + * This MidiReceiver will write date to the scheduling buffer. + * @return the MidiReceiver + */ + public MidiReceiver getReceiver() { + return mReceiver; + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiEventThread.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiEventThread.java new file mode 100644 index 0000000000000000000000000000000000000000..626e83cf005bd3b91603135dce29f239c8685fa0 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiEventThread.java @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +import android.media.midi.MidiSender; +import android.util.Log; + +import java.io.IOException; + +public class MidiEventThread extends MidiEventScheduler { + protected static final String TAG = "MidiEventThread"; + + private EventThread mEventThread; + MidiDispatcher mDispatcher = new MidiDispatcher(); + + class EventThread extends Thread { + private boolean go = true; + + @Override + public void run() { + while (go) { + try { + MidiEvent event = (MidiEvent) waitNextEvent(); + try { + Log.i(TAG, "Fire event " + event.data[0] + " at " + + event.getTimestamp()); + mDispatcher.send(event.data, 0, + event.count, event.getTimestamp()); + } catch (IOException e) { + e.printStackTrace(); + } + // Put event back in the pool for future use. + addEventToPool(event); + } catch (InterruptedException e) { + // OK, this is how we stop the thread. + } + } + } + + /** + * Asynchronously tell the thread to stop. + */ + public void requestStop() { + go = false; + interrupt(); + } + } + + public void start() { + stop(); + mEventThread = new EventThread(); + mEventThread.start(); + } + + /** + * Asks the thread to stop then waits for it to stop. + */ + public void stop() { + if (mEventThread != null) { + mEventThread.requestStop(); + try { + mEventThread.join(500); + } catch (InterruptedException e) { + Log.e(TAG, + "Interrupted while waiting for MIDI EventScheduler thread to stop."); + } finally { + mEventThread = null; + } + } + } + + public MidiSender getSender() { + return mDispatcher.getSender(); + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiFramer.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiFramer.java new file mode 100644 index 0000000000000000000000000000000000000000..c274925ac85754eb93cd9cf7624baaa1e832bc1e --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiFramer.java @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +import android.media.midi.MidiReceiver; +import android.util.Log; + +import java.io.IOException; + +/** + * Convert stream of arbitrary MIDI bytes into discrete messages. + * + * Parses the incoming bytes and then posts individual messages to the receiver + * specified in the constructor. Short messages of 1-3 bytes will be complete. + * System Exclusive messages may be posted in pieces. + * + * Resolves Running Status and interleaved System Real-Time messages. + */ +public class MidiFramer extends MidiReceiver { + private MidiReceiver mReceiver; + private byte[] mBuffer = new byte[3]; + private int mCount; + private byte mRunningStatus; + private int mNeeded; + private boolean mInSysEx; + + public MidiFramer(MidiReceiver receiver) { + mReceiver = receiver; + } + + /* + * @see android.midi.MidiReceiver#onSend(byte[], int, int, long) + */ + @Override + public void onSend(byte[] data, int offset, int count, long timestamp) + throws IOException { + int sysExStartOffset = (mInSysEx ? offset : -1); + + for (int i = 0; i < count; i++) { + final byte currentByte = data[offset]; + final int currentInt = currentByte & 0xFF; + if (currentInt >= 0x80) { // status byte? + if (currentInt < 0xF0) { // channel message? + mRunningStatus = currentByte; + mCount = 1; + mNeeded = MidiConstants.getBytesPerMessage(currentByte) - 1; + } else if (currentInt < 0xF8) { // system common? + if (currentInt == 0xF0 /* SysEx Start */) { + // Log.i(TAG, "SysEx Start"); + mInSysEx = true; + sysExStartOffset = offset; + } else if (currentInt == 0xF7 /* SysEx End */) { + // Log.i(TAG, "SysEx End"); + if (mInSysEx) { + mReceiver.send(data, sysExStartOffset, + offset - sysExStartOffset + 1, timestamp); + mInSysEx = false; + sysExStartOffset = -1; + } + } else { + mBuffer[0] = currentByte; + mRunningStatus = 0; + mCount = 1; + mNeeded = MidiConstants.getBytesPerMessage(currentByte) - 1; + } + } else { // real-time? + // Single byte message interleaved with other data. + if (mInSysEx) { + mReceiver.send(data, sysExStartOffset, + offset - sysExStartOffset, timestamp); + sysExStartOffset = offset + 1; + } + mReceiver.send(data, offset, 1, timestamp); + } + } else { // data byte + if (!mInSysEx) { + mBuffer[mCount++] = currentByte; + if (--mNeeded == 0) { + if (mRunningStatus != 0) { + mBuffer[0] = mRunningStatus; + } + mReceiver.send(mBuffer, 0, mCount, timestamp); + mNeeded = MidiConstants.getBytesPerMessage(mBuffer[0]) - 1; + mCount = 1; + } + } + } + ++offset; + } + + // send any accumulatedSysEx data + if (sysExStartOffset >= 0 && sysExStartOffset < offset) { + mReceiver.send(data, sysExStartOffset, + offset - sysExStartOffset, timestamp); + } + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiInputPortSelector.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiInputPortSelector.java new file mode 100644 index 0000000000000000000000000000000000000000..7c665bacece28dde26e66722dd9dfa001d2024dd --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiInputPortSelector.java @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +import android.app.Activity; +import android.media.midi.MidiDevice; +import android.media.midi.MidiDeviceInfo; +import android.media.midi.MidiInputPort; +import android.media.midi.MidiManager; +import android.media.midi.MidiReceiver; +import android.os.Handler; +import android.os.Looper; +import android.util.Log; + +import java.io.IOException; + +/** + * Manages a Spinner for selecting a MidiInputPort. + */ +public class MidiInputPortSelector extends MidiPortSelector { + + private MidiInputPort mInputPort; + private MidiDevice mOpenDevice; + + /** + * @param midiManager + * @param activity + * @param spinnerId ID from the layout resource + */ + public MidiInputPortSelector(MidiManager midiManager, Activity activity, + int spinnerId) { + super(midiManager, activity, spinnerId, MidiDeviceInfo.PortInfo.TYPE_INPUT); + } + + @Override + public void onPortSelected(final MidiPortWrapper wrapper) { + close(); + final MidiDeviceInfo info = wrapper.getDeviceInfo(); + if (info != null) { + mMidiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() { + @Override + public void onDeviceOpened(MidiDevice device) { + if (device == null) { + Log.e(MidiConstants.TAG, "could not open " + info); + } else { + mOpenDevice = device; + mInputPort = mOpenDevice.openInputPort( + wrapper.getPortIndex()); + if (mInputPort == null) { + Log.e(MidiConstants.TAG, "could not open input port on " + info); + } + } + } + }, null); + // Don't run the callback on the UI thread because openInputPort might take a while. + } + } + + public MidiReceiver getReceiver() { + return mInputPort; + } + + @Override + public void onClose() { + try { + if (mInputPort != null) { + Log.i(MidiConstants.TAG, "MidiInputPortSelector.onClose() - close port"); + mInputPort.close(); + } + mInputPort = null; + if (mOpenDevice != null) { + mOpenDevice.close(); + } + mOpenDevice = null; + } catch (IOException e) { + Log.e(MidiConstants.TAG, "cleanup failed", e); + } + } +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiOutputPortConnectionSelector.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiOutputPortConnectionSelector.java new file mode 100644 index 0000000000000000000000000000000000000000..ca1ade48c931616a1d00aeca67942b9208f283ce --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiOutputPortConnectionSelector.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +import android.app.Activity; +import android.media.midi.MidiDeviceInfo; +import android.media.midi.MidiManager; +import android.util.Log; + +import java.io.IOException; + +/** + * Select an output port and connect it to a destination input port. + */ +public class MidiOutputPortConnectionSelector extends MidiPortSelector { + + private MidiPortConnector mSynthConnector; + private MidiDeviceInfo mDestinationDeviceInfo; + private int mDestinationPortIndex; + private MidiPortConnector.OnPortsConnectedListener mConnectedListener; + + /** + * @param midiManager + * @param activity + * @param spinnerId + * @param type + */ + public MidiOutputPortConnectionSelector(MidiManager midiManager, + Activity activity, int spinnerId, + MidiDeviceInfo destinationDeviceInfo, int destinationPortIndex) { + super(midiManager, activity, spinnerId, + MidiDeviceInfo.PortInfo.TYPE_OUTPUT); + mDestinationDeviceInfo = destinationDeviceInfo; + mDestinationPortIndex = destinationPortIndex; + } + + @Override + public void onPortSelected(final MidiPortWrapper wrapper) { + Log.i(MidiConstants.TAG, "connectPortToSynth: " + wrapper); + onClose(); + if (wrapper.getDeviceInfo() != null) { + mSynthConnector = new MidiPortConnector(mMidiManager); + mSynthConnector.connectToDevicePort(wrapper.getDeviceInfo(), + wrapper.getPortIndex(), mDestinationDeviceInfo, + mDestinationPortIndex, + // not safe on UI thread + mConnectedListener, null); + } + } + + @Override + public void onClose() { + try { + if (mSynthConnector != null) { + mSynthConnector.close(); + mSynthConnector = null; + } + } catch (IOException e) { + Log.e(MidiConstants.TAG, "Exception in closeSynthResources()", e); + } + } + + /** + * @param myPortsConnectedListener + */ + public void setConnectedListener( + MidiPortConnector.OnPortsConnectedListener connectedListener) { + mConnectedListener = connectedListener; + } +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiOutputPortSelector.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiOutputPortSelector.java new file mode 100644 index 0000000000000000000000000000000000000000..5aebf727e89399d16aad2e71c6da94cf7cf83252 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiOutputPortSelector.java @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +import android.app.Activity; +import android.media.midi.MidiDevice; +import android.media.midi.MidiDeviceInfo; +import android.media.midi.MidiManager; +import android.media.midi.MidiOutputPort; +import android.media.midi.MidiSender; +import android.os.Handler; +import android.os.Looper; +import android.util.Log; + +import java.io.IOException; + +/** + * Manages a Spinner for selecting a MidiOutputPort. + */ +public class MidiOutputPortSelector extends MidiPortSelector { + private MidiOutputPort mOutputPort; + private MidiDispatcher mDispatcher = new MidiDispatcher(); + private MidiDevice mOpenDevice; + + /** + * @param midiManager + * @param activity + * @param spinnerId ID from the layout resource + */ + public MidiOutputPortSelector(MidiManager midiManager, Activity activity, + int spinnerId) { + super(midiManager, activity, spinnerId, MidiDeviceInfo.PortInfo.TYPE_OUTPUT); + } + + @Override + public void onPortSelected(final MidiPortWrapper wrapper) { + Log.i(MidiConstants.TAG, "onPortSelected: " + wrapper); + close(); + + final MidiDeviceInfo info = wrapper.getDeviceInfo(); + if (info != null) { + mMidiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() { + + @Override + public void onDeviceOpened(MidiDevice device) { + if (device == null) { + Log.e(MidiConstants.TAG, "could not open " + info); + } else { + mOpenDevice = device; + mOutputPort = device.openOutputPort(wrapper.getPortIndex()); + if (mOutputPort == null) { + Log.e(MidiConstants.TAG, + "could not open output port for " + info); + return; + } + mOutputPort.connect(mDispatcher); + } + } + }, null); + // Don't run the callback on the UI thread because openOutputPort might take a while. + } + } + + @Override + public void onClose() { + try { + if (mOutputPort != null) { + mOutputPort.disconnect(mDispatcher); + } + mOutputPort = null; + if (mOpenDevice != null) { + mOpenDevice.close(); + } + mOpenDevice = null; + } catch (IOException e) { + Log.e(MidiConstants.TAG, "cleanup failed", e); + } + } + + /** + * You can connect your MidiReceivers to this sender. The user will then select which output + * port will send messages through this MidiSender. + * @return a MidiSender that will send the messages from the selected port. + */ + public MidiSender getSender() { + return mDispatcher.getSender(); + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiPortConnector.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiPortConnector.java new file mode 100644 index 0000000000000000000000000000000000000000..457494d1b5ebf995d41c1e49e169f89568515453 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiPortConnector.java @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +import android.media.midi.MidiDevice; +import android.media.midi.MidiDevice.MidiConnection; +import android.media.midi.MidiDeviceInfo; +import android.media.midi.MidiInputPort; +import android.media.midi.MidiManager; +import android.os.Handler; +import android.util.Log; + +import java.io.IOException; + +/** + * Tool for connecting MIDI ports on two remote devices. + */ +public class MidiPortConnector { + private final MidiManager mMidiManager; + private MidiDevice mSourceDevice; + private MidiDevice mDestinationDevice; + private MidiConnection mConnection; + + /** + * @param mMidiManager + */ + public MidiPortConnector(MidiManager midiManager) { + mMidiManager = midiManager; + } + + public void close() throws IOException { + if (mConnection != null) { + Log.i(MidiConstants.TAG, + "MidiPortConnector closing connection " + mConnection); + mConnection.close(); + mConnection = null; + } + if (mSourceDevice != null) { + mSourceDevice.close(); + mSourceDevice = null; + } + if (mDestinationDevice != null) { + mDestinationDevice.close(); + mDestinationDevice = null; + } + } + + private void safeClose() { + try { + close(); + } catch (IOException e) { + Log.e(MidiConstants.TAG, "could not close resources", e); + } + } + + /** + * Listener class used for receiving the results of + * {@link #connectToDevicePort} + */ + public interface OnPortsConnectedListener { + /** + * Called to respond to a {@link #connectToDevicePort} request + * + * @param connection + * a {@link MidiConnection} that represents the connected + * ports, or null if connection failed + */ + abstract public void onPortsConnected(MidiConnection connection); + } + + /** + * Open two devices and connect their ports. + * + * @param sourceDeviceInfo + * @param sourcePortIndex + * @param destinationDeviceInfo + * @param destinationPortIndex + */ + public void connectToDevicePort(final MidiDeviceInfo sourceDeviceInfo, + final int sourcePortIndex, + final MidiDeviceInfo destinationDeviceInfo, + final int destinationPortIndex) { + connectToDevicePort(sourceDeviceInfo, sourcePortIndex, + destinationDeviceInfo, destinationPortIndex, null, null); + } + + /** + * Open two devices and connect their ports. + * + * @param sourceDeviceInfo + * @param sourcePortIndex + * @param destinationDeviceInfo + * @param destinationPortIndex + */ + public void connectToDevicePort(final MidiDeviceInfo sourceDeviceInfo, + final int sourcePortIndex, + final MidiDeviceInfo destinationDeviceInfo, + final int destinationPortIndex, + final OnPortsConnectedListener listener, final Handler handler) { + safeClose(); + mMidiManager.openDevice(destinationDeviceInfo, + new MidiManager.OnDeviceOpenedListener() { + @Override + public void onDeviceOpened(MidiDevice destinationDevice) { + if (destinationDevice == null) { + Log.e(MidiConstants.TAG, + "could not open " + destinationDeviceInfo); + if (listener != null) { + listener.onPortsConnected(null); + } + } else { + mDestinationDevice = destinationDevice; + Log.i(MidiConstants.TAG, + "connectToDevicePort opened " + + destinationDeviceInfo); + // Destination device was opened so go to next step. + MidiInputPort destinationInputPort = destinationDevice + .openInputPort(destinationPortIndex); + if (destinationInputPort != null) { + Log.i(MidiConstants.TAG, + "connectToDevicePort opened port on " + + destinationDeviceInfo); + connectToDevicePort(sourceDeviceInfo, + sourcePortIndex, + destinationInputPort, + listener, handler); + } else { + Log.e(MidiConstants.TAG, + "could not open port on " + + destinationDeviceInfo); + safeClose(); + if (listener != null) { + listener.onPortsConnected(null); + } + } + } + } + }, handler); + } + + + /** + * Open a source device and connect its output port to the + * destinationInputPort. + * + * @param sourceDeviceInfo + * @param sourcePortIndex + * @param destinationInputPort + */ + private void connectToDevicePort(final MidiDeviceInfo sourceDeviceInfo, + final int sourcePortIndex, + final MidiInputPort destinationInputPort, + final OnPortsConnectedListener listener, final Handler handler) { + mMidiManager.openDevice(sourceDeviceInfo, + new MidiManager.OnDeviceOpenedListener() { + @Override + public void onDeviceOpened(MidiDevice device) { + if (device == null) { + Log.e(MidiConstants.TAG, + "could not open " + sourceDeviceInfo); + safeClose(); + if (listener != null) { + listener.onPortsConnected(null); + } + } else { + Log.i(MidiConstants.TAG, + "connectToDevicePort opened " + + sourceDeviceInfo); + // Device was opened so connect the ports. + mSourceDevice = device; + mConnection = device.connectPorts( + destinationInputPort, sourcePortIndex); + if (mConnection == null) { + Log.e(MidiConstants.TAG, "could not connect to " + + sourceDeviceInfo); + safeClose(); + } + if (listener != null) { + listener.onPortsConnected(mConnection); + } + } + } + }, handler); + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiPortSelector.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiPortSelector.java new file mode 100644 index 0000000000000000000000000000000000000000..39f983e38f83cc145463195ae429b08afa87dc5d --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiPortSelector.java @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +import android.app.Activity; +import android.media.midi.MidiDeviceInfo; +import android.media.midi.MidiDeviceStatus; +import android.media.midi.MidiManager; +import android.media.midi.MidiManager.DeviceCallback; +import android.os.Handler; +import android.os.Looper; +import android.util.Log; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Spinner; + +import java.util.HashSet; + +/** + * Base class that uses a Spinner to select available MIDI ports. + */ +public abstract class MidiPortSelector extends DeviceCallback { + private int mType = MidiDeviceInfo.PortInfo.TYPE_INPUT; + protected ArrayAdapter mAdapter; + protected HashSet mBusyPorts = new HashSet(); + private Spinner mSpinner; + protected MidiManager mMidiManager; + protected Activity mActivity; + private MidiPortWrapper mCurrentWrapper; + + /** + * @param midiManager + * @param activity + * @param spinnerId + * ID from the layout resource + * @param type + * TYPE_INPUT or TYPE_OUTPUT + */ + public MidiPortSelector(MidiManager midiManager, Activity activity, + int spinnerId, int type) { + mMidiManager = midiManager; + mActivity = activity; + mType = type; + mAdapter = new ArrayAdapter(activity, + android.R.layout.simple_spinner_item); + mAdapter.setDropDownViewResource( + android.R.layout.simple_spinner_dropdown_item); + mAdapter.add(new MidiPortWrapper(null, 0, 0)); + + mSpinner = (Spinner) activity.findViewById(spinnerId); + mSpinner.setOnItemSelectedListener( + new AdapterView.OnItemSelectedListener() { + + public void onItemSelected(AdapterView parent, View view, + int pos, long id) { + mCurrentWrapper = mAdapter.getItem(pos); + onPortSelected(mCurrentWrapper); + } + + public void onNothingSelected(AdapterView parent) { + onPortSelected(null); + mCurrentWrapper = null; + } + }); + mSpinner.setAdapter(mAdapter); + + mMidiManager.registerDeviceCallback(this, + new Handler(Looper.getMainLooper())); + + MidiDeviceInfo[] infos = mMidiManager.getDevices(); + for (MidiDeviceInfo info : infos) { + onDeviceAdded(info); + } + } + + /** + * Set to no port selected. + */ + public void clearSelection() { + mSpinner.setSelection(0); + } + + private int getInfoPortCount(final MidiDeviceInfo info) { + int portCount = (mType == MidiDeviceInfo.PortInfo.TYPE_INPUT) + ? info.getInputPortCount() : info.getOutputPortCount(); + return portCount; + } + + @Override + public void onDeviceAdded(final MidiDeviceInfo info) { + int portCount = getInfoPortCount(info); + for (int i = 0; i < portCount; ++i) { + MidiPortWrapper wrapper = new MidiPortWrapper(info, mType, i); + mAdapter.add(wrapper); + Log.i(MidiConstants.TAG, wrapper + " was added"); + mAdapter.notifyDataSetChanged(); + } + } + + @Override + public void onDeviceRemoved(final MidiDeviceInfo info) { + int portCount = getInfoPortCount(info); + for (int i = 0; i < portCount; ++i) { + MidiPortWrapper wrapper = new MidiPortWrapper(info, mType, i); + MidiPortWrapper currentWrapper = mCurrentWrapper; + mAdapter.remove(wrapper); + // If the currently selected port was removed then select no port. + if (wrapper.equals(currentWrapper)) { + clearSelection(); + } + mAdapter.notifyDataSetChanged(); + Log.i(MidiConstants.TAG, wrapper + " was removed"); + } + } + + @Override + public void onDeviceStatusChanged(final MidiDeviceStatus status) { + // If an input port becomes busy then remove it from the menu. + // If it becomes free then add it back to the menu. + if (mType == MidiDeviceInfo.PortInfo.TYPE_INPUT) { + MidiDeviceInfo info = status.getDeviceInfo(); + Log.i(MidiConstants.TAG, "MidiPortSelector.onDeviceStatusChanged status = " + status + + ", mType = " + mType + + ", activity = " + mActivity.getPackageName() + + ", info = " + info); + // Look for transitions from free to busy. + int portCount = info.getInputPortCount(); + for (int i = 0; i < portCount; ++i) { + MidiPortWrapper wrapper = new MidiPortWrapper(info, mType, i); + if (!wrapper.equals(mCurrentWrapper)) { + if (status.isInputPortOpen(i)) { // busy? + if (!mBusyPorts.contains(wrapper)) { + // was free, now busy + mBusyPorts.add(wrapper); + mAdapter.remove(wrapper); + mAdapter.notifyDataSetChanged(); + } + } else { + if (mBusyPorts.remove(wrapper)) { + // was busy, now free + mAdapter.add(wrapper); + mAdapter.notifyDataSetChanged(); + } + } + } + } + } + } + + /** + * Implement this method to handle the user selecting a port on a device. + * + * @param wrapper + */ + public abstract void onPortSelected(MidiPortWrapper wrapper); + + /** + * Implement this method to clean up any open resources. + */ + public abstract void onClose(); + + /** + * + */ + public void close() { + onClose(); + } +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiPortWrapper.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiPortWrapper.java new file mode 100644 index 0000000000000000000000000000000000000000..77aa73458edc01a9ccbc4a95af19fef00658225a --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiPortWrapper.java @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +import android.media.midi.MidiDeviceInfo; +import android.media.midi.MidiDeviceInfo.PortInfo; +import android.util.Log; + +// Wrapper for a MIDI device and port description. +public class MidiPortWrapper { + private MidiDeviceInfo mInfo; + private int mPortIndex; + private int mType; + private String mString; + + /** + * Wrapper for a MIDI device and port description. + * @param info + * @param portType + * @param portIndex + */ + public MidiPortWrapper(MidiDeviceInfo info, int portType, int portIndex) { + mInfo = info; + mType = portType; + mPortIndex = portIndex; + } + + private void updateString() { + if (mInfo == null) { + mString = "- - - - - -"; + } else { + StringBuilder sb = new StringBuilder(); + String name = mInfo.getProperties() + .getString(MidiDeviceInfo.PROPERTY_NAME); + if (name == null) { + name = mInfo.getProperties() + .getString(MidiDeviceInfo.PROPERTY_MANUFACTURER) + ", " + + mInfo.getProperties() + .getString(MidiDeviceInfo.PROPERTY_PRODUCT); + } + sb.append("#" + mInfo.getId()); + sb.append(", ").append(name); + PortInfo portInfo = findPortInfo(); + sb.append("[" + mPortIndex + "]"); + if (portInfo != null) { + sb.append(", ").append(portInfo.getName()); + } else { + sb.append(", null"); + } + mString = sb.toString(); + } + } + + /** + * @param info + * @param portIndex + * @return + */ + private PortInfo findPortInfo() { + PortInfo[] ports = mInfo.getPorts(); + for (PortInfo portInfo : ports) { + if (portInfo.getPortNumber() == mPortIndex + && portInfo.getType() == mType) { + return portInfo; + } + } + return null; + } + + public int getPortIndex() { + return mPortIndex; + } + + public MidiDeviceInfo getDeviceInfo() { + return mInfo; + } + + @Override + public String toString() { + if (mString == null) { + updateString(); + } + return mString; + } + + @Override + public boolean equals(Object other) { + if (other == null) + return false; + if (!(other instanceof MidiPortWrapper)) + return false; + MidiPortWrapper otherWrapper = (MidiPortWrapper) other; + if (mPortIndex != otherWrapper.mPortIndex) + return false; + if (mType != otherWrapper.mType) + return false; + if (mInfo == null) + return (otherWrapper.mInfo == null); + return mInfo.equals(otherWrapper.mInfo); + } + + @Override + public int hashCode() { + int hashCode = 1; + hashCode = 31 * hashCode + mPortIndex; + hashCode = 31 * hashCode + mType; + hashCode = 31 * hashCode + mInfo.hashCode(); + return hashCode; + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiTools.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiTools.java new file mode 100644 index 0000000000000000000000000000000000000000..82e3de4bacd5dcda12b4c38167275189ac90021a --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiTools.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi; + +import android.media.midi.MidiDeviceInfo; +import android.media.midi.MidiManager; + +/** + * Miscellaneous tools for Android MIDI. + */ +public class MidiTools { + + /** + * @return a device that matches the manufacturer and product or null + */ + public static MidiDeviceInfo findDevice(MidiManager midiManager, + String manufacturer, String product) { + for (MidiDeviceInfo info : midiManager.getDevices()) { + String deviceManufacturer = info.getProperties() + .getString(MidiDeviceInfo.PROPERTY_MANUFACTURER); + if ((manufacturer != null) + && manufacturer.equals(deviceManufacturer)) { + String deviceProduct = info.getProperties() + .getString(MidiDeviceInfo.PROPERTY_PRODUCT); + if ((product != null) && product.equals(deviceProduct)) { + return info; + } + } + } + return null; + } +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/EnvelopeADSR.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/EnvelopeADSR.java new file mode 100644 index 0000000000000000000000000000000000000000..a29a1933efee4cfd48c841ca36fa0812d7bb8a0d --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/EnvelopeADSR.java @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi.synth; + +/** + * Very simple Attack, Decay, Sustain, Release envelope with linear ramps. + * + * Times are in seconds. + */ +public class EnvelopeADSR extends SynthUnit { + private static final int IDLE = 0; + private static final int ATTACK = 1; + private static final int DECAY = 2; + private static final int SUSTAIN = 3; + private static final int RELEASE = 4; + private static final int FINISHED = 5; + private static final float MIN_TIME = 0.001f; + + private float mAttackRate; + private float mRreleaseRate; + private float mSustainLevel; + private float mDecayRate; + private float mCurrent; + private int mSstate = IDLE; + + public EnvelopeADSR() { + setAttackTime(0.003f); + setDecayTime(0.08f); + setSustainLevel(0.3f); + setReleaseTime(1.0f); + } + + public void setAttackTime(float time) { + if (time < MIN_TIME) + time = MIN_TIME; + mAttackRate = 1.0f / (SynthEngine.FRAME_RATE * time); + } + + public void setDecayTime(float time) { + if (time < MIN_TIME) + time = MIN_TIME; + mDecayRate = 1.0f / (SynthEngine.FRAME_RATE * time); + } + + public void setSustainLevel(float level) { + if (level < 0.0f) + level = 0.0f; + mSustainLevel = level; + } + + public void setReleaseTime(float time) { + if (time < MIN_TIME) + time = MIN_TIME; + mRreleaseRate = 1.0f / (SynthEngine.FRAME_RATE * time); + } + + public void on() { + mSstate = ATTACK; + } + + public void off() { + mSstate = RELEASE; + } + + @Override + public float render() { + switch (mSstate) { + case ATTACK: + mCurrent += mAttackRate; + if (mCurrent > 1.0f) { + mCurrent = 1.0f; + mSstate = DECAY; + } + break; + case DECAY: + mCurrent -= mDecayRate; + if (mCurrent < mSustainLevel) { + mCurrent = mSustainLevel; + mSstate = SUSTAIN; + } + break; + case RELEASE: + mCurrent -= mRreleaseRate; + if (mCurrent < 0.0f) { + mCurrent = 0.0f; + mSstate = FINISHED; + } + break; + } + return mCurrent; + } + + public boolean isDone() { + return mSstate == FINISHED; + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SawOscillator.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SawOscillator.java new file mode 100644 index 0000000000000000000000000000000000000000..c02a6a1a5b5daaf49468ceac6e3cdbeb14731a83 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SawOscillator.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi.synth; + +public class SawOscillator extends SynthUnit { + private float mPhase = 0.0f; + private float mPhaseIncrement = 0.01f; + private float mFrequency = 0.0f; + private float mFrequencyScaler = 1.0f; + private float mAmplitude = 1.0f; + + public void setPitch(float pitch) { + float freq = (float) pitchToFrequency(pitch); + setFrequency(freq); + } + + public void setFrequency(float frequency) { + mFrequency = frequency; + updatePhaseIncrement(); + } + + private void updatePhaseIncrement() { + mPhaseIncrement = 2.0f * mFrequency * mFrequencyScaler / 48000.0f; + } + + public void setAmplitude(float amplitude) { + mAmplitude = amplitude; + } + + public float getAmplitude() { + return mAmplitude; + } + + public float getFrequencyScaler() { + return mFrequencyScaler; + } + + public void setFrequencyScaler(float frequencyScaler) { + mFrequencyScaler = frequencyScaler; + updatePhaseIncrement(); + } + + float incrementWrapPhase() { + mPhase += mPhaseIncrement; + while (mPhase > 1.0) { + mPhase -= 2.0; + } + while (mPhase < -1.0) { + mPhase += 2.0; + } + return mPhase; + } + + @Override + public float render() { + return incrementWrapPhase() * mAmplitude; + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SawOscillatorDPW.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SawOscillatorDPW.java new file mode 100644 index 0000000000000000000000000000000000000000..e5d661d561b7cd771f2e06be7a015a77495a8a21 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SawOscillatorDPW.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi.synth; + +/** + * Band limited sawtooth oscillator. + * This will have very little aliasing at high frequencies. + */ +public class SawOscillatorDPW extends SawOscillator { + private float mZ1 = 0.0f; // delayed values + private float mZ2 = 0.0f; + private float mScaler; // frequency dependent scaler + private final static float VERY_LOW_FREQ = 0.0000001f; + + @Override + public void setFrequency(float freq) { + /* Calculate scaling based on frequency. */ + freq = Math.abs(freq); + super.setFrequency(freq); + if (freq < VERY_LOW_FREQ) { + mScaler = (float) (0.125 * 44100 / VERY_LOW_FREQ); + } else { + mScaler = (float) (0.125 * 44100 / freq); + } + } + + @Override + public float render() { + float phase = incrementWrapPhase(); + /* Square the raw sawtooth. */ + float squared = phase * phase; + float diffed = squared - mZ2; + mZ2 = mZ1; + mZ1 = squared; + return diffed * mScaler * getAmplitude(); + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SawVoice.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SawVoice.java new file mode 100644 index 0000000000000000000000000000000000000000..3b3e543e8cd1083dd0bf619efd8e0b8dfbbd6f18 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SawVoice.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi.synth; + +/** + * Sawtooth oscillator with an ADSR. + */ +public class SawVoice extends SynthVoice { + private SawOscillator mOscillator; + private EnvelopeADSR mEnvelope; + + public SawVoice() { + mOscillator = createOscillator(); + mEnvelope = new EnvelopeADSR(); + } + + protected SawOscillator createOscillator() { + return new SawOscillator(); + } + + @Override + public void noteOn(int noteIndex, int velocity) { + super.noteOn(noteIndex, velocity); + mOscillator.setPitch(noteIndex); + mOscillator.setAmplitude(getAmplitude()); + mEnvelope.on(); + } + + @Override + public void noteOff() { + super.noteOff(); + mEnvelope.off(); + } + + @Override + public void setFrequencyScaler(float scaler) { + mOscillator.setFrequencyScaler(scaler); + } + + @Override + public float render() { + float output = mOscillator.render() * mEnvelope.render(); + return output; + } + + @Override + public boolean isDone() { + return mEnvelope.isDone(); + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SimpleAudioOutput.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SimpleAudioOutput.java new file mode 100644 index 0000000000000000000000000000000000000000..04aa19c0b194c4de253025e5e132bf345d7e102b --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SimpleAudioOutput.java @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi.synth; + +import android.media.AudioFormat; +import android.media.AudioManager; +import android.media.AudioTrack; +import android.util.Log; + +/** + * Simple base class for implementing audio output for examples. + * This can be sub-classed for experimentation or to redirect audio output. + */ +public class SimpleAudioOutput { + + private static final String TAG = "AudioOutputTrack"; + public static final int SAMPLES_PER_FRAME = 2; + public static final int BYTES_PER_SAMPLE = 4; // float + public static final int BYTES_PER_FRAME = SAMPLES_PER_FRAME * BYTES_PER_SAMPLE; + private AudioTrack mAudioTrack; + private int mFrameRate; + + /** + * + */ + public SimpleAudioOutput() { + super(); + } + + /** + * Create an audio track then call play(). + * + * @param frameRate + */ + public void start(int frameRate) { + stop(); + mFrameRate = frameRate; + mAudioTrack = createAudioTrack(frameRate); + // AudioTrack will wait until it has enough data before starting. + mAudioTrack.play(); + } + + public AudioTrack createAudioTrack(int frameRate) { + int minBufferSizeBytes = AudioTrack.getMinBufferSize(frameRate, + AudioFormat.CHANNEL_OUT_STEREO, AudioFormat.ENCODING_PCM_FLOAT); + Log.i(TAG, "AudioTrack.minBufferSize = " + minBufferSizeBytes + + " bytes = " + (minBufferSizeBytes / BYTES_PER_FRAME) + + " frames"); + int bufferSize = 8 * minBufferSizeBytes / 8; + int outputBufferSizeFrames = bufferSize / BYTES_PER_FRAME; + Log.i(TAG, "actual bufferSize = " + bufferSize + " bytes = " + + outputBufferSizeFrames + " frames"); + + AudioTrack player = new AudioTrack(AudioManager.STREAM_MUSIC, + mFrameRate, AudioFormat.CHANNEL_OUT_STEREO, + AudioFormat.ENCODING_PCM_FLOAT, bufferSize, + AudioTrack.MODE_STREAM); + Log.i(TAG, "created AudioTrack"); + return player; + } + + public int write(float[] buffer, int offset, int length) { + return mAudioTrack.write(buffer, offset, length, + AudioTrack.WRITE_BLOCKING); + } + + public void stop() { + if (mAudioTrack != null) { + mAudioTrack.stop(); + mAudioTrack = null; + } + } + + public int getFrameRate() { + return mFrameRate; + } + + public AudioTrack getAudioTrack() { + return mAudioTrack; + } +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SineOscillator.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SineOscillator.java new file mode 100644 index 0000000000000000000000000000000000000000..c638c344ce3ac8e4c34c2a12010eeb1abf96ef50 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SineOscillator.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi.synth; + +/** + * Sinewave oscillator. + */ +public class SineOscillator extends SawOscillator { + // Factorial constants. + private static final float IF3 = 1.0f / (2 * 3); + private static final float IF5 = IF3 / (4 * 5); + private static final float IF7 = IF5 / (6 * 7); + private static final float IF9 = IF7 / (8 * 9); + private static final float IF11 = IF9 / (10 * 11); + + /** + * Calculate sine using Taylor expansion. Do not use values outside the range. + * + * @param currentPhase in the range of -1.0 to +1.0 for one cycle + */ + public static float fastSin(float currentPhase) { + + /* Wrap phase back into region where results are more accurate. */ + float yp = (currentPhase > 0.5f) ? 1.0f - currentPhase + : ((currentPhase < (-0.5f)) ? (-1.0f) - currentPhase : currentPhase); + + float x = (float) (yp * Math.PI); + float x2 = (x * x); + /* Taylor expansion out to x**11/11! factored into multiply-adds */ + return x * (x2 * (x2 * (x2 * (x2 * ((x2 * (-IF11)) + IF9) - IF7) + IF5) - IF3) + 1); + } + + @Override + public float render() { + // Convert raw sawtooth to sine. + float phase = incrementWrapPhase(); + return fastSin(phase) * getAmplitude(); + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SineVoice.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SineVoice.java new file mode 100644 index 0000000000000000000000000000000000000000..e80d2c7eb33ab5af6b02fb7dc2aac9396788e235 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SineVoice.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi.synth; + +/** + * Replace sawtooth with a sine wave. + */ +public class SineVoice extends SawVoice { + @Override + protected SawOscillator createOscillator() { + return new SineOscillator(); + } +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SynthEngine.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SynthEngine.java new file mode 100644 index 0000000000000000000000000000000000000000..6cd02a6090e4b7408db0c21df2caee76c371c8ec --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SynthEngine.java @@ -0,0 +1,284 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi.synth; + +import android.media.midi.MidiReceiver; +import android.util.Log; + +import com.example.android.common.midi.MidiConstants; +import com.example.android.common.midi.MidiEventScheduler; +import com.example.android.common.midi.MidiEventScheduler.MidiEvent; +import com.example.android.common.midi.MidiFramer; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; + +/** + * Very simple polyphonic, single channel synthesizer. It runs a background + * thread that processes MIDI events and synthesizes audio. + */ +public class SynthEngine extends MidiReceiver { + + private static final String TAG = "SynthEngine"; + + public static final int FRAME_RATE = 48000; + private static final int FRAMES_PER_BUFFER = 240; + private static final int SAMPLES_PER_FRAME = 2; + + private boolean go; + private Thread mThread; + private float[] mBuffer = new float[FRAMES_PER_BUFFER * SAMPLES_PER_FRAME]; + private float mFrequencyScaler = 1.0f; + private float mBendRange = 2.0f; // semitones + private int mProgram; + + private ArrayList mFreeVoices = new ArrayList(); + private Hashtable + mVoices = new Hashtable(); + private MidiEventScheduler mEventScheduler; + private MidiFramer mFramer; + private MidiReceiver mReceiver = new MyReceiver(); + private SimpleAudioOutput mAudioOutput; + + public SynthEngine() { + this(new SimpleAudioOutput()); + } + + public SynthEngine(SimpleAudioOutput audioOutput) { + mReceiver = new MyReceiver(); + mFramer = new MidiFramer(mReceiver); + mAudioOutput = audioOutput; + } + + @Override + public void onSend(byte[] data, int offset, int count, long timestamp) + throws IOException { + if (mEventScheduler != null) { + if (!MidiConstants.isAllActiveSensing(data, offset, count)) { + mEventScheduler.getReceiver().send(data, offset, count, + timestamp); + } + } + } + + private class MyReceiver extends MidiReceiver { + @Override + public void onSend(byte[] data, int offset, int count, long timestamp) + throws IOException { + byte command = (byte) (data[0] & MidiConstants.STATUS_COMMAND_MASK); + int channel = (byte) (data[0] & MidiConstants.STATUS_CHANNEL_MASK); + switch (command) { + case MidiConstants.STATUS_NOTE_OFF: + noteOff(channel, data[1], data[2]); + break; + case MidiConstants.STATUS_NOTE_ON: + noteOn(channel, data[1], data[2]); + break; + case MidiConstants.STATUS_PITCH_BEND: + int bend = (data[2] << 7) + data[1]; + pitchBend(channel, bend); + break; + case MidiConstants.STATUS_PROGRAM_CHANGE: + mProgram = data[1]; + mFreeVoices.clear(); + break; + default: + logMidiMessage(data, offset, count); + break; + } + } + } + + class MyRunnable implements Runnable { + @Override + public void run() { + try { + mAudioOutput.start(FRAME_RATE); + onLoopStarted(); + while (go) { + processMidiEvents(); + generateBuffer(); + mAudioOutput.write(mBuffer, 0, mBuffer.length); + onBufferCompleted(FRAMES_PER_BUFFER); + } + } catch (Exception e) { + Log.e(TAG, "SynthEngine background thread exception.", e); + } finally { + onLoopEnded(); + mAudioOutput.stop(); + } + } + } + + /** + * This is called form the synthesis thread before it starts looping. + */ + public void onLoopStarted() { + } + + /** + * This is called once at the end of each synthesis loop. + * + * @param framesPerBuffer + */ + public void onBufferCompleted(int framesPerBuffer) { + } + + /** + * This is called form the synthesis thread when it stop looping. + */ + public void onLoopEnded() { + } + + /** + * Assume message has been aligned to the start of a MIDI message. + * + * @param data + * @param offset + * @param count + */ + public void logMidiMessage(byte[] data, int offset, int count) { + String text = "Received: "; + for (int i = 0; i < count; i++) { + text += String.format("0x%02X, ", data[offset + i]); + } + Log.i(TAG, text); + } + + /** + * @throws IOException + * + */ + private void processMidiEvents() throws IOException { + long now = System.nanoTime(); // TODO use audio presentation time + MidiEvent event = (MidiEvent) mEventScheduler.getNextEvent(now); + while (event != null) { + mFramer.send(event.data, 0, event.count, event.getTimestamp()); + mEventScheduler.addEventToPool(event); + event = (MidiEvent) mEventScheduler.getNextEvent(now); + } + } + + /** + * + */ + private void generateBuffer() { + for (int i = 0; i < mBuffer.length; i++) { + mBuffer[i] = 0.0f; + } + Iterator iterator = mVoices.values().iterator(); + while (iterator.hasNext()) { + SynthVoice voice = iterator.next(); + if (voice.isDone()) { + iterator.remove(); + // mFreeVoices.add(voice); + } else { + voice.mix(mBuffer, SAMPLES_PER_FRAME, 0.25f); + } + } + } + + public void noteOff(int channel, int noteIndex, int velocity) { + SynthVoice voice = mVoices.get(noteIndex); + if (voice != null) { + voice.noteOff(); + } + } + + public void allNotesOff() { + Iterator iterator = mVoices.values().iterator(); + while (iterator.hasNext()) { + SynthVoice voice = iterator.next(); + voice.noteOff(); + } + } + + /** + * Create a SynthVoice. + */ + public SynthVoice createVoice(int program) { + // For every odd program number use a sine wave. + if ((program & 1) == 1) { + return new SineVoice(); + } else { + return new SawVoice(); + } + } + + /** + * + * @param channel + * @param noteIndex + * @param velocity + */ + public void noteOn(int channel, int noteIndex, int velocity) { + if (velocity == 0) { + noteOff(channel, noteIndex, velocity); + } else { + mVoices.remove(noteIndex); + SynthVoice voice; + if (mFreeVoices.size() > 0) { + voice = mFreeVoices.remove(mFreeVoices.size() - 1); + } else { + voice = createVoice(mProgram); + } + voice.setFrequencyScaler(mFrequencyScaler); + voice.noteOn(noteIndex, velocity); + mVoices.put(noteIndex, voice); + } + } + + public void pitchBend(int channel, int bend) { + double semitones = (mBendRange * (bend - 0x2000)) / 0x2000; + mFrequencyScaler = (float) Math.pow(2.0, semitones / 12.0); + Iterator iterator = mVoices.values().iterator(); + while (iterator.hasNext()) { + SynthVoice voice = iterator.next(); + voice.setFrequencyScaler(mFrequencyScaler); + } + } + + /** + * Start the synthesizer. + */ + public void start() { + stop(); + go = true; + mThread = new Thread(new MyRunnable()); + mEventScheduler = new MidiEventScheduler(); + mThread.start(); + } + + /** + * Stop the synthesizer. + */ + public void stop() { + go = false; + if (mThread != null) { + try { + mThread.interrupt(); + mThread.join(500); + } catch (InterruptedException e) { + // OK, just stopping safely. + } + mThread = null; + mEventScheduler = null; + } + } +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SynthUnit.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SynthUnit.java new file mode 100644 index 0000000000000000000000000000000000000000..90599e284eaefb257099e3543391dcddef089409 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SynthUnit.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi.synth; + +public abstract class SynthUnit { + + private static final double CONCERT_A_PITCH = 69.0; + private static final double CONCERT_A_FREQUENCY = 440.0; + + /** + * @param pitch + * MIDI pitch in semitones + * @return frequency + */ + public static double pitchToFrequency(double pitch) { + double semitones = pitch - CONCERT_A_PITCH; + return CONCERT_A_FREQUENCY * Math.pow(2.0, semitones / 12.0); + } + + public abstract float render(); +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SynthVoice.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SynthVoice.java new file mode 100644 index 0000000000000000000000000000000000000000..78ba09ac40bc6c5ba63e6ea18c682a61a8984925 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/common/midi/synth/SynthVoice.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.common.midi.synth; + +/** + * Base class for a polyphonic synthesizer voice. + */ +public abstract class SynthVoice { + private int mNoteIndex; + private float mAmplitude; + public static final int STATE_OFF = 0; + public static final int STATE_ON = 1; + private int mState = STATE_OFF; + + public SynthVoice() { + mNoteIndex = -1; + } + + public void noteOn(int noteIndex, int velocity) { + mState = STATE_ON; + this.mNoteIndex = noteIndex; + setAmplitude(velocity / 128.0f); + } + + public void noteOff() { + mState = STATE_OFF; + } + + /** + * Add the output of this voice to an output buffer. + * + * @param outputBuffer + * @param samplesPerFrame + * @param level + */ + public void mix(float[] outputBuffer, int samplesPerFrame, float level) { + int numFrames = outputBuffer.length / samplesPerFrame; + for (int i = 0; i < numFrames; i++) { + float output = render(); + int offset = i * samplesPerFrame; + for (int jf = 0; jf < samplesPerFrame; jf++) { + outputBuffer[offset + jf] += output * level; + } + } + } + + public abstract float render(); + + public boolean isDone() { + return mState == STATE_OFF; + } + + public int getNoteIndex() { + return mNoteIndex; + } + + public float getAmplitude() { + return mAmplitude; + } + + public void setAmplitude(float amplitude) { + this.mAmplitude = amplitude; + } + + /** + * @param scaler + */ + public void setFrequencyScaler(float scaler) { + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/midisynth/MainActivity.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/midisynth/MainActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..92964b4833a43c356216374c1fa327d4da16eebf --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/midisynth/MainActivity.java @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.midisynth; + +import android.app.ActionBar; +import android.app.Activity; +import android.content.pm.PackageManager; +import android.media.midi.MidiDevice.MidiConnection; +import android.media.midi.MidiDeviceInfo; +import android.media.midi.MidiManager; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.view.WindowManager; +import android.widget.Toast; +import android.widget.Toolbar; + +import com.example.android.common.midi.MidiOutputPortConnectionSelector; +import com.example.android.common.midi.MidiPortConnector; +import com.example.android.common.midi.MidiTools; + +/** + * Simple synthesizer as a MIDI Device. + */ +public class MainActivity extends Activity { + static final String TAG = "MidiSynthExample"; + + private MidiManager mMidiManager; + private MidiOutputPortConnectionSelector mPortSelector; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + setActionBar((Toolbar) findViewById(R.id.toolbar)); + ActionBar actionBar = getActionBar(); + if (actionBar != null) { + actionBar.setDisplayShowTitleEnabled(false); + } + + if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_MIDI)) { + setupMidi(); + } + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.main, menu); + setKeepScreenOn(menu.findItem(R.id.action_keep_screen_on).isChecked()); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.action_keep_screen_on: + boolean checked = !item.isChecked(); + setKeepScreenOn(checked); + item.setChecked(checked); + break; + } + return super.onOptionsItemSelected(item); + } + + private void setKeepScreenOn(boolean keepScreenOn) { + if (keepScreenOn) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } else { + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + } + + private void setupMidi() { + // Setup MIDI + mMidiManager = (MidiManager) getSystemService(MIDI_SERVICE); + + MidiDeviceInfo synthInfo = MidiTools.findDevice(mMidiManager, "AndroidTest", + "SynthExample"); + int portIndex = 0; + mPortSelector = new MidiOutputPortConnectionSelector(mMidiManager, this, + R.id.spinner_synth_sender, synthInfo, portIndex); + mPortSelector.setConnectedListener(new MyPortsConnectedListener()); + } + + private void closeSynthResources() { + if (mPortSelector != null) { + mPortSelector.close(); + } + } + + // TODO A better way would be to listen to the synth server + // for open/close events and then disable/enable the spinner. + private class MyPortsConnectedListener + implements MidiPortConnector.OnPortsConnectedListener { + @Override + public void onPortsConnected(final MidiConnection connection) { + runOnUiThread(new Runnable() { + @Override + public void run() { + if (connection == null) { + Toast.makeText(MainActivity.this, + R.string.error_port_busy, Toast.LENGTH_SHORT) + .show(); + mPortSelector.clearSelection(); + } else { + Toast.makeText(MainActivity.this, + R.string.port_open_ok, Toast.LENGTH_SHORT) + .show(); + } + } + }); + } + } + + @Override + public void onDestroy() { + closeSynthResources(); + super.onDestroy(); + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/midisynth/MidiSynthDeviceService.java b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/midisynth/MidiSynthDeviceService.java new file mode 100644 index 0000000000000000000000000000000000000000..b9f25eeb7c9807df208a6e03570d62a7535f0ffa --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/java/com/example/android/midisynth/MidiSynthDeviceService.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.midisynth; + +import android.media.midi.MidiDeviceService; +import android.media.midi.MidiDeviceStatus; +import android.media.midi.MidiReceiver; + +import com.example.android.common.midi.synth.SynthEngine; + +public class MidiSynthDeviceService extends MidiDeviceService { + + private static final String TAG = MainActivity.TAG; + private SynthEngine mSynthEngine = new SynthEngine(); + private boolean mSynthStarted = false; + + @Override + public void onCreate() { + super.onCreate(); + } + + @Override + public void onDestroy() { + mSynthEngine.stop(); + super.onDestroy(); + } + + @Override + public MidiReceiver[] onGetInputPortReceivers() { + return new MidiReceiver[]{mSynthEngine}; + } + + /** + * This will get called when clients connect or disconnect. + */ + @Override + public void onDeviceStatusChanged(MidiDeviceStatus status) { + if (status.isInputPortOpen(0) && !mSynthStarted) { + mSynthEngine.start(); + mSynthStarted = true; + } else if (!status.isInputPortOpen(0) && mSynthStarted) { + mSynthEngine.stop(); + mSynthStarted = false; + } + } + +} diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/drawable-hdpi/tile.9.png b/prebuilts/gradle/MidiSynth/Application/src/main/res/drawable-hdpi/tile.9.png new file mode 100644 index 0000000000000000000000000000000000000000..135862883e26eddce2b19db021adf62e10357ad0 Binary files /dev/null and b/prebuilts/gradle/MidiSynth/Application/src/main/res/drawable-hdpi/tile.9.png differ diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/layout/main.xml b/prebuilts/gradle/MidiSynth/Application/src/main/res/layout/main.xml new file mode 100644 index 0000000000000000000000000000000000000000..6b9e2c7b5c36344cc6162fbe248f0bf41a341253 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/res/layout/main.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/menu/main.xml b/prebuilts/gradle/MidiSynth/Application/src/main/res/menu/main.xml new file mode 100644 index 0000000000000000000000000000000000000000..33093f0a569d26209ae8d6f32a05fa6aee838ea1 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/res/menu/main.xml @@ -0,0 +1,25 @@ + + + + + + diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-hdpi/ic_launcher.png b/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..38250e7f20f5d75d97cbe7ae44dfb877096186b5 Binary files /dev/null and b/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-mdpi/ic_launcher.png b/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..58c0025b013bd54d3faec74f24676756d07e25a3 Binary files /dev/null and b/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-xhdpi/ic_launcher.png b/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..3694855339990b28b11a44ef7b046f1198cba446 Binary files /dev/null and b/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png b/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..fb50ad157bb24e58e6f8f10d3b6b956748f62a6a Binary files /dev/null and b/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..801bf9c10f3c10a20a39d19a46ec5a01e7320f47 Binary files /dev/null and b/prebuilts/gradle/MidiSynth/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/values-sw600dp/template-dimens.xml b/prebuilts/gradle/MidiSynth/Application/src/main/res/values-sw600dp/template-dimens.xml new file mode 100644 index 0000000000000000000000000000000000000000..22074a2bdbaf60efff64d98a0788ef797a966f80 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/res/values-sw600dp/template-dimens.xml @@ -0,0 +1,24 @@ + + + + + + + @dimen/margin_huge + @dimen/margin_medium + + diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/values-sw600dp/template-styles.xml b/prebuilts/gradle/MidiSynth/Application/src/main/res/values-sw600dp/template-styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..03d1974183dd645178c07d247d61b83d067806be --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/res/values-sw600dp/template-styles.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/MidiSynth/Application/src/main/res/values-v11/template-styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..8c1ea66f28907ac211f355f4220ff4582cfb31eb --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/res/values-v11/template-styles.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/values/base-strings.xml b/prebuilts/gradle/MidiSynth/Application/src/main/res/values/base-strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..d38815ff664a4f64685e3086f705ecfc8d4852b4 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/res/values/base-strings.xml @@ -0,0 +1,30 @@ + + + + + MidiSynth + + + + diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/values/colors.xml b/prebuilts/gradle/MidiSynth/Application/src/main/res/values/colors.xml new file mode 100644 index 0000000000000000000000000000000000000000..4d2204f9d871fd0dc3f2901969560614c3c555c5 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/res/values/colors.xml @@ -0,0 +1,26 @@ + + + + #4CAF50 + #388E3C + #C8E6C9 + #FFEB3B + #212121 + #727272 + #FFFFFF + #B6B6B6 + diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/values/strings.xml b/prebuilts/gradle/MidiSynth/Application/src/main/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..76a8fa26659c2bf7ae270df23dcdd0d865650a47 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/res/values/strings.xml @@ -0,0 +1,25 @@ + + + + Select Sender for Synth + Selected port is in use or unavailable. + Port opened OK. + + "none" + + Keep screen on + diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/values/styles.xml b/prebuilts/gradle/MidiSynth/Application/src/main/res/values/styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..30d6455651913a5a37bd627939298e432bac96cc --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/res/values/styles.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/values/template-dimens.xml b/prebuilts/gradle/MidiSynth/Application/src/main/res/values/template-dimens.xml new file mode 100644 index 0000000000000000000000000000000000000000..39e710b5ca358c1ed04c4a95fc859861b318ae7e --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/res/values/template-dimens.xml @@ -0,0 +1,32 @@ + + + + + + + 4dp + 8dp + 16dp + 32dp + 64dp + + + + @dimen/margin_medium + @dimen/margin_medium + + diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/MidiSynth/Application/src/main/res/values/template-styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/res/values/template-styles.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + diff --git a/prebuilts/gradle/MidiSynth/Application/src/main/res/xml/synth_device_info.xml b/prebuilts/gradle/MidiSynth/Application/src/main/res/xml/synth_device_info.xml new file mode 100644 index 0000000000000000000000000000000000000000..405e87e11edc723f3a104e2e2bb132dae0f03f89 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/Application/src/main/res/xml/synth_device_info.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/prebuilts/gradle/MidiSynth/CONTRIBUTING.md b/prebuilts/gradle/MidiSynth/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..faa8b5c68f00e5472421ffa27503da611782f4c0 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# How to become a contributor and submit your own code + +## Contributor License Agreements + +We'd love to accept your sample apps and patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement (CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual CLA] + (https://cla.developers.google.com). + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA] + (https://cla.developers.google.com). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Ensure that your code adheres to the existing style in the sample to which + you are contributing. Refer to the + [Android Code Style Guide] + (https://source.android.com/source/code-style.html) for the + recommended coding standards for this organization. +1. Ensure that your code has an appropriate set of unit tests which all pass. +1. Submit a pull request. + diff --git a/prebuilts/gradle/MidiSynth/LICENSE b/prebuilts/gradle/MidiSynth/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..4f229463d3ec8464e7b6e635fc4f000bf9b7517a --- /dev/null +++ b/prebuilts/gradle/MidiSynth/LICENSE @@ -0,0 +1,647 @@ +Apache License +-------------- + + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +All image and audio files (including *.png, *.jpg, *.svg, *.mp3, *.wav +and *.ogg) are licensed under the CC-BY-NC license. All other files are +licensed under the Apache 2 license. + +CC-BY-NC License +---------------- + +Attribution-NonCommercial-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International +Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-NonCommercial-ShareAlike 4.0 International Public License +("Public License"). To the extent this Public License may be +interpreted as a contract, You are granted the Licensed Rights in +consideration of Your acceptance of these terms and conditions, and the +Licensor grants You such rights in consideration of benefits the +Licensor receives from making the Licensed Material available under +these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-NC-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution, NonCommercial, and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. NonCommercial means not primarily intended for or directed towards + commercial advantage or monetary compensation. For purposes of + this Public License, the exchange of the Licensed Material for + other material subject to Copyright and Similar Rights by digital + file-sharing or similar means is NonCommercial provided there is + no payment of monetary compensation in connection with the + exchange. + + l. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + m. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + n. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part, for NonCommercial purposes only; and + + b. produce, reproduce, and Share Adapted Material for + NonCommercial purposes only. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties, including when + the Licensed Material is used other than for NonCommercial + purposes. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-NC-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database for NonCommercial purposes + only; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + including for purposes of Section 3(b); and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + +======================================================================= + +Creative Commons is not a party to its public licenses. +Notwithstanding, Creative Commons may elect to apply one of its public +licenses to material it publishes and in those instances will be +considered the "Licensor." Except for the limited purpose of indicating +that material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the public +licenses. + +Creative Commons may be contacted at creativecommons.org. + diff --git a/prebuilts/gradle/MidiSynth/README.md b/prebuilts/gradle/MidiSynth/README.md new file mode 100644 index 0000000000000000000000000000000000000000..cad3a1a70bb398926b5cdf3c1224e15137d160e7 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/README.md @@ -0,0 +1,72 @@ + +Android MidiSynth Sample +=================================== + +Sample demonstrating how to use the MIDI API to receive and play MIDI messages coming from an +attached input device (MIDI keyboard). + +Introduction +------------ + +The Android MIDI API ([android.media.midi][1]) allows developers to connect a MIDI device to +an Android device and process MIDI messages coming from it. + +This sample demonstrates some basic features of the MIDI API, such as: + +- Enumeration of currently available devices (including name, vendor, capabilities, etc) +- Notification when MIDI devices are plugged in or unplugged +- Receiving and processing MIDI messages + +This sample contains a simple implementation of an oscillator and note playback. + +[1]: https://developer.android.com/reference/android/media/midi/package-summary.html + +Pre-requisites +-------------- + +- Android SDK v23 +- Android Build Tools v23.0.2 +- Android Support Repository + +Screenshots +------------- + +Screenshot + +Getting Started +--------------- + +This sample uses the Gradle build system. To build this project, use the +"gradlew build" command or use "Import Project" in Android Studio. + +Support +------- + +- Google+ Community: https://plus.google.com/communities/105153134372062985968 +- Stack Overflow: http://stackoverflow.com/questions/tagged/android + +If you've found an error in this sample, please file an issue: +https://github.com/googlesamples/android-MidiSynth + +Patches are encouraged, and may be submitted by forking this project and +submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. + +License +------- + +Copyright 2014 The Android Open Source Project, Inc. + +Licensed to the Apache Software Foundation (ASF) under one or more contributor +license agreements. See the NOTICE file distributed with this work for +additional information regarding copyright ownership. The ASF licenses this +file to you under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. diff --git a/prebuilts/gradle/MidiSynth/build.gradle b/prebuilts/gradle/MidiSynth/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..1901ba936e92369fd98ff950847ed40f8e1d694c --- /dev/null +++ b/prebuilts/gradle/MidiSynth/build.gradle @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/prebuilts/gradle/MidiSynth/gradle/wrapper/gradle-wrapper.jar b/prebuilts/gradle/MidiSynth/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..8c0fb64a8698b08ecc4158d828ca593c4928e9dd Binary files /dev/null and b/prebuilts/gradle/MidiSynth/gradle/wrapper/gradle-wrapper.jar differ diff --git a/prebuilts/gradle/MidiSynth/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/MidiSynth/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..07fc193f6aeea23337d8fe9f098980cdec5f95c5 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/prebuilts/gradle/MidiSynth/gradlew b/prebuilts/gradle/MidiSynth/gradlew new file mode 100755 index 0000000000000000000000000000000000000000..91a7e269e19dfc62e27137a0b57ef3e430cee4fd --- /dev/null +++ b/prebuilts/gradle/MidiSynth/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/prebuilts/gradle/MidiSynth/gradlew.bat b/prebuilts/gradle/MidiSynth/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..aec99730b4e8fcd90b57a0e8e01544fea7c31a89 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/prebuilts/gradle/MidiSynth/screenshots/1-main.png b/prebuilts/gradle/MidiSynth/screenshots/1-main.png new file mode 100644 index 0000000000000000000000000000000000000000..43a4f804214855eee38a728c4cf06a66582150b9 Binary files /dev/null and b/prebuilts/gradle/MidiSynth/screenshots/1-main.png differ diff --git a/prebuilts/gradle/MidiSynth/screenshots/icon-web.png b/prebuilts/gradle/MidiSynth/screenshots/icon-web.png new file mode 100644 index 0000000000000000000000000000000000000000..dfd5a518dfb22cadaf33afdc7c4cba21343367e3 Binary files /dev/null and b/prebuilts/gradle/MidiSynth/screenshots/icon-web.png differ diff --git a/prebuilts/gradle/MidiSynth/settings.gradle b/prebuilts/gradle/MidiSynth/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..0a5c310b26f1d4e5a402ccc23236d484c70ccfb0 --- /dev/null +++ b/prebuilts/gradle/MidiSynth/settings.gradle @@ -0,0 +1,2 @@ + +include 'Application' diff --git a/prebuilts/gradle/NavigationDrawer/Application/build.gradle b/prebuilts/gradle/NavigationDrawer/Application/build.gradle index 9a0f6878aef3cc16fec835656a2b95ff76551f0a..69c3be39e24ef1db6620cd5303d0cf9015b3a8bb 100644 --- a/prebuilts/gradle/NavigationDrawer/Application/build.gradle +++ b/prebuilts/gradle/NavigationDrawer/Application/build.gradle @@ -32,7 +32,7 @@ List dirs = [ android { compileSdkVersion 21 - buildToolsVersion "23.0.0" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 21 @@ -57,18 +57,3 @@ android { } } - - - - - - - - - - - - - - - diff --git a/prebuilts/gradle/NavigationDrawer/Application/src/main/java/com/example/android/navigationdrawer/NavigationDrawerActivity.java b/prebuilts/gradle/NavigationDrawer/Application/src/main/java/com/example/android/navigationdrawer/NavigationDrawerActivity.java index 117675701b257c4a7b8f2286fa75098c8fd75a01..26d677b7982a8147f48c706621fca78527bc7749 100644 --- a/prebuilts/gradle/NavigationDrawer/Application/src/main/java/com/example/android/navigationdrawer/NavigationDrawerActivity.java +++ b/prebuilts/gradle/NavigationDrawer/Application/src/main/java/com/example/android/navigationdrawer/NavigationDrawerActivity.java @@ -27,7 +27,6 @@ import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; -import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.Menu; @@ -89,7 +88,6 @@ public class NavigationDrawerActivity extends Activity implements PlanetAdapter. mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // improve performance by indicating the list if fixed size. mDrawerList.setHasFixedSize(true); - mDrawerList.setLayoutManager(new LinearLayoutManager(this)); // set up the drawer's list view with items and click listener mDrawerList.setAdapter(new PlanetAdapter(mPlanetTitles, this)); diff --git a/prebuilts/gradle/NavigationDrawer/Application/src/main/res/layout/activity_navigation_drawer.xml b/prebuilts/gradle/NavigationDrawer/Application/src/main/res/layout/activity_navigation_drawer.xml index 4e61639a83f2443715157d0511b02314b2871dfb..673ef630993736616f05a57c9639f27f5b355445 100644 --- a/prebuilts/gradle/NavigationDrawer/Application/src/main/res/layout/activity_navigation_drawer.xml +++ b/prebuilts/gradle/NavigationDrawer/Application/src/main/res/layout/activity_navigation_drawer.xml @@ -19,9 +19,12 @@ + android:layout_height="match_parent" + tools:openDrawer="start" > @@ -44,5 +47,6 @@ android:layout_gravity="left|start" android:choiceMode="singleChoice" android:divider="@null" + app:layoutManager="LinearLayoutManager" /> - \ No newline at end of file + diff --git a/prebuilts/gradle/NavigationDrawer/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/NavigationDrawer/Application/src/main/res/values-v11/template-styles.xml index f261bb5c2962bbd334d7a3d9bf4f7a7fc83b57d8..8c1ea66f28907ac211f355f4220ff4582cfb31eb 100644 --- a/prebuilts/gradle/NavigationDrawer/Application/src/main/res/values-v11/template-styles.xml +++ b/prebuilts/gradle/NavigationDrawer/Application/src/main/res/values-v11/template-styles.xml @@ -17,6 +17,6 @@ - diff --git a/prebuilts/gradle/NavigationDrawer/README.md b/prebuilts/gradle/NavigationDrawer/README.md index 093ef667665dd504a49cf59ccf130d642b140125..641f1470dcc87bf14b8d3c8d7812d93e4db84f07 100644 --- a/prebuilts/gradle/NavigationDrawer/README.md +++ b/prebuilts/gradle/NavigationDrawer/README.md @@ -9,7 +9,7 @@ Pre-requisites -------------- - Android SDK v21 -- Android Build Tools v23.0.0 +- Android Build Tools v23.0.2 - Android Support Repository Getting Started diff --git a/prebuilts/gradle/NavigationDrawer/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/NavigationDrawer/gradle/wrapper/gradle-wrapper.properties index 5f735f16043470511c458d3de140a8645c67695f..5288c6dff781a3c5376207acc847445ae1cb282d 100644 --- a/prebuilts/gradle/NavigationDrawer/gradle/wrapper/gradle-wrapper.properties +++ b/prebuilts/gradle/NavigationDrawer/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/prebuilts/gradle/NetworkConnect/Application/build.gradle b/prebuilts/gradle/NetworkConnect/Application/build.gradle index b825010de965e832a398e7cac416a70b3ae93b29..128220fe77c2a5aa57abf03fcbaf1f1e8745a597 100644 --- a/prebuilts/gradle/NetworkConnect/Application/build.gradle +++ b/prebuilts/gradle/NetworkConnect/Application/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile "com.android.support:support-v4:23.0.0" - compile "com.android.support:gridlayout-v7:23.0.0" - compile "com.android.support:cardview-v7:23.0.0" + compile "com.android.support:support-v4:23.1.0" + compile "com.android.support:gridlayout-v7:23.1.0" + compile "com.android.support:cardview-v7:23.1.0" } // The sample build uses multiple directories to @@ -31,7 +31,7 @@ List dirs = [ android { compileSdkVersion 23 - buildToolsVersion "23.0.0" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 8 @@ -56,18 +56,3 @@ android { } } - - - - - - - - - - - - - - - diff --git a/prebuilts/gradle/NetworkConnect/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/NetworkConnect/Application/src/main/res/values-v11/template-styles.xml index f261bb5c2962bbd334d7a3d9bf4f7a7fc83b57d8..8c1ea66f28907ac211f355f4220ff4582cfb31eb 100644 --- a/prebuilts/gradle/NetworkConnect/Application/src/main/res/values-v11/template-styles.xml +++ b/prebuilts/gradle/NetworkConnect/Application/src/main/res/values-v11/template-styles.xml @@ -17,6 +17,6 @@ - diff --git a/prebuilts/gradle/NetworkConnect/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/NetworkConnect/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/NetworkConnect/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/NetworkConnect/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/NfcProvisioning/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/NfcProvisioning/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/NfcProvisioning/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/NfcProvisioning/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/Notifications/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/Notifications/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/Notifications/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/Notifications/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/PdfRendererBasic/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/PdfRendererBasic/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/PdfRendererBasic/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/PdfRendererBasic/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/PermissionRequest/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/PermissionRequest/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/PermissionRequest/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/PermissionRequest/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/Quiz/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/Quiz/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/Quiz/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/Quiz/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/RecipeAssistant/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/RecipeAssistant/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/RecipeAssistant/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/RecipeAssistant/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/RecyclerView/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/RecyclerView/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/RecyclerView/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/RecyclerView/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/RenderScriptIntrinsic/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/RenderScriptIntrinsic/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/RenderScriptIntrinsic/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/RenderScriptIntrinsic/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/RepeatingAlarm/README.md b/prebuilts/gradle/RepeatingAlarm/README.md index af4826ecc6a0668c43043f4ff658f876dd59f326..ea67a26ed2dc9067512f95991643baf380026058 100644 --- a/prebuilts/gradle/RepeatingAlarm/README.md +++ b/prebuilts/gradle/RepeatingAlarm/README.md @@ -9,7 +9,7 @@ Pre-requisites -------------- - Android SDK v23 -- Android Build Tools v23.0.0 +- Android Build Tools v23.0.2 - Android Support Repository Getting Started diff --git a/prebuilts/gradle/RepeatingAlarm/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/RepeatingAlarm/gradle/wrapper/gradle-wrapper.properties index 0c71e760dc93830dd3411fe50d6f5c86bf0a8f4d..07fc193f6aeea23337d8fe9f098980cdec5f95c5 100644 --- a/prebuilts/gradle/RepeatingAlarm/gradle/wrapper/gradle-wrapper.properties +++ b/prebuilts/gradle/RepeatingAlarm/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/prebuilts/gradle/RevealEffectBasic/Application/build.gradle b/prebuilts/gradle/RevealEffectBasic/Application/build.gradle index c0ed8ea6a96fd31b1ee1654d3a528b26797ec317..3bffd32d7772f133f22f90a207986bd105792dae 100644 --- a/prebuilts/gradle/RevealEffectBasic/Application/build.gradle +++ b/prebuilts/gradle/RevealEffectBasic/Application/build.gradle @@ -16,9 +16,9 @@ repositories { } dependencies { - compile "com.android.support:support-v4:23.0.0" - compile "com.android.support:support-v13:23.0.0" - compile "com.android.support:cardview-v7:23.0.0" + compile "com.android.support:support-v4:23.1.0" + compile "com.android.support:support-v13:23.1.0" + compile "com.android.support:cardview-v7:23.1.0" } // The sample build uses multiple directories to @@ -31,7 +31,7 @@ List dirs = [ android { compileSdkVersion 21 - buildToolsVersion "23.0.0" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 21 @@ -56,18 +56,3 @@ android { } } - - - - - - - - - - - - - - - diff --git a/prebuilts/gradle/RevealEffectBasic/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/RevealEffectBasic/Application/src/main/res/values-v11/template-styles.xml index f261bb5c2962bbd334d7a3d9bf4f7a7fc83b57d8..8c1ea66f28907ac211f355f4220ff4582cfb31eb 100644 --- a/prebuilts/gradle/RevealEffectBasic/Application/src/main/res/values-v11/template-styles.xml +++ b/prebuilts/gradle/RevealEffectBasic/Application/src/main/res/values-v11/template-styles.xml @@ -17,6 +17,6 @@ - diff --git a/prebuilts/gradle/RevealEffectBasic/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/RevealEffectBasic/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/RevealEffectBasic/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/RevealEffectBasic/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/RuntimePermissions/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/RuntimePermissions/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/RuntimePermissions/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/RuntimePermissions/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - diff --git a/prebuilts/gradle/RuntimePermissionsBasic/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/RuntimePermissionsBasic/Application/src/main/res/values/template-styles.xml index 74086d293e3fbee9b5a6a8a2f11b9d6104c0f663..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec 100644 --- a/prebuilts/gradle/RuntimePermissionsBasic/Application/src/main/res/values/template-styles.xml +++ b/prebuilts/gradle/RuntimePermissionsBasic/Application/src/main/res/values/template-styles.xml @@ -18,7 +18,7 @@ - + + diff --git a/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values-v11/template-styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..8c1ea66f28907ac211f355f4220ff4582cfb31eb --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values-v11/template-styles.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values-w820dp/dimens.xml b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000000000000000000000000000000000000..74184fc8a7ce34ea85fb1451dcdf88df43bb05a3 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,20 @@ + + + + + + 64dp + diff --git a/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/base-strings.xml b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/base-strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..bf92a0b2f6caf2092af9f4b2a13ae51b0b703448 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/base-strings.xml @@ -0,0 +1,30 @@ + + + + + RuntimePermissionsWear + + + + diff --git a/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/dimens.xml b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/dimens.xml new file mode 100644 index 0000000000000000000000000000000000000000..e9366a9a375122344a58bdcf3f50ef01e2c5c326 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/dimens.xml @@ -0,0 +1,19 @@ + + + + + + 16dp + 16dp + diff --git a/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/strings.xml b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..95a2c8325b3030dd15d012dbc39470d99558298e --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/strings.xml @@ -0,0 +1,34 @@ + + + + + + Happy equals approved, sad equals denied.\n\nTo see results or request permissions, click on the buttons above. + You do not have the correct permissions. Tap sad face to bring up permission dialog again. + Wear Sensors + Phone Storage + + PhonePermissionRequestActivity + See your directory structure by letting us read your phone\'s storage. + Your phone and watch experience need access to your phone\'s storage to show your top level directories. + No Thanks + Continue + + WearPermissionRequestActivity + See your total sensor count by letting us read your wear\'s sensors. + Your phone and watch experience need access to your wear\'s sensors to show sensor count. + No Thanks + Open on Watch + + diff --git a/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/template-dimens.xml b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/template-dimens.xml new file mode 100644 index 0000000000000000000000000000000000000000..39e710b5ca358c1ed04c4a95fc859861b318ae7e --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/template-dimens.xml @@ -0,0 +1,32 @@ + + + + + + + 4dp + 8dp + 16dp + 32dp + 64dp + + + + @dimen/margin_medium + @dimen/margin_medium + + diff --git a/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/template-styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e7d593dd8b50a4deb3002c6073d34f9c6b8ffec --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/template-styles.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + diff --git a/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/wear.xml b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/wear.xml new file mode 100644 index 0000000000000000000000000000000000000000..278797263b21dd02b6984da280902cb5f4739c7d --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Application/src/main/res/values/wear.xml @@ -0,0 +1,19 @@ + + + + + + phone_app_runtime_permissions + + \ No newline at end of file diff --git a/prebuilts/gradle/RuntimePermissionsWear/CONTRIBUTING.md b/prebuilts/gradle/RuntimePermissionsWear/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..faa8b5c68f00e5472421ffa27503da611782f4c0 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# How to become a contributor and submit your own code + +## Contributor License Agreements + +We'd love to accept your sample apps and patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement (CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual CLA] + (https://cla.developers.google.com). + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA] + (https://cla.developers.google.com). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Ensure that your code adheres to the existing style in the sample to which + you are contributing. Refer to the + [Android Code Style Guide] + (https://source.android.com/source/code-style.html) for the + recommended coding standards for this organization. +1. Ensure that your code has an appropriate set of unit tests which all pass. +1. Submit a pull request. + diff --git a/prebuilts/gradle/RuntimePermissionsWear/LICENSE b/prebuilts/gradle/RuntimePermissionsWear/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..4f229463d3ec8464e7b6e635fc4f000bf9b7517a --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/LICENSE @@ -0,0 +1,647 @@ +Apache License +-------------- + + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +All image and audio files (including *.png, *.jpg, *.svg, *.mp3, *.wav +and *.ogg) are licensed under the CC-BY-NC license. All other files are +licensed under the Apache 2 license. + +CC-BY-NC License +---------------- + +Attribution-NonCommercial-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International +Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-NonCommercial-ShareAlike 4.0 International Public License +("Public License"). To the extent this Public License may be +interpreted as a contract, You are granted the Licensed Rights in +consideration of Your acceptance of these terms and conditions, and the +Licensor grants You such rights in consideration of benefits the +Licensor receives from making the Licensed Material available under +these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-NC-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution, NonCommercial, and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. NonCommercial means not primarily intended for or directed towards + commercial advantage or monetary compensation. For purposes of + this Public License, the exchange of the Licensed Material for + other material subject to Copyright and Similar Rights by digital + file-sharing or similar means is NonCommercial provided there is + no payment of monetary compensation in connection with the + exchange. + + l. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + m. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + n. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part, for NonCommercial purposes only; and + + b. produce, reproduce, and Share Adapted Material for + NonCommercial purposes only. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties, including when + the Licensed Material is used other than for NonCommercial + purposes. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-NC-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database for NonCommercial purposes + only; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + including for purposes of Section 3(b); and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + +======================================================================= + +Creative Commons is not a party to its public licenses. +Notwithstanding, Creative Commons may elect to apply one of its public +licenses to material it publishes and in those instances will be +considered the "Licensor." Except for the limited purpose of indicating +that material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the public +licenses. + +Creative Commons may be contacted at creativecommons.org. + diff --git a/prebuilts/gradle/RuntimePermissionsWear/README.md b/prebuilts/gradle/RuntimePermissionsWear/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5752f0d88337a962e92957c1781207eeae7b3c1c --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/README.md @@ -0,0 +1,85 @@ + +Android RuntimePermissionsWear Sample +=================================== + +A sample that shows how you can handle remote data that requires permissions both on +a wearable device and a mobile device. + +Introduction +------------ + +Steps for trying out this sample: +* Compile and install the mobile app onto your mobile device or emulator. +* Compile and install the wearable app onto your Wear device or emulator. +(**Note:** wearable apps are not automatically pushed from your mobile device +unless you build a production release, see [here][3] for more info). +* Start the mobile or wear app. Each app contains two buttons: one for showing +local data and another for showing remote data. +* Click either button to view the data. Both local and remote data require +[dangerous permissions][4] to be approved before displaying the data for +devices running 23 or above. You will be asked to approve the access if you +do not have the proper permissions. +* The happy icon signifies you have access to the data while the sad icon +signifies you do or may not have access (and may be asked to approve access). + +This sample demonstrates how to access data and trigger permission approval +on remote devices. It uses [Services][5] and the [Wearable MessageApi][2] to +communicate between devices. + +To find out more about wear, visit our [developer Wear page][1]. + +[1]: http://developer.android.com/wear/ +[2]: https://developer.android.com/reference/com/google/android/gms/wearable/MessageApi.html +[3]: https://developer.android.com/training/wearables/apps/creating.html#Install +[4]: http://developer.android.com/guide/topics/security/permissions.html#normal-dangerous +[5]: http://developer.android.com/guide/components/services.html + +Pre-requisites +-------------- + +- Android SDK v23 +- Android Build Tools v23.0.2 +- Android Support Repository + +Screenshots +------------- + +Screenshot Screenshot + +Getting Started +--------------- + +This sample uses the Gradle build system. To build this project, use the +"gradlew build" command or use "Import Project" in Android Studio. + +Support +------- + +- Google+ Community: https://plus.google.com/communities/105153134372062985968 +- Stack Overflow: http://stackoverflow.com/questions/tagged/android + +If you've found an error in this sample, please file an issue: +https://github.com/googlesamples/android-RuntimePermissionsWear + +Patches are encouraged, and may be submitted by forking this project and +submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. + +License +------- + +Copyright 2014 The Android Open Source Project, Inc. + +Licensed to the Apache Software Foundation (ASF) under one or more contributor +license agreements. See the NOTICE file distributed with this work for +additional information regarding copyright ownership. The ASF licenses this +file to you under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. diff --git a/prebuilts/gradle/RuntimePermissionsWear/Shared/build.gradle b/prebuilts/gradle/RuntimePermissionsWear/Shared/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..daea9d01c935cacb825b7b20970e283d0e8cc6d8 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Shared/build.gradle @@ -0,0 +1,52 @@ + +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:1.2.3' + } +} + +apply plugin: 'android-library' + +repositories { + jcenter() +} + + + +// The sample build uses multiple directories to +// keep boilerplate and common code separate from +// the main sample code. +List dirs = [ + 'main', // main sample code; look here for the interesting stuff. + 'common', // components that are reused by multiple samples + 'template'] // boilerplate code that is generated by the sample template process + +android { + compileSdkVersion 23 + + buildToolsVersion "23.0.2" + + defaultConfig { + minSdkVersion 18 + targetSdkVersion 23 + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + sourceSets { + main { + dirs.each { dir -> + java.srcDirs "src/${dir}/java" + res.srcDirs "src/${dir}/res" + } + } + + } +} diff --git a/prebuilts/gradle/RuntimePermissionsWear/Shared/src/main/AndroidManifest.xml b/prebuilts/gradle/RuntimePermissionsWear/Shared/src/main/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..fa262fa5ed8c3601ee113358debfef2fa5fb6dbc --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Shared/src/main/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + diff --git a/prebuilts/gradle/RuntimePermissionsWear/Shared/src/main/java/com/example/android/wearable/runtimepermissions/common/Constants.java b/prebuilts/gradle/RuntimePermissionsWear/Shared/src/main/java/com/example/android/wearable/runtimepermissions/common/Constants.java new file mode 100644 index 0000000000000000000000000000000000000000..d124400a8f641bc1735b85b9e5af7894d6c23907 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Shared/src/main/java/com/example/android/wearable/runtimepermissions/common/Constants.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2015 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.wearable.runtimepermissions.common; + +import java.util.concurrent.TimeUnit; + +/** + * A collection of constants that is shared between the wearable and handset apps. + */ +public class Constants { + + // Shared + public static final long CONNECTION_TIME_OUT_MS = TimeUnit.SECONDS.toMillis(5); + + public static final String KEY_COMM_TYPE = "communicationType"; + public static final String KEY_PAYLOAD = "payload"; + + // Requests + public static final int COMM_TYPE_REQUEST_PROMPT_PERMISSION = 1; + public static final int COMM_TYPE_REQUEST_DATA = 2; + + // Responses + public static final int COMM_TYPE_RESPONSE_PERMISSION_REQUIRED = 1001; + public static final int COMM_TYPE_RESPONSE_USER_APPROVED_PERMISSION = 1002; + public static final int COMM_TYPE_RESPONSE_USER_DENIED_PERMISSION = 1003; + public static final int COMM_TYPE_RESPONSE_DATA = 1004; + + // Phone + public static final String CAPABILITY_PHONE_APP = "phone_app_runtime_permissions"; + public static final String MESSAGE_PATH_PHONE = "/phone_message_path"; + + // Wear + public static final String CAPABILITY_WEAR_APP = "wear_app_runtime_permissions"; + public static final String MESSAGE_PATH_WEAR = "/wear_message_path"; + + private Constants() {} +} \ No newline at end of file diff --git a/prebuilts/gradle/RuntimePermissionsWear/Shared/src/main/res/values/strings.xml b/prebuilts/gradle/RuntimePermissionsWear/Shared/src/main/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..cc0aaa9af93e89108476fd0f82357b76a49674c6 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Shared/src/main/res/values/strings.xml @@ -0,0 +1,17 @@ + + + + + Shared + diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/build.gradle b/prebuilts/gradle/RuntimePermissionsWear/Wearable/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..ceaae1879cc1a959431891af5f5e3d7177fe3197 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Wearable/build.gradle @@ -0,0 +1,64 @@ + +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:1.2.3' + } +} + +apply plugin: 'com.android.application' + + + +repositories { + jcenter() +} + +dependencies { + compile 'com.google.android.gms:play-services-wearable:8.4.0' + compile 'com.android.support:support-v13:23.1.1' + compile 'com.google.android.support:wearable:1.3.0' + compile project(':Shared') +} + +// The sample build uses multiple directories to +// keep boilerplate and common code separate from +// the main sample code. +List dirs = [ + 'main', // main sample code; look here for the interesting stuff. + 'common', // components that are reused by multiple samples + 'template'] // boilerplate code that is generated by the sample template process + +android { + compileSdkVersion 23 + + buildToolsVersion "23.0.2" + + defaultConfig { + versionCode 1 + versionName "1.0" + + targetSdkVersion 23 + + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + sourceSets { + main { + dirs.each { dir -> + java.srcDirs "src/${dir}/java" + res.srcDirs "src/${dir}/res" + } + } + androidTest.setRoot('tests') + androidTest.java.srcDirs = ['tests/src'] + + } +} diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/AndroidManifest.xml b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..43218d789688ec874f6540846977c9bdcdeb1a00 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/AndroidManifest.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/IncomingRequestWearService.java b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/IncomingRequestWearService.java new file mode 100644 index 0000000000000000000000000000000000000000..5dc246777f6a59711468682080c511001a4081af --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/IncomingRequestWearService.java @@ -0,0 +1,209 @@ +/* + * Copyright (C) 2015 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.wearable.runtimepermissions; + +import android.Manifest; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.hardware.Sensor; +import android.hardware.SensorManager; +import android.support.v4.app.ActivityCompat; +import android.util.Log; + +import com.example.android.wearable.runtimepermissions.common.Constants; + +import com.google.android.gms.common.ConnectionResult; +import com.google.android.gms.common.api.GoogleApiClient; +import com.google.android.gms.common.api.PendingResult; +import com.google.android.gms.wearable.CapabilityApi; +import com.google.android.gms.wearable.CapabilityInfo; +import com.google.android.gms.wearable.DataMap; +import com.google.android.gms.wearable.MessageApi; +import com.google.android.gms.wearable.MessageEvent; +import com.google.android.gms.wearable.Node; +import com.google.android.gms.wearable.Wearable; +import com.google.android.gms.wearable.WearableListenerService; + +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +/** + * Handles all incoming requests for wear data (and permissions) from phone devices. + */ +public class IncomingRequestWearService extends WearableListenerService { + + private static final String TAG = "IncomingRequestService"; + + public IncomingRequestWearService() { + Log.d(TAG, "IncomingRequestWearService()"); + } + + @Override + public void onCreate() { + super.onCreate(); + Log.d(TAG, "onCreate()"); + } + + @Override + public void onMessageReceived(MessageEvent messageEvent) { + Log.d(TAG, "onMessageReceived(): " + messageEvent); + + String messagePath = messageEvent.getPath(); + + if (messagePath.equals(Constants.MESSAGE_PATH_WEAR)) { + DataMap dataMap = DataMap.fromByteArray(messageEvent.getData()); + + int requestType = dataMap.getInt(Constants.KEY_COMM_TYPE); + + if (requestType == Constants.COMM_TYPE_REQUEST_PROMPT_PERMISSION) { + promptUserForSensorPermission(); + + } else if (requestType == Constants.COMM_TYPE_REQUEST_DATA) { + respondWithSensorInformation(); + } + } + } + + private void promptUserForSensorPermission() { + Log.d(TAG, "promptUserForSensorPermission()"); + + boolean sensorPermissionApproved = + ActivityCompat.checkSelfPermission(this, Manifest.permission.BODY_SENSORS) + == PackageManager.PERMISSION_GRANTED; + + if (sensorPermissionApproved) { + DataMap dataMap = new DataMap(); + dataMap.putInt(Constants.KEY_COMM_TYPE, + Constants.COMM_TYPE_RESPONSE_USER_APPROVED_PERMISSION); + sendMessage(dataMap); + } else { + // Launch Activity to grant sensor permissions. + Intent startIntent = new Intent(this, MainWearActivity.class); + startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startIntent.putExtra(MainWearActivity.EXTRA_PROMPT_PERMISSION_FROM_PHONE, true); + startActivity(startIntent); + } + } + + private void respondWithSensorInformation() { + Log.d(TAG, "respondWithSensorInformation()"); + + boolean sensorPermissionApproved = + ActivityCompat.checkSelfPermission(this, Manifest.permission.BODY_SENSORS) + == PackageManager.PERMISSION_GRANTED; + + if (!sensorPermissionApproved) { + DataMap dataMap = new DataMap(); + dataMap.putInt(Constants.KEY_COMM_TYPE, + Constants.COMM_TYPE_RESPONSE_PERMISSION_REQUIRED); + sendMessage(dataMap); + } else { + /* To keep the sample simple, we are only displaying the number of sensors. You could do + * something much more complicated. + */ + SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); + List sensorList = sensorManager.getSensorList(Sensor.TYPE_ALL); + int numberOfSensorsOnDevice = sensorList.size(); + + String sensorSummary = numberOfSensorsOnDevice + " sensors on wear device(s)!"; + DataMap dataMap = new DataMap(); + dataMap.putInt(Constants.KEY_COMM_TYPE, + Constants.COMM_TYPE_RESPONSE_DATA); + dataMap.putString(Constants.KEY_PAYLOAD, sensorSummary); + sendMessage(dataMap); + } + } + + private void sendMessage(DataMap dataMap) { + + Log.d(TAG, "sendMessage(): " + dataMap); + + GoogleApiClient googleApiClient = new GoogleApiClient.Builder(this) + .addApi(Wearable.API) + .build(); + ConnectionResult connectionResult = + googleApiClient.blockingConnect( + Constants.CONNECTION_TIME_OUT_MS, + TimeUnit.MILLISECONDS); + + if (!connectionResult.isSuccess()) { + Log.d(TAG, "Google API Client failed to connect."); + return; + } + + PendingResult pendingCapabilityResult = + Wearable.CapabilityApi.getCapability( + googleApiClient, + Constants.CAPABILITY_PHONE_APP, + CapabilityApi.FILTER_REACHABLE); + + CapabilityApi.GetCapabilityResult getCapabilityResult = + pendingCapabilityResult.await( + Constants.CONNECTION_TIME_OUT_MS, + TimeUnit.MILLISECONDS); + + if (!getCapabilityResult.getStatus().isSuccess()) { + Log.d(TAG, "CapabilityApi failed to return any results."); + googleApiClient.disconnect(); + return; + } + + CapabilityInfo capabilityInfo = getCapabilityResult.getCapability(); + String phoneNodeId = pickBestNodeId(capabilityInfo.getNodes()); + + PendingResult pendingMessageResult = + Wearable.MessageApi.sendMessage( + googleApiClient, + phoneNodeId, + Constants.MESSAGE_PATH_PHONE, + dataMap.toByteArray()); + + MessageApi.SendMessageResult sendMessageResult = + pendingMessageResult.await(Constants.CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); + + if (!sendMessageResult.getStatus().isSuccess()) { + Log.d(TAG, "Sending message failed, onResult: " + sendMessageResult.getStatus()); + } else { + Log.d(TAG, "Message sent successfully"); + } + + googleApiClient.disconnect(); + } + + /* + * There should only ever be one phone in a node set (much less w/ the correct capability), so + * I am just grabbing the first one (which should be the only one). + */ + private String pickBestNodeId(Set nodes) { + + Log.d(TAG, "pickBestNodeId: " + nodes); + + + String bestNodeId = null; + /* Find a nearby node or pick one arbitrarily. There should be only one phone connected + * that supports this sample. + */ + for (Node node : nodes) { + if (node.isNearby()) { + return node.getId(); + } + bestNodeId = node.getId(); + } + return bestNodeId; + } +} \ No newline at end of file diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/MainWearActivity.java b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/MainWearActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..b2a259542a32aeca8eb2ba650ca2fe3720dd9c63 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/MainWearActivity.java @@ -0,0 +1,556 @@ +/* + * Copyright (C) 2015 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.wearable.runtimepermissions; + +import android.Manifest; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.hardware.Sensor; +import android.hardware.SensorManager; +import android.os.Bundle; +import android.os.Looper; +import android.support.annotation.NonNull; +import android.support.v4.app.ActivityCompat; +import android.support.wearable.activity.WearableActivity; +import android.support.wearable.view.WatchViewStub; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import com.example.android.wearable.runtimepermissions.common.Constants; + +import com.google.android.gms.common.ConnectionResult; +import com.google.android.gms.common.api.GoogleApiClient; +import com.google.android.gms.common.api.PendingResult; +import com.google.android.gms.common.api.ResultCallback; +import com.google.android.gms.wearable.CapabilityApi; +import com.google.android.gms.wearable.CapabilityInfo; +import com.google.android.gms.wearable.DataMap; +import com.google.android.gms.wearable.MessageApi; +import com.google.android.gms.wearable.MessageEvent; +import com.google.android.gms.wearable.Node; +import com.google.android.gms.wearable.Wearable; + +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +/** + * Displays data that requires runtime permissions both locally (BODY_SENSORS) and remotely on + * the phone (READ_EXTERNAL_STORAGE). + * + * The class is also launched by IncomingRequestWearService when the permission for the data the + * phone is trying to access hasn't been granted (wear's sensors). If granted in that scenario, + * this Activity also sends back the results of the permission request to the phone device (and + * the sensor data if approved). + */ +public class MainWearActivity extends WearableActivity implements + GoogleApiClient.ConnectionCallbacks, + GoogleApiClient.OnConnectionFailedListener, + CapabilityApi.CapabilityListener, + MessageApi.MessageListener, + ActivityCompat.OnRequestPermissionsResultCallback { + + private static final String TAG = "MainWearActivity"; + + /* Id to identify local permission request for body sensors. */ + private static final int PERMISSION_REQUEST_READ_BODY_SENSORS = 1; + + /* Id to identify starting/closing RequestPermissionOnPhoneActivity (startActivityForResult). */ + private static final int REQUEST_PHONE_PERMISSION = 1; + + public static final String EXTRA_PROMPT_PERMISSION_FROM_PHONE = + "com.example.android.wearable.runtimepermissions.extra.PROMPT_PERMISSION_FROM_PHONE"; + + private boolean mWearBodySensorsPermissionApproved; + private boolean mPhoneStoragePermissionApproved; + + private boolean mPhoneRequestingWearSensorPermission; + + private Button mWearBodySensorsPermissionButton; + private Button mPhoneStoragePermissionButton; + private TextView mOutputTextView; + + private String mPhoneNodeId; + + private GoogleApiClient mGoogleApiClient; + + @Override + protected void onCreate(Bundle savedInstanceState) { + Log.d(TAG, "onCreate()"); + super.onCreate(savedInstanceState);; + + /* + * Since this is a remote permission, we initialize it to false and then check the remote + * permission once the GoogleApiClient is connected. + */ + mPhoneStoragePermissionApproved = false; + + setContentView(R.layout.activity_main); + setAmbientEnabled(); + + // Checks if phone app requested wear permission (permission request opens later if true). + mPhoneRequestingWearSensorPermission = + getIntent().getBooleanExtra(EXTRA_PROMPT_PERMISSION_FROM_PHONE, false); + + final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub); + stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() { + @Override + public void onLayoutInflated(WatchViewStub stub) { + + mWearBodySensorsPermissionButton = + (Button) stub.findViewById(R.id.wearBodySensorsPermissionButton); + + if (mWearBodySensorsPermissionApproved) { + mWearBodySensorsPermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_approved, 0, 0, 0); + } + + mPhoneStoragePermissionButton = + (Button) stub.findViewById(R.id.phoneStoragePermissionButton); + + mOutputTextView = (TextView) stub.findViewById(R.id.output); + + if (mPhoneRequestingWearSensorPermission) { + launchPermissionDialogForPhone(); + } + + } + }); + + mGoogleApiClient = new GoogleApiClient.Builder(this) + .addApi(Wearable.API) + .addConnectionCallbacks(this) + .addOnConnectionFailedListener(this) + .build(); + } + + public void onClickWearBodySensors(View view) { + + if (mWearBodySensorsPermissionApproved) { + + // To keep the sample simple, we are only displaying the number of sensors. + SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); + List sensorList = sensorManager.getSensorList(Sensor.TYPE_ALL); + int numberOfSensorsOnDevice = sensorList.size(); + + logToUi(numberOfSensorsOnDevice + " sensors on device(s)!"); + + } else { + logToUi("Requested local permission."); + // On 23+ (M+) devices, GPS permission not granted. Request permission. + ActivityCompat.requestPermissions( + this, + new String[]{Manifest.permission.BODY_SENSORS}, + PERMISSION_REQUEST_READ_BODY_SENSORS); + } + } + + public void onClickPhoneStorage(View view) { + + logToUi("Requested info from phone. New approval may be required."); + DataMap dataMap = new DataMap(); + dataMap.putInt(Constants.KEY_COMM_TYPE, + Constants.COMM_TYPE_REQUEST_DATA); + sendMessage(dataMap); + } + + @Override + protected void onPause() { + Log.d(TAG, "onPause()"); + super.onPause(); + if ((mGoogleApiClient != null) && mGoogleApiClient.isConnected()) { + Wearable.CapabilityApi.removeCapabilityListener( + mGoogleApiClient, + this, + Constants.CAPABILITY_PHONE_APP); + Wearable.MessageApi.removeListener(mGoogleApiClient, this); + mGoogleApiClient.disconnect(); + } + } + + @Override + protected void onResume() { + Log.d(TAG, "onResume()"); + super.onResume(); + if (mGoogleApiClient != null) { + mGoogleApiClient.connect(); + } + + // Enables app to handle 23+ (M+) style permissions. + mWearBodySensorsPermissionApproved = + ActivityCompat.checkSelfPermission(this, Manifest.permission.BODY_SENSORS) + == PackageManager.PERMISSION_GRANTED; + } + + /* + * Because this wear activity is marked "android:launchMode='singleInstance'" in the manifest, + * we need to allow the permissions dialog to be opened up from the phone even if the wear app + * is in the foreground. By overriding onNewIntent, we can cover that use case. + */ + @Override + protected void onNewIntent (Intent intent) { + Log.d(TAG, "onNewIntent()"); + super.onNewIntent(intent); + + // Checks if phone app requested wear permissions (opens up permission request if true). + mPhoneRequestingWearSensorPermission = + intent.getBooleanExtra(EXTRA_PROMPT_PERMISSION_FROM_PHONE, false); + + if (mPhoneRequestingWearSensorPermission) { + launchPermissionDialogForPhone(); + } + } + + @Override + public void onEnterAmbient(Bundle ambientDetails) { + Log.d(TAG, "onEnterAmbient() " + ambientDetails); + + if (mWearBodySensorsPermissionApproved) { + mWearBodySensorsPermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_approved_bw, 0, 0, 0); + } else { + mWearBodySensorsPermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_denied_bw, 0, 0, 0); + } + + if (mPhoneStoragePermissionApproved) { + mPhoneStoragePermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_approved_bw, 0, 0, 0); + } else { + mPhoneStoragePermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_denied_bw, 0, 0, 0); + } + super.onEnterAmbient(ambientDetails); + } + + @Override + public void onExitAmbient() { + Log.d(TAG, "onExitAmbient()"); + + if (mWearBodySensorsPermissionApproved) { + mWearBodySensorsPermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_approved, 0, 0, 0); + } else { + mWearBodySensorsPermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_denied, 0, 0, 0); + } + + if (mPhoneStoragePermissionApproved) { + mPhoneStoragePermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_approved, 0, 0, 0); + } else { + mPhoneStoragePermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_denied, 0, 0, 0); + } + super.onExitAmbient(); + } + + @Override + public void onConnected(Bundle bundle) { + Log.d(TAG, "onConnected()"); + + // Set up listeners for capability and message changes. + Wearable.CapabilityApi.addCapabilityListener( + mGoogleApiClient, + this, + Constants.CAPABILITY_PHONE_APP); + Wearable.MessageApi.addListener(mGoogleApiClient, this); + + // Initial check of capabilities to find the phone. + PendingResult pendingResult = + Wearable.CapabilityApi.getCapability( + mGoogleApiClient, + Constants.CAPABILITY_PHONE_APP, + CapabilityApi.FILTER_REACHABLE); + + pendingResult.setResultCallback(new ResultCallback() { + @Override + public void onResult(CapabilityApi.GetCapabilityResult getCapabilityResult) { + + if (getCapabilityResult.getStatus().isSuccess()) { + CapabilityInfo capabilityInfo = getCapabilityResult.getCapability(); + mPhoneNodeId = pickBestNodeId(capabilityInfo.getNodes()); + + } else { + Log.d(TAG, "Failed CapabilityApi result: " + + getCapabilityResult.getStatus()); + } + } + }); + } + + @Override + public void onConnectionSuspended(int i) { + Log.d(TAG, "onConnectionSuspended(): connection to location client suspended"); + } + + @Override + public void onConnectionFailed(ConnectionResult connectionResult) { + Log.e(TAG, "onConnectionFailed(): connection to location client failed"); + } + + public void onCapabilityChanged(CapabilityInfo capabilityInfo) { + Log.d(TAG, "onCapabilityChanged(): " + capabilityInfo); + + mPhoneNodeId = pickBestNodeId(capabilityInfo.getNodes()); + } + + /* + * Callback received when a permissions request has been completed. + */ + @Override + public void onRequestPermissionsResult( + int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + + String permissionResult = "Request code: " + requestCode + ", Permissions: " + permissions + + ", Results: " + grantResults; + Log.d(TAG, "onRequestPermissionsResult(): " + permissionResult); + + + if (requestCode == PERMISSION_REQUEST_READ_BODY_SENSORS) { + + if ((grantResults.length == 1) + && (grantResults[0] == PackageManager.PERMISSION_GRANTED)) { + + mWearBodySensorsPermissionApproved = true; + mWearBodySensorsPermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_approved, 0, 0, 0); + + // To keep the sample simple, we are only displaying the number of sensors. + SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); + List sensorList = sensorManager.getSensorList(Sensor.TYPE_ALL); + int numberOfSensorsOnDevice = sensorList.size(); + + String sensorSummary = numberOfSensorsOnDevice + " sensors on this device!"; + logToUi(sensorSummary); + + if (mPhoneRequestingWearSensorPermission) { + // Resets so this isn't triggered every time permission is changed in app. + mPhoneRequestingWearSensorPermission = false; + + // Send 'approved' message to remote phone since it started Activity. + DataMap dataMap = new DataMap(); + dataMap.putInt(Constants.KEY_COMM_TYPE, + Constants.COMM_TYPE_RESPONSE_USER_APPROVED_PERMISSION); + sendMessage(dataMap); + } + + } else { + + mWearBodySensorsPermissionApproved = false; + mWearBodySensorsPermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_denied, 0, 0, 0); + + if (mPhoneRequestingWearSensorPermission) { + // Resets so this isn't triggered every time permission is changed in app. + mPhoneRequestingWearSensorPermission = false; + // Send 'denied' message to remote phone since it started Activity. + DataMap dataMap = new DataMap(); + dataMap.putInt(Constants.KEY_COMM_TYPE, + Constants.COMM_TYPE_RESPONSE_USER_DENIED_PERMISSION); + sendMessage(dataMap); + } + } + } + } + + public void onMessageReceived(MessageEvent messageEvent) { + Log.d(TAG, "onMessageReceived(): " + messageEvent); + + String messagePath = messageEvent.getPath(); + + if (messagePath.equals(Constants.MESSAGE_PATH_WEAR)) { + + DataMap dataMap = DataMap.fromByteArray(messageEvent.getData()); + int commType = dataMap.getInt(Constants.KEY_COMM_TYPE, 0); + + if (commType == Constants.COMM_TYPE_RESPONSE_PERMISSION_REQUIRED) { + mPhoneStoragePermissionApproved = false; + updatePhoneButtonOnUiThread(); + + /* Because our request for remote data requires a remote permission, we now launch + * a splash activity informing the user we need those permissions (along with + * other helpful information to approve). + */ + Intent phonePermissionRationaleIntent = + new Intent(this, RequestPermissionOnPhoneActivity.class); + startActivityForResult(phonePermissionRationaleIntent, REQUEST_PHONE_PERMISSION); + + } else if (commType == Constants.COMM_TYPE_RESPONSE_USER_APPROVED_PERMISSION) { + mPhoneStoragePermissionApproved = true; + updatePhoneButtonOnUiThread(); + logToUi("User approved permission on remote device, requesting data again."); + DataMap outgoingDataRequestDataMap = new DataMap(); + outgoingDataRequestDataMap.putInt(Constants.KEY_COMM_TYPE, + Constants.COMM_TYPE_REQUEST_DATA); + sendMessage(outgoingDataRequestDataMap); + + } else if (commType == Constants.COMM_TYPE_RESPONSE_USER_DENIED_PERMISSION) { + mPhoneStoragePermissionApproved = false; + updatePhoneButtonOnUiThread(); + logToUi("User denied permission on remote device."); + + } else if (commType == Constants.COMM_TYPE_RESPONSE_DATA) { + mPhoneStoragePermissionApproved = true; + String storageDetails = dataMap.getString(Constants.KEY_PAYLOAD); + updatePhoneButtonOnUiThread(); + logToUi(storageDetails); + } + } + } + + private void sendMessage(DataMap dataMap) { + Log.d(TAG, "sendMessage(): " + mPhoneNodeId); + + if (mPhoneNodeId != null) { + + PendingResult pendingResult = + Wearable.MessageApi.sendMessage( + mGoogleApiClient, + mPhoneNodeId, + Constants.MESSAGE_PATH_PHONE, + dataMap.toByteArray()); + + pendingResult.setResultCallback(new ResultCallback() { + @Override + public void onResult(MessageApi.SendMessageResult sendMessageResult) { + + if (!sendMessageResult.getStatus().isSuccess()) { + updatePhoneButtonOnUiThread(); + logToUi("Sending message failed."); + + } else { + Log.d(TAG, "Message sent successfully."); + } + } + }, Constants.CONNECTION_TIME_OUT_MS, TimeUnit.SECONDS); + + } else { + // Unable to retrieve node with proper capability + mPhoneStoragePermissionApproved = false; + updatePhoneButtonOnUiThread(); + logToUi("Phone not available to send message."); + } + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + // Check which request we're responding to + if (requestCode == REQUEST_PHONE_PERMISSION) { + // Make sure the request was successful + if (resultCode == RESULT_OK) { + logToUi("Requested permission on phone."); + DataMap dataMap = new DataMap(); + dataMap.putInt(Constants.KEY_COMM_TYPE, + Constants.COMM_TYPE_REQUEST_PROMPT_PERMISSION); + sendMessage(dataMap); + } + } + } + + /* + * There should only ever be one phone in a node set (much less w/ the correct capability), so + * I am just grabbing the first one (which should be the only one). + */ + private String pickBestNodeId(Set nodes) { + + String bestNodeId = null; + // Find a nearby node or pick one arbitrarily. + for (Node node : nodes) { + if (node.isNearby()) { + return node.getId(); + } + bestNodeId = node.getId(); + } + return bestNodeId; + } + + /* + * If Phone triggered the wear app for permissions, we open up the permission + * dialog after inflation. + */ + private void launchPermissionDialogForPhone() { + Log.d(TAG, "launchPermissionDialogForPhone()"); + + if (!mWearBodySensorsPermissionApproved) { + // On 23+ (M+) devices, GPS permission not granted. Request permission. + ActivityCompat.requestPermissions( + MainWearActivity.this, + new String[]{Manifest.permission.BODY_SENSORS}, + PERMISSION_REQUEST_READ_BODY_SENSORS); + } + } + + private void updatePhoneButtonOnUiThread() { + runOnUiThread(new Runnable() { + @Override + public void run() { + + if (mPhoneStoragePermissionApproved) { + + if (isAmbient()) { + mPhoneStoragePermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_approved_bw, 0, 0, 0); + } else { + mPhoneStoragePermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_approved, 0, 0, 0); + } + + } else { + + if (isAmbient()) { + mPhoneStoragePermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_denied_bw, 0, 0, 0); + } else { + mPhoneStoragePermissionButton.setCompoundDrawablesWithIntrinsicBounds( + R.drawable.ic_permission_denied, 0, 0, 0); + } + } + } + }); + } + + /* + * Handles all messages for the UI coming on and off the main thread. Not all callbacks happen + * on the main thread. + */ + private void logToUi(final String message) { + + boolean mainUiThread = (Looper.myLooper() == Looper.getMainLooper()); + + if (mainUiThread) { + + if (!message.isEmpty()) { + Log.d(TAG, message); + mOutputTextView.setText(message); + } + + } else { + runOnUiThread(new Runnable() { + @Override + public void run() { + if (!message.isEmpty()) { + Log.d(TAG, message); + mOutputTextView.setText(message); + } + } + }); + } + } +} \ No newline at end of file diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/RequestPermissionOnPhoneActivity.java b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/RequestPermissionOnPhoneActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..f4ee7fc8416bdfc6c22cf4283fc03888163dd254 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/RequestPermissionOnPhoneActivity.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2015 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.wearable.runtimepermissions; + +import android.os.Bundle; +import android.support.wearable.activity.WearableActivity; +import android.view.View; + +/** + * Asks user if they want to open permission screen on their remote device (phone). + */ +public class RequestPermissionOnPhoneActivity extends WearableActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_request_permission_on_phone); + setAmbientEnabled(); + } + + public void onClickPermissionPhoneStorage(View view) { + setResult(RESULT_OK); + finish(); + } +} \ No newline at end of file diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_cc_open_on_phone.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_cc_open_on_phone.png new file mode 100644 index 0000000000000000000000000000000000000000..618a44f6759669199d768ea92ed4ff621c4ffa64 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_cc_open_on_phone.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_permission_approved.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_permission_approved.png new file mode 100644 index 0000000000000000000000000000000000000000..79893302cfa3db0fbbec2289fbb9dbd9470f2d66 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_permission_approved.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_permission_approved_bw.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_permission_approved_bw.png new file mode 100644 index 0000000000000000000000000000000000000000..bbd7e8a96f4d7d53eefefeef5bd846d313a9579b Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_permission_approved_bw.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_permission_denied.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_permission_denied.png new file mode 100644 index 0000000000000000000000000000000000000000..814bb6359369b6556f6be6ec2d62cd3557a1fc5b Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_permission_denied.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_permission_denied_bw.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_permission_denied_bw.png new file mode 100644 index 0000000000000000000000000000000000000000..accd6c0020ca35c83b48a947319801ccdab684f7 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-hdpi/ic_permission_denied_bw.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_cc_open_on_phone.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_cc_open_on_phone.png new file mode 100644 index 0000000000000000000000000000000000000000..e66ba6b255900b460df6db877a9ea531408ca3bc Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_cc_open_on_phone.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_permission_approved.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_permission_approved.png new file mode 100644 index 0000000000000000000000000000000000000000..1e63d37c01721cd081356a526acabdd0552b49ed Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_permission_approved.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_permission_approved_bw.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_permission_approved_bw.png new file mode 100644 index 0000000000000000000000000000000000000000..16050cb25db643a082ae2fe54eb638c80c1b1eb7 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_permission_approved_bw.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_permission_denied.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_permission_denied.png new file mode 100644 index 0000000000000000000000000000000000000000..45a0d8750ee4092e9b3f84559f50e75e2814e8c9 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_permission_denied.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_permission_denied_bw.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_permission_denied_bw.png new file mode 100644 index 0000000000000000000000000000000000000000..376d4719356c4e49d1ec496f28a6d8a3e2aa0882 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-mdpi/ic_permission_denied_bw.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_cc_open_on_phone.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_cc_open_on_phone.png new file mode 100644 index 0000000000000000000000000000000000000000..5522d6c3f1fbc311ce9ca453c4103c08f5113f7b Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_cc_open_on_phone.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_permission_approved.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_permission_approved.png new file mode 100644 index 0000000000000000000000000000000000000000..24d1efbcc33518da432c6038fbc802f73041815e Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_permission_approved.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_permission_approved_bw.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_permission_approved_bw.png new file mode 100644 index 0000000000000000000000000000000000000000..2682e30ae7a86c675b51a5da6fd4a896cb640a48 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_permission_approved_bw.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_permission_denied.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_permission_denied.png new file mode 100644 index 0000000000000000000000000000000000000000..17f093d8833acbe3e613200efdb338fc56927c56 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_permission_denied.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_permission_denied_bw.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_permission_denied_bw.png new file mode 100644 index 0000000000000000000000000000000000000000..cd9d000b436b83347d24fdcb34bbcfe8b406a3d4 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xhdpi/ic_permission_denied_bw.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxhdpi/ic_permission_approved.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxhdpi/ic_permission_approved.png new file mode 100644 index 0000000000000000000000000000000000000000..f29c5a34127c464b41b0d10160ec14a6da13a9c0 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxhdpi/ic_permission_approved.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxhdpi/ic_permission_approved_bw.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxhdpi/ic_permission_approved_bw.png new file mode 100644 index 0000000000000000000000000000000000000000..1bcf27a78ee519123854da703baa57655a8db4bf Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxhdpi/ic_permission_approved_bw.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxhdpi/ic_permission_denied.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxhdpi/ic_permission_denied.png new file mode 100644 index 0000000000000000000000000000000000000000..52b0671f675e5e00a4f55e50370712961fbdb318 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxhdpi/ic_permission_denied.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxhdpi/ic_permission_denied_bw.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxhdpi/ic_permission_denied_bw.png new file mode 100644 index 0000000000000000000000000000000000000000..229203349840603d6cb3dbe441f54f14b9403ca8 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxhdpi/ic_permission_denied_bw.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxxhdpi/ic_permission_approved.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxxhdpi/ic_permission_approved.png new file mode 100644 index 0000000000000000000000000000000000000000..ec642b50d53ae3f6f90e859730f30990dbfc61ee Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxxhdpi/ic_permission_approved.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxxhdpi/ic_permission_approved_bw.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxxhdpi/ic_permission_approved_bw.png new file mode 100644 index 0000000000000000000000000000000000000000..c9eab85460b275c2ac39af181203d59ce967441e Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxxhdpi/ic_permission_approved_bw.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxxhdpi/ic_permission_denied.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxxhdpi/ic_permission_denied.png new file mode 100644 index 0000000000000000000000000000000000000000..35d6c4fab339dfb4fd6d35a6dbb42b80b222a671 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxxhdpi/ic_permission_denied.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxxhdpi/ic_permission_denied_bw.png b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxxhdpi/ic_permission_denied_bw.png new file mode 100644 index 0000000000000000000000000000000000000000..81e5355a71a44a1b2399787d78e1c65b5036c2d1 Binary files /dev/null and b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/drawable-xxxhdpi/ic_permission_denied_bw.png differ diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_main.xml b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000000000000000000000000000000000000..588ff9a8837d8b591c01b56e892f99aeb10e6677 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_main.xml @@ -0,0 +1,26 @@ + + + + + diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_request_permission_on_phone.xml b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_request_permission_on_phone.xml new file mode 100644 index 0000000000000000000000000000000000000000..c8a5d055888ae7dfdecc46df36bf421b453bf54f --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_request_permission_on_phone.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/rect_activity_main.xml b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/rect_activity_main.xml new file mode 100644 index 0000000000000000000000000000000000000000..5a44894a31746ca88009b9e132575127b40f73f2 --- /dev/null +++ b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/rect_activity_main.xml @@ -0,0 +1,57 @@ + + + + + + + +