Commit Graph

220 Commits

Author SHA1 Message Date
Lucas Dupin
c1615dffe1 Merge "Update system palette APIs" into sc-dev 2021-03-22 16:57:17 +00:00
Lucas Dupin
6110d25881 Update system palette APIs
UX landed on a format where we have 2 neutral palettes, and 3 accent
palettes. It's the ideal format to play with elevation and hue rotation,
in order to have a more vibrant and less muddy UI.

Fixes: 181986389
Bug: 173553055
Test: atest SystemPalette
Test: atest ThemeOverlayControllerTest
Test: atest ThemeOverlayApplierTest
Test: atest DeviceDefaultThemeTest
Change-Id: I80d3f7d1cc92e97efcb40fe6dc9f09918321d273
2021-03-20 14:50:26 -07:00
Pierre Barbier de Reuille
96059b47a9 Correct recycling to take setViewId into account.
Views shouldn't be recycled if the view id is changed as the identity
of the view is then altered.

Second pass: this has been further tested by adding/removing AppWidgets
on a test phone.

Bug: 181985606
Test: atest CtsWidgetTestCases:RemoteViewsTest
Test: atest CtsWidgetTestCases:RemoteViewsRecyclingTest
Test: atest CtsInputMethodTestCases:android.view.inputmethod.cts.InputConnectionBlockingMethodTest
Change-Id: I8924c02f7f0223458f556a07a3dfdc96b4ce612e
2021-03-19 16:29:37 +00:00
Greg Kaiser
b96f77af78 Revert "Correct recycling to take setViewId into account."
This reverts commit 308a272289.

Bug: 183104573
Test: Install from Play Store with the screen off on wembley, and the device doesn't crash when the screen turns back on.

Change-Id: I289fcafc6685c4ede295e8d6916a54da9bac1ad5
2021-03-18 15:28:46 -07:00
Pierre Barbier de Reuille
308a272289 Correct recycling to take setViewId into account.
Views shouldn't be recycled if the view id is changed as the identity
of the view is then altered.

Bug: 181985606
Test: atest CtsWidgetTestCases:RemoteViewsTest
Test: atest CtsWidgetTestCases:RemoteViewsRecyclingTest
Change-Id: I68415087297312eb2c1985d272be2ac535507c2a
2021-03-17 11:20:36 +00:00
Yogisha Dixit
1dfe5cf462 Merge "Fix flag value for configuration_optional widget feature." into sc-dev 2021-03-12 17:51:10 +00:00
Pierre Barbier de Reuille
4554bcd1bc Correct invalidation of layout when new color resources are provided.
The mViewMode variable is only used if there is no RemoteViews object.
But we still want to update the colors in that case.

Bug: 179783721
Test: atest CtsWidgetTestCases:android.widget.cts.RemoteViewsThemeColorsTest
Change-Id: I078d21422a6300e7aaecb0baa2a49b9e14cae9e9
2021-03-09 22:13:23 +00:00
Pierre Barbier de Reuille
3e443e6b24 Correct API for new sizes in App Widgets.
This follow recommendations from the API council review.

Based on those recommendations: I updated the API and updated the
comments to make the function behavior clearer.

Bug: 181611658
Test: atest android.widget.cts.RemoteViewsSizeMapTest
Test: Local widget to check rendering
Change-Id: Ie9fcedbc7b18b83f6d1220f99240f264e53e3649
2021-03-04 23:27:08 +00:00
Yogisha Dixit
cb4c7c1286 Fix flag value for configuration_optional widget feature.
The flag value should be 4 and not 3 so that we can use bitwise
operations to determine the existence of a flag.

For example, we want to use the following to determine if a widget is
reconfigurable:
(providerInfo.widgetFeatures & WIDGET_FEATURE_RECONFIGURABLE) != 0
But if the value of WIDGET_FEATURE_CONFIGURATION_OPTIONAL is 3, the
above check would fail.

Test: atest FrameworksServicesTests:AppWidgetServiceImplTest, atest
CtsAppWidgetTestCases
Bug: 177977976

