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
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
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
Certain APIs require that a device have a specific feature to operate
correctly, so start annotating them.
Test: builds, boots
Bug: 72284763
Change-Id: Ie2f30284bdfdb6acc4067f434eba3b5433837606
Exempt-From-Owner-Approval: simple annotations
The majority of Manager-style classes already use Context.getUserId()
when making calls into the OS, so clean up the remaining callers to
unify behind this strategy.
This gives @SystemApi developers a nice clean interface to interact
across user boundaries, instead of manually adding "AsUser" or
"ForUser" method variants, which would quickly become unsustainable.
Test: builds, boots
Bug: 72863821
Exempt-From-Owner-Approval: trivial changes
Change-Id: Ib772ec4438e57a2ad4950821b9432f9842998451
This would allow apps to customize the behaviour/appearance of a widget based
on the app state
Test: atest CtsAppWidgetTestCases:UpdateProviderInfoTest
Bug: 63931362
Change-Id: I1eef705975c2310af7311b74acc23c089fb6d1ec
> Using the AppWidgetProviderInfo for applicationInfo instead of getting
it from packageNamager
> Sending ProviderInfo update when the package is suspended/unsuspended so
that the provider info on client side is always up-to-date
Bug: 67865199
Test: Manually tested on device
Change-Id: Id44facc30b4c3cc01e155eba9feeb541997fc816
The host passes an IServiceConnection to the AppWidgetManager which
is used to bind to the RemoteViewsService. This allows the host to
recieve the connection callbacks directly instead of proxying it via
the AppWidgetManager. The host is also responsible for unbinding to
the service.
Bug: 26481160
Test: adb shell \
am instrument -w -e class android.widget.RemoteViewsAdapterTest \
com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Iac400095a319c3a43714c82fda7516be1ccc68af
Even though an app is supposed to declare android.software.app_widgets
when relying on the widgets API, some apps still use this API without
declaring the feature. Previously AppWidgetHost relied on having an
AppWidgetService available, without checking for feature development
before dereferencing the service.
This stubs out the AppWidgetHost interface when the app_widgets feature
is not available.
Bug: 28847209
Test: run nova launcher, observe no crash
Change-Id: Idaf46de990fffa6c6a03562f8e097c0a6a320c8a
(cherry picked from commit 0536802defc7df6edb22e076b1147d0d919da0f8)
Most @SystemApi methods should be protected with system (or higher)
permissions, so annotate common methods with @RequiresPermission to
make automatic verification easier.
Verification is really only relevant when calling into system
services (where permissions checking can happen on the other side of
a Binder call), so annotate managers with the new @SystemService
annotation, which is now automatically documented.
This is purely a docs change; no logic changes are being made.
Test: make -j32 update-api && make -j32 offline-sdk-docs
Bug: 62263906
Change-Id: I2554227202d84465676aa4ab0dd336b5c45fc651
An invalid, 'null' resource ID is defined as 0. Apps often use -1.
Add a helper method that makes checking valid IDs easy and more
centralized.
Eventually make it public API.
Bug: 38393777
Test: manual
Change-Id: I969ec4a45e86bdab3d7f57d357d475b77c7f8a78
Package IDs greater than 0x7f are interpreted as negative
numbers in Java's signed integer. The proper check for existence of
a resource ID is that it is not 0.
Bug: 37498913
Test: none
Change-Id: I446fb6abb514bf7cf2d0dcbfbd81dd5718cd2cb4
- throw NullPointerException if the package name is null; there’s
already a method with the specified null behavior.
- Return value of this method should be @NonNull - return an empty
list. Document this.
Test: Unit test on AppWidgetServiceImplTest
$ runtest --path=services/tests/servicestests/src/com/android/server/appwidget/AppWidgetServiceImplTest.java
Bug: 37544056
Change-Id: I047a8e7c4e519ef7c5deddaca0d1ad931dc91343
This allows more fine-grained control than getting all installed
providers for a user, when you might only want to check for a particular
package. For instance, Launcher can use this API to surface widgets per
app without having to ask for all the widgets.
Test: Unit test on AppWidgetServiceImplTest
$ runtest --path=services/tests/servicestests/src/com/android/server/appwidget/AppWidgetServiceImplTest.java
Bug: 34940468
Change-Id: I182bf1c012d31182024422fc4a63f57f151c3ee5
This will be used to help document the expected behavior of various
broadcast actions defined by the OS.
Also add logic to PackageParser that will then yell at developers
whose manifests are making bad assumptions about which broadcasts
they'll receive.
Test: builds, boots
Bug: 35925551
Change-Id: I059c2bf8aa3ce53d9ff18dcc263db7620cd14bd6
Also defining an extra constant for widget preview which can be used by
developers to provide a snapshot of the widget with the pin request
Bug: 35811129
Test: All exisiting tests passing
for f in 1 2 3 4 5 6 7 8 9 10; do \
adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest$f \
-w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner; \
done;
adb shell am instrument -e class com.android.server.appwidget.AppWidgetServiceImplTest \
-w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Id854bd28468a5bf0416ff1a1b19c44d850016f32
Launchers can choose to implement support pin shortcut or pin appwidget
or both by specifying different actions in the intent filter
Test: Automated tests and CTS
Bug: 34174006
Change-Id: I4456dbb943cfba11d465556f0732f0ed629ab3ba
Test: Manual and unit tests
adb shell am instrument -e class android.widget.AppWidgetHostViewTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Bug: 22839968
Change-Id: Id9cb56619653f43b9f755c881f5d0936375f9c87
Test: Manual test and all the unit tests:
adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
... to test9
adb shell am instrument -e class com.android.server.appwidget.AppWidgetServiceImplTest -w com.android.frameworks.servicestests
Bug 32404406
Change-Id: Icd6d4cbd25d9cdf4508da725d95d6401cc3a46a7
> When loadingView is no available, the FirstView is always
loaded on the background thread
> AppWidgetHostView only inflates on the background thread, if
the view has any costly operations
Test: TBD
Change-Id: I701caee7e4e6ba5972d0cf478cb57f8ec950da54
Update the content description to mention the
widget is suspended.
Mark the remote views as not significant for
accessibility.
Bug: 28909714
Change-Id: I8804d41e520e2b4af7ade0fa8820ee7b2488bde5
When the widget starts lisnening again, it receives all the pending updates
until that point (restricted to the requested widgetIds). When startListening
is called for the first time, the widgetIds is empty and it does not get
any updated. Further calls to startlisting will give the missed updates
for the bound widgets
Bug: 23892701
Change-Id: I3aa06d3e33a0861c19cfd5ced567d5bb3b93d906
This undoes the automerger skip which occured in
commit e740c84dc3 and
replays it as a standard (NOT -s ours) merge.
Change-Id: If5a47be26f73d6a0735c425cd66310a3e2a89086
Also associating a lastUpdateTime with every widget. This allows
the host to query the widgets which were updated only after
the last stopListening call.
Change-Id: If9375cf2d8caa0ccca14b6649821d87ada1f3a84
Similar to first patch, but now using new "rethrowFromSystemServer()"
method which internally translates DeadObjectException into
DeadSystemException. New logic over in Log.printlns() now
suppresses the DeadSystemException stack traces, since they're
misleading and just added pressure to the precious log buffer space.
Add some extra RuntimeInit checks to suppress logging-about-logging
when the system server is dead.
Bug: 27364859
Change-Id: I05316b3e8e42416b30a56a76c09cd3113a018123