Commit Graph

3534 Commits

Author SHA1 Message Date
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
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
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
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
TreeHugger Robot
dcd3618c54 Merge "Migrate to AAPT2" 2018-02-27 21:54:22 +00:00
Alan Viverette
a3d037382d Migrate to AAPT2
Bug: 73250914
Test: make checkbuild
Change-Id: I64ad5cb08aeb1e1c5cd2594dc0be1bbb105610f6
2018-02-27 20:30:57 +00:00
Anton Hansson
97f205fcc1 Merge "development: Set LOCAL_SDK_VERSION where possible." am: 76ce83e999 am: 132d4f2bc2
am: 5fad00498b

Change-Id: Ib16c0ff647fe0d6da63c6f562458ea047c6756d4
2018-02-26 16:53:23 +00:00
Anton Hansson
5fad00498b Merge "development: Set LOCAL_SDK_VERSION where possible." am: 76ce83e999
am: 132d4f2bc2

Change-Id: I4cfa3f21c957c32c8497051925fb34f3155817be
2018-02-26 16:45:11 +00:00
Anton Hansson
44b2e0dfcb development: Set LOCAL_SDK_VERSION where possible.
This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.

Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.

Test: make relevant packages
Bug: 73535841
Change-Id: I371bd0b43e66bcc4be1e26decb95c70519ac3342
2018-02-21 19:02:11 +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
Jiyong Park
d1d75c073f Merge "Build libsimplejni using SDK" am: 86c0968a05 am: bebb47b683
am: fd41a528f4

Change-Id: Id621990d8b02fe279806fc4f1c794f567b7c83ff
2018-02-15 08:03:13 +00:00
Jiyong Park
fd41a528f4 Merge "Build libsimplejni using SDK" am: 86c0968a05
am: bebb47b683

Change-Id: Ib263bb9e4ecc987edc1de86c97ceff20f3119862
2018-02-15 07:56:37 +00:00
Jiyong Park
6a91a9ad8a Build libsimplejni using SDK
The lib hasn't been built using SDK and thus has been causing link-type
check warning from SimpleJNI which is built using SDK. Since the warning
will turn into error soon, fixing the warning by correctly building the
lib with SDK.

Bug: 69899800
Test: m -j SimpleJNI is successful and does not show any link-type check
warning

Change-Id: I51edfe296c70ac99ac7698b5e06ec0e0c678945c
2018-02-14 17:10:57 +09: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
f1c79d99bf Clarified conditions that require client-side unbindService() call.
am: a57908a18e

Change-Id: I5348f96ec2ea72637c54951a87dfd9b2d1421bcd
2018-01-17 01:12:13 +00: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
a57908a18e 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-12 13:58:57 -08: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
Yohei Yukawa
45ef8b0a9e Add ThemedNavBarKeyboard sample
This CL adds a sample IME that demonstrates how an IME can now control
the appearance of bottom navigation bar like typical Activities can
do.

This sample IME covers the following 3 use cases to control the
appearance of bottom navigation bar.

A. (Bottom) navigation bar has solid background color.
    Like typical Activities, IMEs can
    - call Window#setNavigationBarColor() to change the background
      color. (Bug 25706186)
    - set SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR to tell the SysUI to
      optimize the navigation bar button colors. (Bug 69002467)

B. (Bottom) navigation background is seamlessly extended from the main
   InputView of the IME, like typical Activities can do with
   SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION.  Note that essentially this
   is a super set of the mode A, because IMEs (and apps) can also fill
   the navigation bar region with a solid color in this mode.

C. The appearance of (bottom) navigation bar is controlled by the
   target application, not by the IME.
   - This is useful for floating IME (Bug 22564251).

Bug: 25706186
Bug: 69002467
Test: Build and manually test as follows.
  1. make -j ThemedNavBarKeyboard
  2. adb install -r $OUT/system/app/ThemedNavBarKeyboard/ThemedNavBarKeyboard.apk
  3. adb shell ime enable com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard
  4. adb shell ime set com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard
Change-Id: I4b10a19641bd3ce6c43e7629404b6f202d4186e8
2017-12-25 16:45:24 -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
Jon Dormody
05e8c5bcf9 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

Change-Id: Ib841238c938c210f35f4f623de969038b9192779
2017-12-22 22:22:45 +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
Paul Duffin
50840e6a26 Flatten dependency hierarchy of legacy-android-test
Previous changes statically included legacy-android-test in preparation
for removing android.test.* and junit.* classes from the android.jar.
Unfortunately, that lead to duplicate classes between APKs and the
bootclasspath which caused build problems (Proguard) and also runtime
problems (when targeting and running on older releases).

Switching from statically including the classes to using the runtime
libraries cannot be done in one step because legacy-android-test is
statically included in libraries which are used in many APKs and so
removing it from those libraries requires that all APKs be updated at
once. Doing that atomically across dozens of projects is not practical.

This change modifies APKS that statically include the
legacy-android-test library indirectly.

* If the APK manifest uses the android.test.runner library then the APK
  is modified to stop statically including legacy-android-test and
  instead build against android.test.base/mock/runner libraries instead.

* Otherwise, the APK statically includes legacy-android-test.

Also, any libraries that statically include are modified to stop
statically including it and if it has source dependencies on the classes
is changed to build against the android.test.base/mock/runner libraries.

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/UiAutomator/Android.mk
    Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
    uiautomator.samples has a source dependency on its classes

Bug: 30188076
Test: make checkbuild
Change-Id: I07b9638373eae0e36c365b604748b1279793620b
2017-12-08 23:43:32 +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
Xin Li
b8d81aed6c Merge commit '514a23836bc263e729c89b4c1ec60912a7cb6765' from
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master

Change-Id: I9c96b666efe553d2bc51fca5b9ca5d29c45be083
2017-11-14 11:47:59 -08:00
Fyodor Kupolov
e454568215 Merge "APK Cache Demo App" am: cd3a0fe97c am: 09408cb0e6
am: 2d5e4260ef

Change-Id: Ie80183e6e47e9a79a6cd37b69a7af85875fd38c4
2017-11-13 22:44:55 +00:00
Fyodor Kupolov
2d5e4260ef Merge "APK Cache Demo App" am: cd3a0fe97c
am: 09408cb0e6

Change-Id: I04a47027504c8e6c7c292ee940ba11fe082fac20
2017-11-13 22:41:47 +00:00
Fyodor Kupolov
cd3a0fe97c Merge "APK Cache Demo App" 2017-11-13 22:33:17 +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
Chih-Hung Hsieh
64fb92956b Merge "Use -Werror in development" am: 14b2eeb009 am: cee88a6a9a
am: a38ca6bb58

Change-Id: I2ad9578e5185253478dd28c5b9e24ba539149036
2017-10-28 00:29:04 +00:00
Chih-Hung Hsieh
a38ca6bb58 Merge "Use -Werror in development" am: 14b2eeb009
am: cee88a6a9a

Change-Id: I04f10d5d80f6ca8c58ad5ba609b95ba98507b250
2017-10-27 23:57:58 +00:00