Change-Id: I15d4baae5e17acb9a0b936485a53f9b3359d65ca
2021-03-03 20:53:45 +00:00
Pierre Barbier de Reuille
4e14c35736 Merge "Framework implementation of go/widgets-dynamic-colors" into sc-dev 2021-02-24 20:16:40 +00:00
Alina Zaidi
bfefff4115 Merge "Adjust AppWidgetProviderInfo#getDescription to return CharSequence." into sc-dev 2021-02-24 20:01:39 +00:00
Pierre Barbier de Reuille
4219de7ded Framework implementation of go/widgets-dynamic-colors
Bug: 179783721
Test: atest CtsWidgetTestCases:android.widget.cts.RemoteViewsThemeColorsTest
Change-Id: I622e79ed8738dc862790191bf9fcf44b0af35c8e
2021-02-24 15:13:29 +00:00
Kholoud Mohamed
c3406718ef Merge "Expose setBindAppWidgetPermission as a testAPI" into sc-dev 2021-02-24 10:24:25 +00:00
Alina Zaidi
1c9092d127 Adjust AppWidgetProviderInfo#getDescription to return CharSequence.
Also add more developer docs.

Test: atest AppWidgetServiceImplTest#testLoadDescription passed
Bug: b/180015383
Change-Id: Ie6fff9d880ba4721bf6babcd51acaa8fc9bd3cd9
2021-02-19 15:14:41 +00:00
Stevie Kideckel
90362ddd27 Merge "Add checked change APIs to RemoteViews" into sc-dev 2021-02-19 09:48:25 +00:00
Stevie Kideckel
289da0b787 Add checked change APIs to RemoteViews
Bug: 179245670
Test: built sample app to use APIs with and without collections, atest
Change-Id: I5474bfb7dc15d559867063d1d8516b8ca2ef9755
2021-02-17 12:01:28 +00:00
TreeHugger Robot
b9806031ae Add new attributes for widget sizing controls.
Design doc: go/widget-sizing-api-dd

New attributes added:
* maxResizeWidth
* maxResizeHeight
* targetCellWidth
* targetCellHeight

Bug: 179807199
Test: atest FrameworksServicesTests:AppWidgetServiceImplTest
Change-Id: Icadc73da9bd010e42459735493f452cb892e5744
2021-02-17 10:55:01 +00:00
Pierre Barbier de Reuille
d7541b8990 Framework changes for go/widget-size-specification
Update the framework to:

1 - Allow creating RemoteViews with a mapping from size to layouts
2 - Use the closes sized layout in any given situation
3 - Allow the launher to specify the current size when inflating a
    remote views

Bug: 179025145
Test: atest android.widget.cts.RemoteViewsSizeMapTest
Change-Id: Icf98d01bd0cf8b48c47555a1af6acb498b46b1a4
2021-02-16 21:24:11 +00:00
kholoud mohamed
2836f984d0 Expose setBindAppWidgetPermission as a testAPI
This is needed to replace usage of the adb shell
command 'appwidget grantbind' in some cts tests with
TestAPIs.

Bug: 180328483
Test: N/A
Change-Id: Ie74149c2045e19261c77da2ffa757a803cc61d95
2021-02-15 17:33:55 +00:00
Steven Ng
cd5c9b0642 Add a layout attribute in widget metadata for widget preview
Test: atest FrameworksServicesTests:AppWidgetServiceImplTest. Newly
added test passed.

Bug: 179063291
Change-Id: I17cf97b580ac03d9688d82eeccd3a68e77287655
2021-02-08 14:09:06 +00:00
Sunny Goyal
7152080c07 Adding APIs to get manifest entries for Launcher activities and widgets
and getting resources for a particular config

This would allow fetching display infos for the activity in a particular
config independent of system config.

Bug: 156154533
Test: Included CTS
Change-Id: Ie245d685fb21444c10a88b4ca86dc7ff08e2b599
Merged-In: Ie245d685fb21444c10a88b4ca86dc7ff08e2b599
2021-02-01 17:35:23 +00:00
Alina Zaidi
016e50a980 Include an attribute for description of the widget in the attributes file for AppWidgetProviderInfo.
Test: Instrumentation test added- AppWidgetServiceImplTest_testLoadDescription

Bug: 178460757

Change-Id: Ic9b9cd8c592936bbe421183f8715ba5d8f770742
2021-01-26 17:04:00 +00:00
Steven Ng
d8d8acfd9f Merge "Add a new widget feature value, configuration_optional" 2021-01-26 11:05:07 +00:00
Jeff Sharkey
1ae7f40466 Merge "Update AppWidget owners" am: 8c9bf65b8b am: ea29396752 am: 0cfbc863f7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556378

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I051e300cf34545ce632f64ef1dc7711f97c84599
2021-01-21 23:25:37 +00:00
Sunny Goyal
ce8c2017c1 Update AppWidget owners
Change-Id: I89d2fa5339a37c64e76698ed1aa3825d27f88097
Test: manual
2021-01-21 21:56:08 +00:00
Steven Ng
a401dc515c Add a new widget feature value, configuration_optional
If configuration_optional is present, the widget provides a default
configuration. The host may decide not to launch the provided
configuration activity.

