Commit Graph

892 Commits

Author SHA1 Message Date
Nick Cook
e96e1fd5c3 docs: Fix outdated sample code in Context#getExternalFilesDir. Test: make ds-docs am: f767eb4aa9 am: cc4b685d3e
am: 458535f402

Change-Id: I598109be9bb03349f93e9266e18372aa5e9f199e
2019-08-19 18:25:38 -07:00
Nick Cook
f767eb4aa9 docs: Fix outdated sample code in Context#getExternalFilesDir.
Test: make ds-docs

Bug: 129290716
Change-Id: I0b1c1d9222c96c6bb2777f58d273546c81d77eb2
2019-08-20 00:45:50 +00:00
Bob Badour
801760580f Merge "Clarify license terms for Romain Guy's artwork." am: a37de64bd6
am: fb5f7546b0

Change-Id: I964e6ca1dcc1bf15925d79a80e9707d8e691c4d8
2019-06-27 20:31:48 -07:00
Bob Badour
e72c60e885 Clarify license terms for Romain Guy's artwork.
As discussed with Romain Guy in the email thread, the Apache 2.0
license applies to the affected .jpg files now and retroactively from
the time of import.

Usage terms updated using exiftool:

$ exiftool -UsageTerms='Apache License Version 2.0' \
    development/samples/ApiDemos/res/drawable-nodpi/frantic.jpg
Warning: [minor] Fixed incorrect list type for XMP-xmpRights:UsageTerms - development/samples/ApiDemos/res/drawable-nodpi/frantic.jpg
    1 image files updated
$ exiftool -URL -WebStatement -UsageTerms -Rights -Creator \
    development/samples/ApiDemos/res/drawable-nodpi/frantic.jpg
Usage Terms                     : Apache License Version 2.0
Rights                          : Romain Guy
Creator                         : Romain Guy
$ exiftool -UsageTerms='Apache License Version 2.0' \
    development/samples/devbytes/animation/PictureViewer/res/drawable-nodpi/p3.jpg
    1 image files updated
$ exiftool -URL -WebStatement -UsageTerms -Rights -Creator \
    development/samples/devbytes/animation/PictureViewer/res/drawable-nodpi/p3.jpg
Usage Terms                     : Apache License Version 2.0
Rights                          : Romain Guy
Creator                         : Romain Guy
$ exiftool -UsageTerms='Apache License Version 2.0' \
    development/samples/devbytes/animation/PictureViewer/res/drawable-nodpi/p2.jpg
    1 image files updated
$ exiftool -URL -WebStatement -UsageTerms -Rights -Creator \
    development/samples/devbytes/animation/PictureViewer/res/drawable-nodpi/p2.jpg
Usage Terms                     : Apache License Version 2.0
Rights                          : Romain Guy
Creator                         : Romain Guy
$ exiftool -UsageTerms='Apache License Version 2.0' \
    development/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p3.jpg
    1 image files updated
$ exiftool -URL -WebStatement -UsageTerms -Rights -Creator \
    development/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p3.jpg
Usage Terms                     : Apache License Version 2.0
Rights                          : Romain Guy
Creator                         : Romain Guy
$ exiftool -UsageTerms='Apache License Version 2.0' \
    development/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p2.jpg
    1 image files updated
$ exiftool -URL -WebStatement -UsageTerms -Rights -Creator \
    development/samples/devbytes/animation/ActivityAnimations/res/drawable-nodpi/p2.jpg
Usage Terms                     : Apache License Version 2.0
Rights                          : Romain Guy
Creator                         : Romain Guy

Test: doesn't realy apply to images

Change-Id: If060c6ba0f0279e3a7e6446061d50cd8e4cdec3c
2019-06-27 14:58:10 -07:00
Bob Badour
3bdea97ab6 Merge "Clarify license terms for Romain Guy's artwork." am: 0e3bcf70c5
am: bcd745dddc

