Commit Graph

3865 Commits

Author SHA1 Message Date
Treehugger Robot
fcfc138048 Merge "AconfigDemo: associate each flag with exactly one bug" into main 2023-07-28 07:14:42 +00:00
Mårten Kongstad
dc5f6e451e AconfigDemo: associate each flag with exactly one bug
aconfig now requires that each flag is associated with exactly one bug.
Update aconfig_demo_flags.aconfig accordingly.

Also standardize use of whitespace.

Bug: 293156797
Test: presubmit
Change-Id: I3e10f7055ffb2776fbe825f0902b735ca4674b58
2023-07-27 13:54:18 +02:00
Yuyang Huang
3dd4037e6d Add NsdManagerSampleApps to show how to usd NsdManager API
The TestDiscoverService app covers the API for service discover. The
TestAdvertiseService app covers the APT for service advertisement.

Test: ./gradlew build
Change-Id: I6a8d94bbe88a9a20b1adcda8e0916898c68e7ea5
2023-07-24 17:15:34 +09:00
Guang Zhu
1037f3dc47 Add direct usage of Flags in demo app
So that flags aren't subject to optimization

Bug: 289449667
Test: atest FlagStateComboTests
Change-Id: Idafa571e74448fad3ae3d36c1e00a960abb21f24
2023-06-30 12:34:16 -07:00
Guang Zhu
b6434aae53 add more variantions for flag on/off filtering demo
... also fixed missing copyright headers in 2 existing test files
... also made the instrumentation against the demo activity for real

Bug: 277819423
Test: atest FlagStateComboTests
      adb shell device_config put test \
        com.example.android.aconfig.demo.flags.awesome_flag_1 <true|false>
      adb shell device_config put test \
        com.example.android.aconfig.demo.flags.awesome_flag_2 <true|false>
Change-Id: I6083f11ee743a8b4f0f9bc23ac6945b5d072ab5e
2023-06-29 16:03:24 -07:00
Zhi Dou
da74895830 Add bugs in the flag declaration
Test: presubmit
Bug: 287644619
Change-Id: I676d2415c833354b1f053fcd04da8dace61943cd
2023-06-29 17:29:22 +00:00
Zhi Dou
403b998e1d Add a new flag for demo
Bug: 287644619
Test: presubmit
Change-Id: Ic91d0f7e829a249dd6d1d8973d9c179b545d025b
2023-06-28 19:24:05 +00:00
Zhi Dou
52f9498e0e Add Injection use case
Add the Injection use case of Aconfig flag.

Add corresponding tests.

Test: atest AconfigDemo_ContentLibs_Test
Bug: 287644619
Change-Id: I47cea59764b2956644ad0c159945d3cdb3231c09
2023-06-23 22:35:41 +00:00
Zhi Dou
648c081b56 A simple app uses aconfig flag
Add a simple app uses aconfig.

This app can demonstrate

1. declare aconfig flag
2. build aconfig flag in building system
3. generate aconfig java flag
4. use aconfig java flag in java code

Test: atest AconfigDemo_ContentProvide_Test
Bug: 280833426
Change-Id: Ieacbe4b2368a00872254dab1c87dc66c569fc30a
2023-06-23 00:26:04 +00:00
Zhi Dou
709eb6d9a2 Add a folder for Aconfig demo
The Aconfig demo will be used as
1. As an example for aconfig code lab
2. As an example for user to learn Aconfig

Test: N/A
Bug: 287644619
Change-Id: Ida6c922fdd52caaecfadff99809a70fab8442814
2023-06-16 17:39:23 +00:00
Anvesh Renikindi
4b48ea39e3 Added shortcutlauncherdemo Initialization provider
Bug: 277943394
Change-Id: I4a87f0539e1f269b5990acd522ba3916fdb6fe56
Test: None
2023-05-10 18:57:52 +00:00
Henri Chataing
5db4bef9d5 Revert^2 "Remove samples for deprecated Android Beam API"
8de7b4b166

Change-Id: I415762b2fcbc9706a33d7a41858c1c142bb7ffab
Merged-In: I415762b2fcbc9706a33d7a41858c1c142bb7ffab
(cherry picked from commit 614c1aec90)
2023-03-14 23:27:34 +00:00
Hongwei Wang
5f56b6a2d7 Support aspect ratio change in PiP demo am: 0373c0b168
Original change: https://googleplex-android-review.googlesource.com/c/platform/development/+/20655734