Design doc: go/deferrable-widget-config

Test: Successfully built blueline-userdebug. Since this CL only adds
a new value for an existing field, no unit test will be added at this
point. Once we introduce unit tests for widget configurations xml, we
will add related unit tests.

Bug: 177977976
Change-Id: I507cba0b9b8900f9b9616d76c48eb0ed9c50ed72
2021-01-20 21:10:44 +00:00
Jeff Sharkey
a2c132d9c6 Hand-migration to TypedXml interface.
Previous changes have applied mechanical refactorings, but this change
hand-migrates the remaining logic which was too complex to identify.

This change should have no behavior change; famous last words.

Bug: 171832118
Test: manual
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: I85cd830eb6bfde18fca6e73ee7adfdc385a890de
2020-12-02 13:55:35 -07:00
Mathew Inwood
5d123b6775 Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
2020-11-04 09:45:53 +00:00
Mathew Inwood
8e742f928e Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

This is a resubmit of ag/12929664 with some APIs excluded that caused
test failures; see bugs 171886397, 171888296, 171864568.

APIs excluded:
Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord;
Landroid/os/Process;->myPpid()I
Landroid/os/SharedMemory;->getFd()I
Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I

Bug: 170729553
Test: Treehugger
Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
2020-10-29 11:51:12 +00:00
Hongwei Wang
050275cd83 Revert "Add maxTargetSdk restriction to unused APIs."
This reverts commit 72f07d6a8a.

Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397

Bug: 171886397
Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
2020-10-28 20:16:22 +00:00
Mathew Inwood
72f07d6a8a Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
2020-10-27 15:46:07 +00:00
Pinyao Ting
5cb48cbc0d fix RuntimeException when inflating default layout for AdapterView-based widgets
Bug: 151901506
Test: manual
Change-Id: I71068b7d13783f658c02cc76ec50f40319e68160
2020-05-18 17:06:56 -07:00
Hui Yu
4803268229 Move noteAppWidgetTapped call into AppWidgetHostView.
RemoteViews is public API used out of scope of widget. The correct place
to call noteAppWidgetTapped is in AppWidgetHostView.

Fix: 153676411
Test: manual test, tap a widget, "adb shell dumpsys usagestats | grep
USER_INTERACTION" to oberserve USER_INTERACTION event sent to UsageStas, "adb shell dumpsys appops | grep appWidgetVisible" to observer appWidgetVisible flag.

Change-Id: Ic473211b91fd952dbb81b09b1e1568d6f69a0dd8
2020-04-15 22:06:12 -07:00
Hui Yu
3dc45fbc57 Update AppOps & UsageStats when app widget tapped.
When the app widget on the launcher is tapped on:
1. Update AppOps. AppOps treats the underlying app as foreground so the app can get while-in-use
permission.
2. Report a USER_INTERACTION event to UsageStats so UsageStats can
update mLastTimeUsed and mLastTimeVisible of this package.

Bug: 149043079
Test: manual test, tapped on a widget.
Change-Id: Ic8c91190881cf5dcf89f0f72cfd410b0c2e86bf6
2020-03-21 08:36:54 -07:00
Samuel Fufa
ab848f9fb8 AppWidgetManager option documentation
Bug: 151157829
Test: n/a
Change-Id: Ia6b86eaf2cbc6543854b88ee112c687590d50c1f
2020-03-10 22:47:19 +00:00
Samuel Fufa
1acbf7763b Fix widget restore flow
After restore, the app should set OPTION_APPWIDGET_RESTORE_COMPLETED to
true on its widgets followed by calling updateAppWidget to update views.

Bug:63667276
Test: Manual
Change-Id: Idb6fc63b0f894fca9e0470aaf335240fc124e2e9
2020-02-24 19:07:59 +00:00
Artur Satayev
c895b1b450 Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I8789f8499d4dca08580672e9e45ed9a7026dd686
2019-12-18 16:37:37 +00:00
Samuel Fufa
59ef5e98f3 Setup OnAppWidgetRemoved on framework
Test: Manual
Bug:140140567
Change-Id: I3033b83ff8f55938b5cd898c7e30bb2259af9c5f
2019-09-10 17:34:23 -07:00
Jeff Sharkey
9e8f83db6d All Parcelable CREATOR fields are @NonNull.
If they were null, then the Parcelable would fail to work.