Change-Id: I330e55df545251008c1940ec9b22732799de7fc5
2019-06-05 14:59:37 -07:00
Bob Badour
d41e5f7851 Clarify license terms for Romain Guy's artwork.
As discussed with Romain Guy in the email thread, the Apache 2.0
license applies to the affected .jpg files now and retroactively from
the time of import.

Each of the images was altered using the exiftool:

exiftool -WebStatement=http://www.apache.org/licenses/LICENSE-2.0

Change-Id: I557d0129617164209a3eec7ec2d228f266643ca0
2019-06-05 20:08:08 +00:00
Ivan Chiang
2388037eac Add the sample of adding query content in intent
Add the query content in intent

Bug: 119866469
Test: manually using ApiDemos Content > Storage > Documents
Change-Id: I97ccd1ca6d3e1ecbddefe353b625c145d4c0ecd0
2018-12-27 21:35:15 +08:00
Amin Shaikh
8109cdef05 Test StorageVolume#createOpenDocumentTreeIntent
Also fix bug where persistent uri access was not taken for
OPEN_DOCUMENT_TREE intents.

Change-Id: Iccc3e2434e08e42fa84dc3ceb3fbfe1db1320180
Fixes: 119519300
Test: manually using ApiDemos Content > Storage > Documents
2018-12-18 15:06:58 -05:00
Louis Pullen-Freilich
1496f57583 Removes framework Preference demos
The framework Preference APIs are deprecated, so these samples are
misleading and should be removed.

Trying to submit again now that the relevant sample tags have been removed.

Bug: b/119602280
Test: n/a
Change-Id: I7efb509f5c938122575cf4177b50872bfc089d00
2018-11-19 18:05:33 +00:00
Louis Pullen-Freilich
4b364839bd Revert "Removes framework Preference demos"
This reverts commit 946280d6ce.

Reason for revert: Breaking builds due to doc generation using these samples

Change-Id: I7caf9792e84e0e1eedea4a7294a321c684be2d5c
2018-11-16 18:26:28 +00:00
Louis Pullen-Freilich
946280d6ce Removes framework Preference demos
The framework Preference APIs are being deprecated, so removing the
samples will help avoid confusion.

Bug: b/119602280
Test: n/a
Change-Id: Ib3a2c38b8fbb0f1afc9ef6a35963def46ee931f7
2018-11-15 12:51:50 +00:00
KOUSHIK PANUGANTI
7f203340ff Migrated various apps under development/samples/ApiDemos to androidx
Bug: 76692459
Test: make ApiDemos
Change-Id: Ie02783ba14b294a220383a3d53e96a6fdb3117b8
2018-04-24 17:13:55 -07:00
Vladislav Kaznacheev
0af910ed69 Merge "Use menu shortcuts in ApiDemos" into pi-dev am: 08207ad842
am: 413f32b4cf

Change-Id: I18463149d3755b1a558dd3c068afaf9fc6f536cf
2018-04-23 14:41:25 -07:00
Vladislav Kaznacheev
603a758caf Use menu shortcuts in ApiDemos
Add alphabetic shortcuts to the menu in ActionBarUsage. This mirrors
what is already present in a similar support lib demo.

Bug: 31045453
Test: run com.example.android.apis.app.ActionBarUsage on a device
  with keyboard shortcuts enabled (such as Chromebook). Action menu
  items should display keyboard shortcuts.

Change-Id: I9e6b04df8e2a6cbc728cb60b3706d054521da7cb
2018-04-17 23:02:47 +00:00
Christopher Tate
5c624704ac Merge "Add use of PendingIntent.getForegroundService()" into pi-dev am: 827c8e99ee
am: 28f6e065b8

Change-Id: I348ec6111c4edc79fa9bbab919b22a3eb0ca3e24
2018-03-21 21:27:33 +00:00
Christopher Tate
fc7c9f5d5c Add use of PendingIntent.getForegroundService()
In particular, we have an example of a foreground-service PendingIntent
triggered by a 15-second delayed alarm following a button click.  This
is enough time to exercise use cases like swiping the app out of recents
before the alarm fires, therefore entering the "starting a fg service
when the app is not in a fg state" flows.