Change-Id: Id9fed6a36eb9fa389f92f21e71af77feccca7694
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-07 19:20:40 +00:00
Hongwei Wang
0373c0b168 Support aspect ratio change in PiP demo
For testing and demo purpose, currently support selecting from well
defined list of aspect ratio, include 21:9, 16:9, 1:1, 9:16 and 9:21

Video: http://recall/-/aaaaaabFQoRHlzixHdtY/gqFQI7mpeQ6EZZ5JibsV6R
Bug: 198643358
Test: Change aspect ratio within the app, see video
Change-Id: I0580dc45bf32e795fefd7d80f5183f268f810790
2022-12-06 15:11:17 -08:00
Elliott Hughes
b240895819 Merge "Remove renderscript samples." am: 14f9cec041
Original change: https://android-review.googlesource.com/c/platform/development/+/2282102

Change-Id: I63a95ff65f3992bd25fc5e0490ff121e37df2a89
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-03 16:08:40 +00:00
Elliott Hughes
cbb1cbc777 Remove renderscript samples.
Renderscript is deprecated and scheduled for removal. Let's start by
removing the easiest part to remove.

Test: treehugger
Change-Id: I5f172497756c3931ccfda742e9c08bde56b362c9
2022-11-02 16:56:36 +00:00
Treehugger Robot
123b01e28f Merge "Fix errorprone warnings that should be errors" am: eb8582344b
Original change: https://android-review.googlesource.com/c/platform/development/+/2254753

Change-Id: I3ab35338f5e066a20adf163ebbff21d4b6cf0172
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-17 16:38:28 +00:00
Cole Faust
a54b856e8d Fix errorprone warnings that should be errors
This commit is part of a large scale change to fix errorprone
errors that have been downgraded to warnings in the android
source tree, so that they can be promoted to errors again.
The full list of changes include the following, but not all
will be present in any one individual commit:

BadAnnotationImplementation
BadShiftAmount
BanJNDI
BoxedPrimitiveEquality
ComparableType
ComplexBooleanConstant
CollectionToArraySafeParameter
ConditionalExpressionNumericPromotion
DangerousLiteralNull
DoubleBraceInitialization
DurationFrom
DurationTemporalUnit
EmptyTopLevelDeclaration
EqualsNull
EqualsReference
FormatString
FromTemporalAccessor
GetClassOnAnnotation
GetClassOnClass
HashtableContains
IdentityBinaryExpression
IdentityHashMapBoxing
InstantTemporalUnit
InvalidTimeZoneID
InvalidZoneId
IsInstanceIncompatibleType
JUnitParameterMethodNotFound
LockOnBoxedPrimitive
MathRoundIntLong
MislabeledAndroidString
MisusedDayOfYear
MissingSuperCall
MisusedWeekYear
ModifyingCollectionWithItself
NoCanIgnoreReturnValueOnClasses
NonRuntimeAnnotation
NullableOnContainingClass
NullTernary
OverridesJavaxInjectableMethod
ParcelableCreator
PeriodFrom
PreconditionsInvalidPlaceholder
ProtoBuilderReturnValueIgnored
ProtoFieldNullComparison
RandomModInteger
RectIntersectReturnValueIgnored
ReturnValueIgnored
SelfAssignment
SelfComparison
SelfEquals
SizeGreaterThanOrEqualsZero
StringBuilderInitWithChar
TreeToString
TryFailThrowable
UnnecessaryCheckNotNull
UnusedCollectionModifiedInPlace
XorPower

See https://errorprone.info/bugpatterns for more
information on the checks.

Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: Ic7e78cc74523ee09c1b4aa9969756f0cfd609e08
2022-10-15 21:33:28 -07:00
Treehugger Robot
c597652305 Merge "Add FLAG_IMMUTABLE to PendingIntents" am: a3aa817aa5 am: b119c3792c am: fc609be986 am: 37b0cb3495
Original change: https://android-review.googlesource.com/c/platform/development/+/2229375

Change-Id: Id7f9eb8de9f8de3f221d05ff98f31cf45ba9ce8b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-24 02:26:04 +00:00
Cole Faust
f4dc2d5f25 Add FLAG_IMMUTABLE to PendingIntents
If your app targets Android 12, you must specify the mutability of each PendingIntent
object that your app creates. This additional requirement improves your app's security.
https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability

Android Lint is being updated, and adds an error-level check for this.