Bug: 126726802
Test: manual
Change-Id: I7929ffa2f20e5de1c8e68e8263cca99496e9d014
Exempt-From-Owner-Approval: Trivial API annotations
2019-02-28 23:29:04 -07:00
Sunny Goyal
40da899d4c Removing SDK check when getting default widget padding
This avoids packageManager call everytime a widget updates and
on swipe up

Test: Everything compiles
Change-Id: I58e8613b7a8c9d27fb9293e623ccb274edab82d3
2019-02-22 00:07:28 +00:00
Sunny Goyal
ae65598b66 Updating the comments as per API feedback
Bug: 122549181
Test: N/A
Change-Id: I46d6f98c7cd644cad79b1aad973621222657b113
2019-01-08 16:45:12 -08:00
Sunny Goyal
c12d31c3b5 Adding API to specify a dark text specific layout in app-widgets
Bug: 109954539
Test: atest CtsAppWidgetTestCases
Change-Id: I785931469888a09685c45949afcf2e3633233c60
2018-12-04 02:33:53 -08:00
Sunny Goyal
983e4065fb Starting the default activity when an app widget's
default/fallback view is clicked

Bug: 119142325
Test: Verfied on device
Change-Id: I5ac39b77cdd0a46f8c66dcec289cec78746e67cf
2018-11-09 13:24:39 -08:00
Sunny Goyal
43c970436d Adding shared element transitions support in AppWidgets
Bug: 113071278
Test: atest frameworks/base/core/tests/coretests/src/android/widget/RemoteViewsTest.java
Change-Id: I0d7698faa8d9e61913b55d34de8b7cfbb32863b1
2018-10-29 17:04:33 -07:00
Andreas Gampe
cf42e434d9 Merge "Framework: Remove a nonsensical substring(0)" am: 98627fa455
am: 67dffedd92

Change-Id: Ibdac1bdc69d8f02823343b0d39b690de51da6802
2018-09-11 10:34:11 -07:00
Andreas Gampe
214c76cd70 Framework: Remove a nonsensical substring(0)
String.substring(0) will return the same String instance. There is
also no reason to make a copy.

Found by errorprone.

Bug: 114129741
Test: m
Change-Id: Ic089f04efc3c73f70aa15a132d62ac665c8b8f4c
2018-09-05 16:58:45 -07:00
Christopher Tate
af1d1b5504 Merge "Send widget registration broadcasts before BOOT_COMPLETE" into pi-dev
am: d412914643

Change-Id: I0d5d57c75cbfce35208607a6a8d1d51607a9b40a
2018-08-20 16:55:41 -07:00
Christopher Tate
2ec961dad3 Send widget registration broadcasts before BOOT_COMPLETE
Widget presence in the home app is important for usability, but it
depends on a broadcast-based handshake at boot time.  This handshake
occurring after the BOOT_COMPLETED broadcast was initiated means
that in practice widgets may not become available for literal
minutes following unlock, as it can take this long for the
boot-complete broadcast to clear and let the systen proceed with
dispatch of the widget handshakes.

We address this by hoisting the widget setup broadcast to occur
just *before* the boot-completed broadcast, rather than as part
of general listener reaction to the global "this user has been
unlocked" notification.

Bug: 76154638
Test: manual (note broadcast ordering following boot)
Change-Id: I7c1a9f7a84fee71f71d2dcd52362a29c2436b01d
Merged-In: Ibd97268f995ec673f21d8f5df257041cf61a058d
2018-08-14 17:03:41 -07:00
Mathew Inwood
b5962ae431 Add @UnsupportedAppUsage annotations
For packages:
  android.appwidget

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I738f99248aaabe0ef29533e339ae7c5721384d52
Merged-In: Idbddc50320e7df92e0f260c1e309e5390b502d28
2018-08-09 15:15:57 +01:00
Rajeev Kumar
c1778c6dad Add a condition in AppWidgetHost to honor config_enableAppWidgetService.
Bug: 74039047
Test: make cts-verifier -j32
Change-Id: Iaca4e043443efeb695ebfd57c605e5cc1516a49a
(cherry picked from commit 3c9e79ea78)
2018-04-05 22:24:14 +00:00