Bug: 73559697
Test: this is it
Change-Id: If57908ab852c7a0bfab7bb1da8eda0a47493fc6b
2018-03-19 16:25:01 -07:00
Adrian Roos
ed6c44154f Merge "ApiDemos: Add maxAspectRatio demo" into pi-dev am: 246c5bb514
am: fc63532956

Change-Id: I5506ba436220e14289ebe9344a976bc3876d25ec
2018-03-15 17:02:02 +00:00
Adrian Roos
59e2e04dc1 ApiDemos: Add maxAspectRatio demo
Bug: 72696928
Test: Install and open ApiDemos > App > Activity > Max Aspect Ratio > 1:1 / 16:9 / Any
Change-Id: Ie76c8c4babd6b4c281eec8ff977a0c02a868ee0e
2018-03-15 15:32:12 +01:00
TreeHugger Robot
9577597bb9 Merge "don't call methods that are now removed" 2018-03-10 00:02:50 +00:00
Dianne Hackborn
7049e08d6f Fix issue #72116995: Add permission guarding Service#startForeground
Bug: 72116995
Test: atest CtsAppTestCases
Change-Id: I3fab8561028d5c2b54a5e8468f7ff51bcd7bc3df
2018-03-05 17:00:51 -08:00
Derek Sollenberger
e99a121cac Remove deprecated android.graphics.Canvas APIs
Bug: 73777445
Test: compile
Change-Id: I0f203dd55d15408b1ebbbbb33e0d0b53366cc241
2018-02-28 20:17:07 -05:00
Jiyong Park
b9d4110d50 Fix link-type check warning on ApiDemos
ApiDemos has been using private APIs from telephony-common to
demonstrate the Mms feature. However, this is causing link-type check
warning because ApiDemos itself is built with SDK (LOCAL_SDK_VERSION is
set) but telephony-common isn't. As we are working on to promote the
warnings into errors, this warnings must be fixed.

Fixing the warning by copying the PDU classes from telephony-common, so
that there is no need to link to the library. Also the package name for
the copied classes are all changed in order to prevent the collision
with the same classes in telephony-common which is in the boot class
path.

Test: m -j ApiDemos is successful and does not show any link-type check
warning.

Change-Id: Ica508cd4daf3640e4f90fa26dd11dfd03867d717
2018-02-28 09:36:54 +09:00
Alan Viverette
a3d037382d Migrate to AAPT2
Bug: 73250914
Test: make checkbuild
Change-Id: I64ad5cb08aeb1e1c5cd2594dc0be1bbb105610f6
2018-02-27 20:30:57 +00:00
Mike Reed
a46f0a0858 don't call methods that are now removed
Test: make

Bug: 14646703
Change-Id: I55b5936bf8ed2f7832f734068737053cc29580ea
2018-02-27 14:57:17 +00:00
Adrian Roos
9f8d264a84 Follow-up to I205cdc00533b19be46c7837012a96705c7a4a62f
Test: mmm development/samples/ApiDemos
Change-Id: I3794c3c94785c4de3b130201ff70d05dbe792256
2018-02-20 12:22:17 +01:00
Adrian Roos
71fc3601bd ApiSamples: Add PIP sample
Test: Open ApiSamples > App > Activity > Picture in Picture
Change-Id: I205cdc00533b19be46c7837012a96705c7a4a62f
2018-02-19 18:34:48 +01:00
Ian Pedowitz
b19c1b8ec6 Revert "Fix issue #72116995: Add permission guarding Service#startForeground"
This reverts commit 7890baea48.

Reason for revert: b/73224471