Bug: 247885568
Test: Presubmits
Change-Id: I2bb91d98b443af2b5c16944ce197d863dbd33f9a
2022-09-23 15:17:52 -07:00
Cole Faust
676d6510d2 Merge "Fix array-related errorprone warnings" am: 159371eef5 am: 201f62aa05 am: db8f0c7c2d am: a81487ec4c
Original change: https://android-review.googlesource.com/c/platform/development/+/2184500

Change-Id: I8e8ed3f15fab4b4826b15417fb4cd62aa56c6827
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-23 00:26:34 +00:00
Cole Faust
159371eef5 Merge "Fix array-related errorprone warnings" 2022-08-22 22:51:09 +00:00
Cole Faust
1bb113c2fc Fix array-related errorprone warnings
The ArrayEquals, ArrayHashCode, ArrayToString, and
ArraysAsListPrimitiveArray errorprone findings were
demoted from errors to warnings. Fix existing
occurrences of them so they can be made errors again.

Bug: 242630963
Test: RUN_ERROR_PRONE=true m javac-check
Change-Id: Iaecb05992482dfea041e51e3978d0d51d4ca2ce8
2022-08-15 18:24:25 -07:00
Hongwei Wang
8d408e82c1 Add ability to enter PiP on back pressed in ApiDemos
Bug: 235268241
Test: Press back when in com.example.android.apis/.app.PictureInPicture
Change-Id: I8ceaaf3b1215505bd4919ef5f5da291df62c1049
2022-06-27 11:27:03 -07:00
Joanne Chung
037bcfce15 Merge "Add dialog present support for AutofillService." into tm-dev 2022-05-03 08:10:29 +00:00
TreeHugger Robot
4cb200dfb1 Merge "Update Autofill sample to use new API instead of deprecated APIs." into tm-dev 2022-05-03 08:05:00 +00:00
Joanne Chung
7a62cf901d Add dialog present support for AutofillService.
Bug: 229057036
Test: manual. Can show filldialog with Autofill sample
Change-Id: If3266fbbba12cbcf8b4641da53d6b809f56d83f7
2022-04-29 20:53:26 +08:00
Joanne Chung
b6261fb9a7 Update Autofill sample to use new API instead of deprecated APIs.
Bug: 229057036
Test: manual. Sample still works.
Change-Id: I4629fa0ce7b383a4d31ee378b20a950a2c5818e1
2022-04-29 19:30:01 +08:00
Hongwei Wang
b5b10c1e42 Integrate custom close action in ApiDemos for PiP
The demo Activity simply finishes itself when it receives the callback
from the close action PendingIntent.

Video: http://recall/-/aaaaaabFQoRHlzixHdtY/fR0hxeorlYrxXyzfZ02btK
Bug: 223896879
Test: see video
Change-Id: I94797b666fbcd630c828463668d9bc4e07274cd8
2022-04-19 15:25:54 -07:00
TreeHugger Robot
b3c5be0d80 Merge "Add a test AccessibilityService for A11Y IME API" into tm-dev 2022-03-29 00:37:29 +00:00
Yohei Yukawa
4ee7f80302 Add a test AccessibilityService for A11Y IME API
This CL introduces a sample AccessibilityService that demonstrates how
to use newly added APIs based on IME APIs [1].

 [1]: Ia651a811093a939d00c081be1961e24ed3ad0356
      fb17e5ae7a9e1a095d114d8dde76f14578b6c233

Fix: 223671031
Test: Manually done as follows.
 1. make -j SampleInputMethodAccessibilityService
 2. adb install -r $OUT/system/app/SampleInputMethodAccessibilityService/SampleInputMethodAccessibilityService.apk
 3. adb shell settings put secure enabled_accessibility_services com.example.android.sampleinputmethodaccessibilityservice/com.example.android.sampleinputmethodaccessibilityservice.SampleInputMethodAccessibilityService
Change-Id: Iea75f4378118fadc142c56aad7667784111033ba
2022-03-26 16:38:52 -07:00
Mateusz Cicheński
465b945910 Add API demo for keep clear areas.
Bug: 183746978
Test: manual, via extra logging added in DisplayController#onKeepClearAreasChanged
Change-Id: Id291320cdb0ea502c0ff359677f218504c1df597
2022-03-21 17:47:54 +00:00
Hongwei Wang
ec0d9449a1 Add demo for content PiP
Bug: 165793661
Video: http://recall/-/aaaaaabFQoRHlzixHdtY/e9Mp5rvxYBrNOdGSUoSXHO
Test: manual, see Video
Change-Id: I026844cf5eabf30fe553641b36daed6e31e4f893
2022-02-09 16:19:12 -08:00
Bob Badour
e0439a3892 Merge "Fix license texts." am: 632da0a501 am: b375f76135 am: 54cfa4d443 am: 298e88bee0
Original change: https://android-review.googlesource.com/c/platform/development/+/1955284