Bug: 73224471
Bug: 72116995
Change-Id: Ife5dc5c14026ae7dcb126b0b3c3e7701ed3eaebe
2018-02-12 16:12:26 +00:00
Dianne Hackborn
7890baea48 Fix issue #72116995: Add permission guarding Service#startForeground
Bug: 72116995
Test: atest CtsAppTestCases
Change-Id: I88e3f6f1395b7ee0c0af41c9f7e9a5971da17631
2018-02-07 14:05:31 -08:00
Makoto Onuki
10d6c41f9b Add while-idle alarm support to apidemos
Test: Manual test
Bug: 72124522
Change-Id: I9d0c0ed4b6a045e4f8f566c4e9844290e850e2fc
2018-01-30 13:20:06 -08:00
Dianne Hackborn
0d3c8bac64 Revert "Fix issue #72116995: Add permission guarding Service#startForeground"
This reverts commit cbe2f1bf27.

Test: NA
Bug: 72116995
2018-01-25 12:55:58 -08:00
Dianne Hackborn
79651091b3 Merge "Fix issue #72116995: Add permission guarding Service#startForeground" 2018-01-24 17:58:49 +00:00
Jiyong Park
8c8cb53a4f Use stubs libs for android.test.base/runner/mock
android.test.base/runner/mock libraries are shared libraries that are
built without SDK, but with framework interanl libraries (framework.jar,
etc). Apps or libs that are built with SDK (LOCAL_SDK_VERSION is set)
shouldn't use them, but instead the stubs version of the test framework
libraries, which are built using SDK.

This is because, the build system does not allow a module built with SDK
to depend on another module built without SDK. This has been
exceptionally allowed with warnings, but will soon be errors.

In order to prevent the expected build breakage, direct reference to the
shared libraries are all changed to the stubs libraries.

Note: no one has been using these shared libs statically. So, it is
guaranteed that they won't encounter a problem due to missing
<uses-library name="android.test.runner"/> even after this change.

Bug: 69899800
Test: m -j checkbuild
Change-Id: I7f25e0127c52c56adf288163a760f3dc9aee6586
2018-01-24 15:21:38 +09:00
Dianne Hackborn
cbe2f1bf27 Fix issue #72116995: Add permission guarding Service#startForeground
Bug: 72116995
Test: atest CtsAppTestCases
Change-Id: Ib8471d514bc2c126c34a867ca8ff77d90be9661e
2018-01-21 19:57:14 -08:00
Kevin Hufnagle
724482dce9 Merge "Clarified conditions that require client-side unbindService() call." into oc-mr1-dev-plus-aosp
am: d1cd393c57

Change-Id: Id0fb13a23d37ae92844a99f1b81050527b556a53
2018-01-17 01:07:20 +00:00
Kevin Hufnagle
6137a917e5 Clarified conditions that require client-side unbindService() call.
The documentation for android.app.Service includes an example from
LocalServiceActivities.java. This example now better shows and
explains the distinction between binding and connecting. It also
shows the set of conditions that require the client to call
unbindService().

Test: make ds-docs -j16

Bug: 63118511
Change-Id: I1276de3f9421e13e1964039d37db9adc87f3039f
2018-01-10 20:47:32 -08:00
Kevin Hufnagle
50da6eb42c Clarified conditions that require client-side unbindService() call.
The documentation for android.app.Service includes an example from
LocalServiceActivities.java. This example now better shows and
explains the distinction between binding and connecting. It also
shows the set of conditions that require the client to call
unbindService().

Test: make ds-docs -j16

Bug: 63118511
Change-Id: I1276de3f9421e13e1964039d37db9adc87f3039f
2018-01-09 15:53:58 -08:00
Jon Dormody
f99c699cac Merge "Docs: Moved // BEGIN_INCLUDE a few lines up so readers understand the context of the Binding class (it's an inner-class)" into oc-mr1-dev am: 4204ce2ae1
am: 05e8c5bcf9

Change-Id: Id058d0ef9d65fe6a907860ac28fcf3caed2b1464
2017-12-22 22:25:13 +00:00
Jonathan Dormody
a088275ef3 Docs: Moved // BEGIN_INCLUDE a few lines up so readers understand the
context of the Binding class (it's an inner-class)

Test: make ds-docs

Bug: 2781699
Change-Id: I90c70f9b9f918a941c719e8b020b3c69f826cd43
2017-12-21 10:39:25 -07:00
Paul Duffin
4fe452b0e7 Add android.test.base/stubs dependency
In preparation for the removal of the non-junit classes in the
android.test.base library from the android.jar this adds a dependency
on android.test.base/stubs to ensure this code will continue to
compile.

The following change descriptions were generated automatically and so
may be a little repetitive. They are provided to give the reviewer
enough information to check the comments match what has actually been
changed and check the reasoning behind the changes.

* samples/ApiDemos/tests/Android.mk
    Added 'android.test.base.stubs' to LOCAL_JAVA_LIBRARIES because
    ApiDemosTests's will need them in order to compile once its classes
    are removed from the current SDK on which it currently depends.

* samples/BrokenKeyDerivation/tests/Android.mk
    Added 'android.test.base.stubs' to LOCAL_JAVA_LIBRARIES because
    BrokenKeyDerivationTests's will need them in order to compile once
    its classes are removed from the current SDK on which it currently
    depends.

* samples/HelloActivity/tests/Android.mk
    Added 'android.test.base.stubs' to LOCAL_JAVA_LIBRARIES because
    HelloActivityTests's will need them in order to compile once its
    classes are removed from the current SDK on which it currently
    depends.

* samples/LunarLander/tests/Android.mk
    Added 'android.test.base.stubs' to LOCAL_JAVA_LIBRARIES because
    LunarLanderTests's will need them in order to compile once its
    classes are removed from the current SDK on which it currently
    depends.

* samples/SkeletonApp/tests/Android.mk
    Added 'android.test.base.stubs' to LOCAL_JAVA_LIBRARIES because
    SkeletonAppTests's will need them in order to compile once its
    classes are removed from the current SDK on which it currently
    depends.

* samples/Snake/tests/Android.mk
    Added 'android.test.base.stubs' to LOCAL_JAVA_LIBRARIES because
    SnakeTests's will need them in order to compile once its classes
    are removed from the current SDK on which it currently depends.

* samples/Vault/Android.mk
    Added 'android.test.base.stubs' to LOCAL_JAVA_LIBRARIES because
    Vault's will need them in order to compile once its classes are
    removed from the current SDK on which it currently depends.

Bug: 30188076
Test: make dist
Change-Id: Id7fb558504706668a85bf840529f6cd075499d6a
2017-12-15 07:22:37 +00:00
Peter Visontay
e746637688 Merge "Add an ApiDemo for showing an overlay window." 2017-12-14 14:02:53 +00:00
Paul Duffin
ec8144a066 Merge "Stop statically including legacy-android-test" 2017-12-12 20:11:25 +00:00
Peter Visontay
48f2a3142e Use FileProvider (instead of a world-readable file) in the APK installer demo.
World-readable files have been disallowed since N.

Test: Manually.
Change-Id: Iab174799403023378200d75dac5e8cd02e64dbf8
2017-12-12 18:16:29 +00:00
Peter Visontay
ad360d40be Add an ApiDemo for showing an overlay window.
Test: manually.
Change-Id: I9eaa9c0eeb3bc04389c27a7fe5e74fc5acdc59fd
2017-12-12 15:44:02 +00:00
Paul Duffin
aa592fea27 Stop statically including legacy-android-test
Statically including legacy-android-test leads to duplicate classes
which causes build time problems (with Proguard) and runtime problems on
older SDK versions. This change:
* Stops statically including legacy-android-test.
* Adds compile time dependencies on andoid.test.base, android.test.mock
  and android.test.runner where necessary.
* Adds <uses-library android:name="android.test.runner"/> to any
  affected package to ensure that the classes that were included by
  legacy-android-test are still available at runtime. That also adds a
  dependency on android.test.base and android.test.mock.

The following change descriptions were generated automatically and so
may be a little repetitive. They are provided to give the reviewer
enough information to check the comments match what has actually been
changed and check the reasoning behind the changes.

* samples/ApiDemos/tests/Android.mk
    Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
    because statically including the classes in ApiDemosTests results
    in duplicate classes which leads to build time and compile time
    issues.

* samples/BrokenKeyDerivation/tests/Android.mk
    Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
    because statically including the classes in
    BrokenKeyDerivationTests results in duplicate classes which leads
    to build time and compile time issues.

* samples/HelloActivity/tests/Android.mk
    Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
    because statically including the classes in HelloActivityTests
    results in duplicate classes which leads to build time and compile
    time issues.

* samples/LunarLander/tests/Android.mk
    Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
    because statically including the classes in LunarLanderTests
    results in duplicate classes which leads to build time and compile
    time issues.

* samples/SkeletonApp/tests/Android.mk
    Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
    because statically including the classes in SkeletonAppTests
    results in duplicate classes which leads to build time and compile
    time issues.

* samples/Snake/tests/Android.mk
    Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
    because statically including the classes in SnakeTests results in
    duplicate classes which leads to build time and compile time
    issues.

* samples/Vault/Android.mk
    Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
    because statically including the classes in Vault results in
    duplicate classes which leads to build time and compile time
    issues.

    Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because
    Vault's source depends on its classes and because of these changes
    they are no longer present on the compilation path.

* samples/Vault/AndroidManifest.xml
    Add uses-library for android.test.runner because otherwise this
    change would change the set of files available to Vault at runtime.

Bug: 30188076
Test: make checkbuild
Change-Id: I9f42f9216b7a40f1f139699e9c4df04325d577a1
2017-12-12 15:24:57 +00:00
Peter Visontay
6b7860e588 Remove obsolete code from the InstallApk API demo.
1) Remove the "Refresh package" demo. This was using Intent.EXTRA_ALLOW_REPLACE, which was deprecated in API 16.
2) Java code cleanup.