Change-Id: I1de3210c96da09546589794781f8f12cbe7ed128
2022-01-21 20:03:42 +00:00
Bob Badour
298e88bee0 Merge "Fix license texts." am: 632da0a501 am: b375f76135 am: 54cfa4d443
Original change: https://android-review.googlesource.com/c/platform/development/+/1955284

Change-Id: I1cb05b611a14d2ff227af99ca5b1cc1acd68d883
2022-01-21 19:44:54 +00:00
Bob Badour
082705bfb3 Fix license texts.
Push specific licenses down the tree toward the leaf directories.

Remove extra Apache 2.0 license texts--just use Android-Apache-2.0

Test: m nothing
Change-Id: Ibee25f75f5933699d6f43acdc192b2ada6823757
2022-01-20 19:04:52 +00:00
Ming-Shin Lu
f306c31e0b Using IME context to inflate layout from S_V2 am: e0caa3b4af am: d45b8f1d4f
Original change: https://googleplex-android-review.googlesource.com/c/platform/development/+/16600245

Change-Id: I944480434df78d6a51547b10bc475c6bd010f175
2022-01-11 17:35:24 +00:00
Ming-Shin Lu
d45b8f1d4f Using IME context to inflate layout from S_V2 am: e0caa3b4af
Original change: https://googleplex-android-review.googlesource.com/c/platform/development/+/16600245

Change-Id: I73a467cff499f9e2a239d375b50b0ce803479fd1
2022-01-11 17:23:18 +00:00
Ming-Shin Lu
e0caa3b4af Using IME context to inflate layout from S_V2
With CL[1],[2] to migrate InputMethodService as the subclass of the new
introduced class WindowProviderService in S_V2, IME context resources
can be managed by associating the window container of IME window when
its display/window configuration changed.

So in SoftKeyboard#getDisplayContext, we can get rid of
createDisplayContext logic from S_V2 with gated by SDK version and
refining the method documentation to make it clear.

[1]: Ie565e30ed5dd3f2cfe27355a6dded76dc3adc14b
[2]: I64a1614f32d097785915f6105b1813a929e0fe32

Bug: 213118079
Bug: 133825283
Test: manual with below steps
    1) adb install -r EditTextVariations.apk
    2) adb install -r SoftKeyboard.apk
    3) adb shell ime enable com.example.android.softkeyboard/.SoftKeyboard
    4) adb shell ime set com.example.android.softkeyboard/.SoftKeyboard5
    5) Enable screen auto-rotation
    6) Launch EditTextVariations from launcher's shortcut
    7) Tap the first EditText field to show IME
    8) Rotate the device to the landscape mode
    9) Expect the IME should not be shrunk

Change-Id: I9a512a90ca43f07236a041d9e82dbd875206f99e
2022-01-10 23:42:17 +08:00
Yohei Yukawa
bb7d04778d Support non-default back-disposition in ThemedNavBarKeyboard
With this CL, you can let ThemedNavBarKeyboard call

  InputMethodService#setBackDisposition(int)

with either the following values

  * BACK_DISPOSITION_DEFAULT
  * BACK_DISPOSITION_ADJUST_NOTHING

so that you can see how those two flags work.

Bug: 213337792
Test: Manually verified as follows
 1. Flash aosp_coral-userdebug into the device
 2. make -j ThemedNavBarKeyboard
 3. adb install -r $ANDROID_PRODUCT_OUT/system/app/ThemedNavBarKeyboard/ThemedNavBarKeyboard.apk
 4. adb shell ime enable com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard
 5. adb shell ime set com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard
 6. Tap any edit field
 7. Make sure that the back button is left-pointing triangle
 8. Tap "BACK_DISPOSITION_ADJUST_NOTHING" on the IME
 9. Make sure that the back button is down-pointing triangle
Change-Id: I71aa1dd23d72e8891cb3887efe5db1a48b6a017d
2022-01-05 15:34:50 -08:00
Hongwei Wang
b0e7eff1b5 Merge "Consolidate PiP demos in ApiDemos app" 2021-12-22 04:15:43 +00:00
Hongwei Wang
17aab38616 Consolidate PiP demos in ApiDemos app
Put various configurations for PiP into one Activity, access by navigate
to `App > Activity > Picture in Picture`. Current supports