Test: Manually.
Change-Id: I0cbff934ca223a3fe73a1044ed68f3e079be8237
2017-11-17 10:00:02 +00:00
Peter Visontay
5425b98c78 Merge "Update the HelloActivity.apk bundled with ApiDemos, used to demonstrate the package installer API." 2017-11-17 09:55:46 +00:00
Peter Visontay
75bca25be1 Add a demo of the Session-based PackageInstaller to ApiDemos.
Test: Manually.
Change-Id: If084477e8970777ef5cd90c55afe86a116ee1458
2017-11-16 21:49:17 +00:00
Peter Visontay
78f7e6b048 Update the HelloActivity.apk bundled with ApiDemos, used to demonstrate the package installer API.
The current APK was built to target the ICS SDK, and cannot be installed on newer versions:
"Failure [INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl1087711068.tmp/base.apk (at Binary XML file line #0): Requires development platform IceCreamSandwich (current platform is any of [P])]"

The APK I'm checking in was built from development/samples/HelloActivity, with this added to the manifest:
    <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23" />
This is the same as the ApiDemos app's minSdk and targetSdk.

Test: Manually rebuilt ApiDemos, and installed the package using the InstallApk activity.
Change-Id: I337200234662277b0253fd7fdfa96e1ee229e912
2017-11-15 17:48:20 +00:00
Felipe Leme
e47849665c Added autofill tags on dialog sample.
Bug: 68816440
Test: mmm -j50 development/samples/ApiDemos && adb install -r $OUT/data/app/ApiDemos/ApiDemos.apk

Change-Id: Ia7514ba3edb7e057fe8490079856d0a233c77fcd
2017-11-08 12:53:55 -08:00
Clara Bayarri
e38828eaac Merge "Replace fonts of unclear origin" into oc-dev
am: ac2a416a5b

Change-Id: I5592ae97240969a7cc68f38a1599c50bc03322f2
2017-06-07 16:42:27 +00:00