- Enter PiP with on-screen button
- Enter PiP by swiping up to home or tap on home button
- Toggle the auto enter PiP flag on and off
- Toggle the source rect hint on and off
- Toggle the seamless resize flag on and off
- Change the position of current and next source rect hint
- Tablet layout on foldables

The upcoming content PiP will also be hosted here.

Added also support passing the intent extra, full command

```
adb shell am start \
    --ez auto_pip [true|false] \
    --ez source_rect_hint [true|false] \
    --ez seamless_resize [true|false] \
    --es current_position [start|end] \
    com.example.android.apis/.app.PictureInPicture
```

Bug: 175727044
Video: http://recall/-/aaaaaabFQoRHlzixHdtY/gdcklbUsT7SmbUhNcVSXfd
Test: manual, see Video
Change-Id: I60233f2d6e428d11d4ab1b566e36c38fd4c4f937
2021-12-21 13:48:31 -08:00
Yohei Yukawa
f2464f70f2 Set targetSdkVersion=31 to ThemedNavBarKeyboard
With this CL, ThemedNavBarKeyboard sameple IME will have an explicitly
set targetSdkVersion=31 so that it can be installed on older version
of Android OSes.

This CL also explicitly sets "android:exported", which has been
required in AndroidManifest.xml since API 31.

Fix: 211463997
Test: Manually verified as follows
 1. Flash SQ1A.211205.008 aosp_coral-userdebug into coral
 2. make -j ThemedNavBarKeyboard
 3. adb install -r $ANDROID_PRODUCT_OUT/system/app/ThemedNavBarKeyboard/ThemedNavBarKeyboard.apk
Change-Id: Idd88031a6b65cca58add8abe42794bc5f01b1973
2021-12-20 10:34:34 -08:00
Treehugger Robot
83b075db80 Merge "Update lint baseline for AutofillKeyboard" am: 62ce42ad0a am: 676489f321 am: 3cc9d5c708 am: 5dee47eff2
Original change: https://android-review.googlesource.com/c/platform/development/+/1827714

Change-Id: I558e2d7ad72cbf659583dede082ae8498406a2e1
2021-12-03 17:15:49 +00:00
Treehugger Robot
62ce42ad0a Merge "Update lint baseline for AutofillKeyboard" 2021-12-03 16:26:41 +00:00
Colin Cross
e915cf2a80 Update lint baseline for AutofillKeyboard
The new lint version finds more NewApi errors.

Test: m lint-check
Change-Id: I190bbf97000312dc4911552594374d36d8782d7b
2021-09-20 11:56:38 -07:00
Aurimas Liutikas
33be7cbcbe Add explicit exported tags
Bug: 195988762
Test: make javac-check
Change-Id: Ifd07672da0141c74ad32613a17691c6cd09e54de
Merged-In: Ifd07672da0141c74ad32613a17691c6cd09e54de
(cherry picked from commit 7512a62755)
2021-09-14 11:09:20 -07:00
Anton Hansson
cf4b9a604d Merge "Add sdk extension version info to prop templates" 2021-09-01 09:00:15 +00:00
Anton Hansson
48c492ed9f Add sdk extension version info to prop templates
This adds two new properties alongside AndroidVersion.ApiLevel:
- AndroidVersion.ExtensionLevel: The sdk extension version if the SDK
- AndroidVersion.IsBaseSdk: Whether the extension level is the the one
  that the ApiLevel shipped with (true), or if is an extension SDK
  release (false).

While we're here, dedupe the recipe that processes these templates.

Bug: 195281582
Test: m out/host/linux-x86/development/sdk/platform_source.properties
      and inspect the substitution is working
Change-Id: Ieea20731aed2e0f35bbe4cfd8ca596cf11f4b3bc
Merged-In: Ieea20731aed2e0f35bbe4cfd8ca596cf11f4b3bc
(cherry picked from commit cf2f42c36b7997e9ce87682bb3a5511bdb72936f)
2021-08-31 17:42:12 +00:00
Anton Hansson
29d3b22bf9 Merge "Add sdk extension version info to prop templates" into sc-dev-plus-aosp am: 538c18b677 am: 310344483f am: f9355bc2cc
Original change: https://googleplex-android-review.googlesource.com/c/platform/development/+/15684826

Change-Id: I78a43228828ae28c503856ce30ecfebee97fb768
2021-08-31 11:26:02 +00:00