History log of /frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
b98bcce37cfeab47bdf3394c6e0a193eb53f5b48 12-May-2017 Christopher Tate <ctate@google.com> Fix #38218977 : NPE restoring widget mappings

Remember that we might not be able to resolve historical
widget provider references, so don't access them unchecked.

Test: manual
Change-Id: I01c6c68461b6d15aa8fee402a4bfb0f21bf1ddbb
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
1406fb72ec05653ec7968a43603759c09702804b 05-May-2017 Fyodor Kupolov <fkupolov@google.com> Prevent crashes when user is stopping

Added defensive checks to prevent sporadic crashes due to various race
conditions when user is stopped:
* onPackageBroadcastReceived - moved the check inside the synchronized block.
This guarantees that onUserStopped (that also grabs mLock) is not yet
called and we can proceed.
* stopListening - Since it is invoked before onUserStopped callback, we can call
ensureGroupStateLoadedLocked(userId, false). The state will be subsequently cleaned
up in the onUserStopped.

Test: manual user switching + SecondaryUserContentResolverTest and
ManagedUserContentResolverTest
Fixes: 37472670
Fixes: 36890589

Change-Id: I44d0a0c004e9c3e6cfb37a24cb8a5b6f20a42f13
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
8fdf0513461367185ea70386f16bf420dd662212 05-Apr-2017 Tony Wickham <twickham@google.com> Merge "Add AppWidgetManager#getInstalledProvidersForPackage()" into oc-dev
a41da04b2d3eb6d746bb357925ec5d4d2a72998c 30-Mar-2017 Tony Wickham <twickham@google.com> Add AppWidgetManager#getInstalledProvidersForPackage()

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
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
fe9a53bc45fd0124a876dc0a49680aaf86641d3e 31-Mar-2017 Jeff Sharkey <jsharkey@android.com> Consistent dump() permission checking.

This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access. It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.

Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
4ad6b57700bef4c484021f49e018117046562e6b 28-Feb-2017 Sunny Goyal <sunnygoyal@google.com> Adding support for passing arbitrary extras when requesting to pin a widget.
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
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
22e32236ec0b666ed933cbd1f23f36814df0c57d 24-Feb-2017 Jeff Sharkey <jsharkey@android.com> AppWidgetManager shouldn't use StorageManager.

It's probably looking to detect both STATE_RUNNING_UNLOCKING and
STATE_RUNNING_UNLOCKED, so it should use isUserUnlockingOrUnlocked()
instead of trying to peek at the low-level CE key status.

Test: builds, boots
Bug: 29534661
Change-Id: I6aca1721f88ced65abf3bb7cbab550c4dbe27fb7
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
86882f4587031e48ef1bb60f5f3d8a9a5281c7ee 26-Jan-2017 Mario Bertschler <bmario@google.com> App Widget Service with dump in protobuf format

Test: This protobuf format is validated as a CTS test
Bug: 33088921
Change-Id: I9d2a983052ade06cd3a13857b7e7f9e3d9bc275e
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
7f7372ae2abeecb564d426ec3efbfa039c797885 24-Jan-2017 Sunny Goyal <sunnygoyal@google.com> Adding AppWidgetManager.isRequestPinAppWidgetSupported

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
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
9010bc5b2793b7dc7a4829727e7e98bc36286f15 18-Jan-2017 Sunny Goyal <sunnygoyal@google.com> Using an increasing request counter instead of system uptime to avoid duplicates when sorting pending updates. am: 88959dccac
am: 7abfb108c9

Change-Id: I807c91625cf4a63c644392bbff6a8e9f84368aee
88959dccac788d329b813b050f44281b273763ca 10-Jan-2017 Sunny Goyal <sunnygoyal@google.com> Using an increasing request counter instead of system uptime to avoid duplicates
when sorting pending updates.

Test: Manually tested on device
Bug: 33655829
Change-Id: Ifd11cbc29bfaf30ad2d552af1d38d0d4413b70ab
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
87a563e0707bb7e2be034c195e9827dfe3451cfd 02-Jan-2017 Sunny Goyal <sunnygoyal@google.com> AppWidgetManager: direct add widget support.

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
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
4f05d8d76beef330339dea55170eddb86c58b03c 10-Nov-2016 Sunny Goyal <sunnygoyal@google.com> Preventing widgets from exceeding Bitmap memory limit

> Moving the size check to a comman place so that it is executed in
all related code
> Fixing size calculation when views are merged as a result of partial
update

Test: Manually tested with a dummy app
Bug: 31790171
Change-Id: Id0ea776796f156455d2cba31c8392d4875116949
(cherry picked from commit 349b412b4ba93e6ab835e3f0c45a998979339b4f)
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
349b412b4ba93e6ab835e3f0c45a998979339b4f 10-Nov-2016 Sunny Goyal <sunnygoyal@google.com> Preventing widgets from exceeding Bitmap memory limit

> Moving the size check to a comman place so that it is executed in
all related code
> Fixing size calculation when views are merged as a result of partial
update

Test: Manually tested with a dummy app
Bug: 31790171
Change-Id: Id0ea776796f156455d2cba31c8392d4875116949
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
f59c50c4ab8f6b5b10f7867149e299e3a4b28354 30-Aug-2016 Winson <winsonc@google.com> Fixing typo in dump log. am: b43ba86811 am: 1de1a3bfcc
am: fc4a87580f

Change-Id: Id813187a627f795627a491cfe736f6e70d3e318a
73ea0ae15fafd66ab8a8e2679723715c189bbba3 11-Aug-2016 Jeff Sharkey <jsharkey@android.com> Fix bugs around manager fetching.

A recent patch started returning "null" when a Binder service
required to provide a manager wasn't yet registered.

This fixes four locations where that new logging was triggered: in
two cases by adjusting the fetching ordering, and in two other cases
by only fetching when the device supports the manager.

Bug: 28634953
Change-Id: I84dbccffa4ac760c10a2bbcb234f21272bfecb91
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
b43ba86811355c21a554e508d2562b161e8f119f 25-Jul-2016 Winson <winsonc@google.com> Fixing typo in dump log.

Change-Id: I94c381acb9a1748770231e714b93875097850e0d
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
36c0136177d03e078de24c1eae04956c7ea2e54b 12-Jul-2016 Rubin Xu <rubinxu@google.com> Merge \\"Guard against null object in scheduleNotifyUpdateAppWidgetLocked\\" into nyc-mr1-dev am: 26504a611a
am: 9d1e68ab1b

Change-Id: Ib09e0a5ba83959ef9ea418066c7ad16b1ab2238c
1bd6452e0fbbd87814283c4985e0a468cfa7a62c 12-Jul-2016 Rubin Xu <rubinxu@google.com> Guard against null object in scheduleNotifyUpdateAppWidgetLocked

Bug: 30085290
Change-Id: I4f12e1def98dff7e50b4d25a7d23e81bdbe0b7bd
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
7a1f2cbb4f55e83db498a8a51e7b463cf06896eb 07-Jul-2016 Jeff Sharkey <jsharkey@google.com> Merge \\"Snapshot RemoteViews before releasing lock.\\" into nyc-mr1-dev am: ffc0d5153c
am: 18d0841650

Change-Id: Iad6d527d6e0a81c127b7836e231044aeb40f065c
8a918b13a814ae8985e283aa42e68f32b677d8b1 07-Jul-2016 Jeff Sharkey <jsharkey@android.com> Snapshot RemoteViews before releasing lock.

The MSG_NOTIFY_UPDATE_APP_WIDGET message is sent asynchronously,
meaning it tries sending RemoteViews without the lock held, possibly
while another Binder thread is trying to mutate it.

Fix this by creating a copy for the thread to safely dispatch.

Bug: 29889779
Change-Id: I341fbbf89abee97a66cd67f1dd2a728282b68bfa
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
709a63d9c0a71bdf2af66904ed6e7440915b45d2 09-Jun-2016 Nicolas Prevot <nprevot@google.com> Show policy transparency screen if adding an account is not allowed.

If DISALLOW_MODIFY_ACCOUNTS has been set by a profile/device owner,
or account management is disabled:
When an app tries to add an account, show the policy transparency screen.

BUG:26762383
Change-Id: I721220c37c74493020f5a1be1f15731e9863a1de
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
95d0d631ba2773e79d5349f3a27fc3ec3fb663e6 17-Jun-2016 Tony Mak <tonymak@google.com> Merge \"Allow stopping user to access AppWidgetService API\" into nyc-dev
am: ab8d4cf645

Change-Id: I2280fae9d85594ad0fde5d552ff07b0d4e0c6158
c460856d7b13e99dd33cc06bbf2fec1da09f7a8b 17-Jun-2016 Tony Mak <tonymak@google.com> Merge \\"Allow stopping user to access AppWidgetService API\\" into nyc-dev am: ab8d4cf645
am: 44864e5c12

Change-Id: I718e396108f3e5518d8e121edb7c47d2af6e6b29
63966b3e120fe8a0fff729a9508341d53f9daafc 16-Jun-2016 Tony Mak <tonymak@google.com> Allow stopping user to access AppWidgetService API

We now have isUserRunning && isUserKeyUnlockedisUserUnlocked instead of
having isUserUnlockingOrUnlocked. The difference is
we now allow stopping unlocked user to access the API.

Testing:
Write a simple widget which keep calling AppWidgetManager API in a loop.

1. In non-FBE mode, place the widget to launcher.
Turn off work mode. No crash is observed.
2. Repeat 1 in FBE mode with separated work challenge.
3. Repeat 1 in FBE mode with no separated work challenge
4. Repeat 2 and reboot the device. Unlock work profile, widget is shown
5. Repeat 3, reboot device, widget is shown after rebot


Change-Id: I2fa9f602dcb0befff41fc6b145e9855e82d8d7a8
Fix: 29264823
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
6f84a27a7597a3bc34316baf2af2bda30a2d75de 25-May-2016 Sunny Goyal <sunnygoyal@google.com> Merge "Maintaining diff for all widget operations instead of just the Views update" into nyc-mr1-dev
57c9e16d041c9047a1618aab9c52be5608fae1cf 21-May-2016 Winson <winsonc@google.com> Process user events from service lifecycle callbacks.

- Instead of waiting for the broadcast to start loading the user’s
widgets, handle them in the service callbacks to ensure the app widget
update broadcasts are enqueued earlier.

Bug: 27262341
Change-Id: I095abe5e15fe46412d00438986f7a9aee50872ca
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
6d1b41d477ec9426f84ea2dad27cdbb714761da2 12-May-2016 Sunny Goyal <sunnygoyal@google.com> Maintaining diff for all widget operations instead of just the Views update

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
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
e09a623bc0356a8e01bce9c64ed955ca32d36d28 05-May-2016 Fyodor Kupolov <fkupolov@google.com> Return from onUserUnlocked if user is no longer unlocked

User can be removed or stopped by the time broadcast is delivered.

Bug: 28582351
Change-Id: I26f1a37a1ed61694679afff458c91438ee4e78cb
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
4d01f61e7bb0d1f3a9ba598c6bc35df0b6a1a43f 30-Apr-2016 Fyodor Kupolov <fkupolov@google.com> Do not enforce unlocked state when there is no caller

Do not enforce unlocked state when running on the background thread. User can
be in the stopping state or removed by the time the message is being processed.

Bug: 28471878
Change-Id: I1862849661d93b424a07ea94e80563bea7a94ce5
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
ce18c8167766f92856f94a8e88e19de4698960e6 28-Apr-2016 Jeff Sharkey <jsharkey@android.com> Introduce "unlocking" vs "unlocked" nuance.

There is a narrow window of time during user unlock where we're
reconciling user storage and dispatching the "unlock" status to
various internal system services. While in this "unlocking" state,
apps need to be told that the user still isn't actually "unlocked"
so they don't try making calls to AccountManager, etc.

The majority of internal services are interested in merging together
both the "unlocking" and "unlocked" state, so update them.

Clarify naming in AccountManagerService to make it clear that a local
list is being used, which mirrors the naming in MountService.

To match UX/PM requested behavior, move PRE_BOOT_COMPLETED dispatch
after the user is unlocked, but block BOOT_COMPLETED dispatch until
after all PRE_BOOT receivers are finished to avoid ANRs.

Bug: 28040947, 28164677
Change-Id: I57af2351633d9159f4483f19657ce0b62118d1ce
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
b2cc8e25c08affd67cddc5133d7fac70296ac008 13-Apr-2016 Rubin Xu <rubinxu@google.com> Fix widget not being masked when freshly added.

Bug: 26721345
Change-Id: I6bc7142c6f488b8666651330039abac27782bda9
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
7f98aa4aa93497692f200c553d2d6fff402e3de2 07-Apr-2016 Fyodor Kupolov <fkupolov@google.com> Added getProfileIds method returning array of userIds

Previously many usages of UserManager.getProfiles and getEnabledProfiles
were only using ids of returned users. Given that the list of users needs
to be parceled and unparceled for Binder calls, returning array of ids
minimizes memory usage and serialization time.

A new method getProfileIds was introduced which returns an array of userIds.
Existing method calls were updated where appropriate.

Bug: 27705805
Change-Id: Ic5d5decd77567ba0f749e48837a2c6fa10e812c0
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
0c9dd5b98a74c65e9e9e03a207681fc4b7bc4a0a 06-Apr-2016 Rubin Xu <rubinxu@google.com> Clear caller identity when calling createConfirmDeviceCredentialIntent

Bug: 27893870
Change-Id: I9edcd170432f8a2bd852a5fa78ab868201093dcf
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
60c74e836fc40d65c8ac58c231956f57d26ec7eb 05-Apr-2016 Sunny Goyal <sunnygoyal@google.com> Merge "Changing startListening to only fetch views which are bound" into nyc-dev
2857f1c783e69461735a51159f9abdb85378e210 31-Mar-2016 Sunny Goyal <sunnygoyal@google.com> Changing startListening to only fetch views which are bound

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
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
e95057ade126e9e159fe05b69c32f85f7891490f 01-Apr-2016 Rubin Xu <rubinxu@google.com> Split ACTION_MANAGED_PROFILE_AVAILABILITY_CHANGED into two.

Add more comment to EXTRA_QUIET_MODE

Bug: 27532254
Change-Id: I68a217561afca8b87f523c62393cdad097d5b75d
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
efc4a344a173ae20ec72b8c05c45b794687fda87 22-Mar-2016 Andrei Stingaceanu <stg@google.com> AfW - suspend apps - API polish

* renamed getPackageSuspended => isPackageSuspended
* does not return false for an error, instead throws
NameNotFoundException if the package could not be
found, or if there is an unknown RemoteException,
wraps it in a RuntimeException and rethrows.

Bug: 27532430
Bug: 22776761
Change-Id: Iee00600089b1c0556a3312b10456826464fa8f9f
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
1af4a7b5bf611a3af931681ea1514513e9cc4c51 21-Mar-2016 Jeff Sharkey <jsharkey@android.com> Skip app widget config changes when user locked.

Bug: 27377050
Change-Id: Ic63b06159cf59106b4e7bc62ec5f3e89d47321c5
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
8a372a0a280127743ce9a7ce4b6198c7a02d2a4f 16-Mar-2016 Jeff Sharkey <jsharkey@android.com> Refactoring FBE APIs based on council feedback.

Mostly consists of removing the word "encryption" from most APIs,
since we can't actually make promises about the data being encrypted.

Bug: 27531029
Change-Id: Iace9d7c4e64716abf86ed11847c40f3947e1d625
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
7a9c34bd7a65bf27a3a7ea83d7a1391667bae50a 11-Mar-2016 Sudheer Shanka <sudheersai@google.com> Show admin support dialog if app is suspended.

Bug: 26922950
Change-Id: I21f048873244df52d14910cc01a658af476d9149
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
d5896630f6a2f21da107031cab216dc93bdcd851 05-Mar-2016 Jeff Sharkey <jsharkey@android.com> Move more PM calls to ParceledListSlice.

Since the data returned by these calls can grow unbounded based on
various GET flags, we need to switch 'em over.

Bug: 27391893
Change-Id: Ie849ca30dbaaa91158da4c83675657715629a0ee
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
484eea70dfe131ea1868ac7f8b19fa16b50e8b86 02-Mar-2016 Rubin Xu <rubinxu@google.com> Merge "Fix widget icon and tap behaviour." into nyc-dev
8267e8241f5639780fce629fa0c126195f1fac36 29-Feb-2016 Kenny Guy <kennyguy@google.com> Don't clear widget providers from stopped profiles.

Stopped profiles may have a parent still running
hosting widgets so providers should remain.

Bug: 26842832
Change-Id: I3ef97222fcfa5b183744033ece133115b3c146c1
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
5580622231f93280cba2d380744a2ded566e4b95 10-Feb-2016 Rubin Xu <rubinxu@google.com> Fix widget icon and tap behaviour.

Do not show badge icon when the suspended package is not inside
a managed profile. Tapping on a masked widget should bring up the
relevant dialog similar to tapping on the app's launcher icon.

Bug: 26948327
Bug: 26924217
Change-Id: I2bf7ac718e55063bc8ea66573e89a62a97b91ff2
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
63f4ef0b7d0988ff833e8e9f5cf8ac807b524aa4 22-Feb-2016 Kenny Guy <kennyguy@google.com> Don't load profile widgets until parent is unlocked.

Wait for parent user to be unlocked before attempting
to load widgets for a user.
Fixes issue with profile being unlocked and AppWidgetServiceImpl
thinking it has loaded parents widgets while locked and
therefore not seeing any widgets.

Bug: 27037962
Change-Id: Ice9c5e6e1dd062a622c5f984eeb3531de893f9be
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
33f9a9c21a3251fb6e6828910a20174360785ae5 15-Feb-2016 Kenny Guy <kennyguy@google.com> Allow widget hosts to see widgets from locked profiles.

Avoid launchers removing widgets by handling case
where a widget host is in an unlocked parent user and
widget providers are in a locked managed profile.
For this case allow launcher to see the widgets from
non-crypto aware widget providers.
Mask out widgets from locked profiles.
Fix issue with widgets not being masked when adding
new widgets when user is locked / quiet or package
is suspended.

Bug: 26721345
Bug: 27037962
Change-Id: I60b5bd934c1547110e374ab4eefbee6aade37dc6
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
355b232d7998cfc9b29d42a0356390e25191bcbd 12-Feb-2016 Andrei Stingaceanu <stg@google.com> Suspend packages - new API for retrieving the suspended status

Instead of always rebuilding the full ApplicationInfo for a
package when callers are only interested in the suspended status
add a new fast API in Packagemanager (which only checks the
suspended user setting for the requested package and returns
a boolean) and change the appropriate caller code too.

Bug: 26794775
Bug: 22776761
Change-Id: Ide8428ef734479360d5a8a75fd8e0ed8ddf2da7a
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
d09020576f4ae19b006983bc0eab5c317a8856de 25-Jan-2016 Rubin Xu <rubinxu@google.com> Mask widgets for suspended packages.

Bug: 22776761
Change-Id: I271257e765a2297c780ac2bd37426d8fb451e5d9
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
cd65448ccd13c4c2d0fe9e9623fec3a898ab9372 09-Jan-2016 Jeff Sharkey <jsharkey@android.com> Even more PackageManager caller triage.

Finish moving all UID/GID callers to single AIDL method that requires
callers to provide flags.

Triage AppWidgets and PrintServices, which currently can only live on
internal storage; we should revisit that later.

Fix two bugs where we'd drop pending install sessions and persisted
Uri grants for apps installed on external storage.

Bug: 26471205
Change-Id: I66fdfc737fda0042050d81ff8839de55c2b4effd
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
0999c0d6e9c83873d9595ee764b6388dbc49dcb8 17-Dec-2015 Jeff Sharkey <jsharkey@android.com> Make printing framework encryption-aware.

Only create UserState objects when a user has been unlocked, meaning
we can connect to the spooler. Ignore package events that occur
while a user is locked, since we'll kick off updateIfNeededLocked()
when that user is eventually unlocked.

In all other cases, throw if someone tries obtaining UserState for
a still-locked user. This should help catch any edge cases in the
system, and communicate clearly through public APIs that printing
isn't available until the user is unlocked.

Bug: 26246836
Change-Id: If15744621890baee206d355484fe20933afc65d8
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
af6ec296ec200726ac86ff53efc64e221ed6f2f6 17-Dec-2015 Jeff Sharkey <jsharkey@android.com> Make AppWidgets encryption-aware.

Only parse and load AppWidget configuration details after a user has
been unlocked. Yell loudly if someone accidentally tries loading
data for a locked user.

Tidy up protected broadcast logic a bit more to handle persistent
processes. Add backwards compatible behavior for APPWIDGET_UPDATE
broadcast simliar to APPWIDGET_CONFIGURE, since some apps are sending
it to themselves.

Add hidden USER_HANDLE extra to a handful of broadcasts to make
logic more consistent.

Bug: 26247049, 26219971
Change-Id: I54e4f2e343488571f9baa1a316962f41186c1a2c
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
cc52ce4bc4a7cfb28119d1949f44d1b1287936e7 18-Nov-2015 Rubin Xu <rubinxu@google.com> Mask work widgets if work profile is in quiet mode.

If a work profile is in quiet mode, mask widgets belonging to that profile
with a generic RemoteView.

Bug: 22541941
Change-Id: I3baa179630af497afa02b32f236d2bdaa4a75904
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
67507d9f9dfe806edbb72dccf0c54850844c73fc 13-Nov-2015 Christopher Tate <ctate@google.com> Drop binder identity before setting widget provider refresh alarm

Bug 25607336

Change-Id: I645b79c01206baa548d1d58cf9712ac1768e3b5b
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
b27fdb33c4f85f720c80627aaf0cd8cb2e30cd7a 18-Sep-2015 Kenny Guy <kennyguy@google.com> Merge "Don't remove widget providers when whitelist changes."
415f111335b7ea46047233d05acd685432b0f92e 14-Sep-2015 Kenny Guy <kennyguy@google.com> Don't remove widget providers when whitelist changes.

When a widget provider is removed from the whitelist
of widgets that work across profiles just remove the
currently bound widgets don't remove the provider.
This allows the provider to be added back to the whitelist
or to be used from widget hosts within the profile.

Bug: 21180997
Change-Id: I5d3a81fb088092b65cc4e8e158be4a292c5c8288
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
7c69636c9a406265e1da368f3edfd8fb9651132c 16-Sep-2015 Xiaohui Chen <xiaohuic@google.com> Cleanup USER_OWNER in various services

Bug: 19913735
Change-Id: I980370bab18e1b9ccf4043eed2b9fd721a940f72
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
dbba74e81faba861e1a5880e36e3f3268c5fb3bd 11-Aug-2015 Winson <winsonc@google.com> Always call onProvidersChanged() when packages containing widgets are updated.

- In the existing logic, the call to onProvidersChanged() is called when a package
with widgets is added or removed, but only called when a package is updated _and_
there is an app widget bound to a host. This differs from what the expected
behavior is based on the documentation and means that packages with widgets that
update have no way of notifying host apps of changes except via package events.

Bug: 20698931
Change-Id: I60af36d51e99ca1ea751d9d9d03a50ef2d5bef98
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
c070bab9ed0c13379f8dfcb8282dccf8ff08d2e3 18-Jun-2015 Hyunyoung Song <hyunyoungs@google.com> GetInstalledProvidersForProfiles should never return null object.

b/21916365
b/19904873

Change-Id: I296cafd15a185ad91cb7491bd6d2466ac03cdfb7
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
ccf6c6814736e368949b64aadce676ab6d045fdc 18-Jun-2015 Hyunyoung Song <hyunyoungs@google.com> AppWidgetServiceImpl should use ParceledListSlice as return object
b/19904873

> Reason: to prevent TransactionTooLargeException from occuring when
binder transaction size goes over the limit.

Change-Id: I054cb161d235234f3ccdaadd70314163e690b0db
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
9e9e2e73c6ec7bece20268196dc89ad0c8bafad4 08-May-2015 Wojciech Staszkiewicz <staszkiewicz@google.com> Pass charset to XmlPullParser.setInput instead of null

Passing null to XmlPullParser.setInput forces it to do additional
work, which can be easily avoided if we know the charset beforehand.

bug: b/20849543

Change-Id: Iaff97be9df2d0f99d7af8f19f65934439c9658e2
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
e4a8da8ea241858b52d8122480316db79582c44d 01-May-2015 Amith Yamasani <yamasani@google.com> Exclude bound app widgets from idle app list

Track package names of bound app widgets and use the list when
querying for idle apps.

Bug: 20066058
Change-Id: If8039397a061ef04bb13aa38d57cd7f0221f5fc7
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
d69e4c1460017062e7c36be55801cb434ad19d97 24-Apr-2015 Dianne Hackborn <hackbod@google.com> Update use of procstate for services.

Now that we have a separate foreground service proc state
(above a sleeping top app), update various system services
to put their bindings into this state when appropriate.

There are two new bind flags for this -- one that just always
makes it a foreground service, another that only does it when
the device is awake (useful for things like the wallpaper).

And with all of that, tweak network policy manager to only
include apps that are at least foreground service state when
in power save and device idle modes. This will allow us to
further reduce the set of apps that have network access
(in particular not giving access to the current top app when
the screen is off), hopefully leading to even better battery
life.

Change-Id: I91d85a5c5ed64e856149e9a5d94a634a7925ec7f
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
b0a78390ed834724e9c6adf0feff9931d7f9ec10 11-Apr-2015 Svetoslav <svetoslavganov@google.com> Add a mechanism to make pending intents immutable.

bug:19618745

Change-Id: Ice742e0162cb9b7c0afbc32e0eea03d501666e2b
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
0f7fab6662c85b2af83438297e4960483cc39b1e 16-Feb-2015 Kenny Guy <kennyguy@google.com> Remove widgets for packages no longer whitelisted by admin

When cross profile widget whitelist is updated by device admin
remove providers for removed packages.

Bug: 19293923
Change-Id: I7a5f7b706486055346d906c89d48510bfe1ad352
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
ad870c3d9c58a9ee31cdf4a9807a4cec2e68ab04 08-Oct-2014 Svetoslav <svetoslavganov@google.com> Restored widget provider id not properly updated.

During restore first the provider records and then the applications
are restored. Therefore, we keep the restored provider records in a
zombie state and once we get the package install broadcasts from the
package manager we update the zombie providers to be real ones. The
bug was that while doing this we were not updating the provider id
from one with an undefined UID to the one with the UID under which
its package now runs.

bug:17869323

Change-Id: I20b7cbfd2f90e2f5bf3a6b858d8da99cc1c82841
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
d00bb5edcfc8ee5c2026f66785b703b388314b22 07-Oct-2014 Adam Lesinski <adamlesinski@google.com> Load shared library dependencies for AppWidgets

PackageManager and AppWidgetHostServiceImpl should
be loading the resources of any shared libraries being
used by the app, as they have references in their Widgets
or application icons/labels, etc.

Bug:17668152
Change-Id: I359662334edb125d7570089916727df4eeba02bb
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
c616b3e2f16c99c51e0543256c219e799ff32232 22-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix a bug in parsing app widget state XML.

When restoring app widget state from XML we read all providers,
hosts, and widgets and only after reading all hosts and providers
for all members of the group we hookup the widgets as they may
cross profile boundary. To esntablish the host-widget and provider-
widget relation we use a tag for the host and the provider that
are assigned before saving the state to XML. When restoring we
are using the tags to match widgets with hosts and providers. The
bug was that we were not clearing the tag of all hosts and providers
before reading from XML as we want the only tags that are defined
to be the ones we are reading. This resulted in wrong app widget
restore for a secondary user.

bug:17505027

Change-Id: I035d8f13142c6b9dbc9d658b82390f9cd8d75e0d
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
9ce72731f22caa07d90dcd016c6441bfeb90225c 05-Sep-2014 Nick Kralevich <nnk@google.com> Merge "AppWidgetServiceImpl: Use enforceCallingOrSelfPermission for checking DUMP" into lmp-dev
75d8c0b8bc28f61658c62b870ae8705e0be191cb 05-Sep-2014 Nick Kralevich <nnk@google.com> AppWidgetServiceImpl: Use enforceCallingOrSelfPermission for checking DUMP

Use enforceCallingOrSelfPermission() for throwing a security exception
rather than creating the security exception ourselves. This has the
advantage that the exception is in a well known format expected by
the CTS test android.security.cts.ServicePermissionsTest#testDumpProtected

Bug: 17165920
Change-Id: I7d3c2d2a0852a490fe1d553cd81d1efc79d2fec3
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
298a6c6b29798647b3d8f12d0723b1e49fc8b8da 04-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix collection iteration index.

bug:17387880

Change-Id: Ic637ce8fa2da87d6f21a222bd70bf627953f57e3
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
5771ad7bc7533f4a9bc72ac1ecabfdf6ca493b16 24-Aug-2014 Svet Ganov <svetoslavganov@google.com> RemoteViews service not unbound.

We are checking whether an app can access an app widget
based on the calling uid and the package name. The package
is mostly to make sure that hosts in different apps do
not accidentally interfere whereas the security is enforced
by the uid.

When remote views adapter binds and unbinds to a remote
views serivce it was passing the package of the context we
create to load resources for the widget instead the package
of the host. Now it is passing the host package and also
we are checking if the caller of bind remove serivce API
is in uid that has the host package - this makes it
consistent with elsewhere.

bug:17226052

Change-Id: I2b0b6669e3dc027037b7481c2871cedabd642433
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
3de01b2e3474ac2eaccbcf72b6693bb19d254824 21-Aug-2014 Svet Ganov <svetoslavganov@google.com> Fix a regression in partially updading app widgets.

App widgets can be partially updated where only the actions delta
is delivered to the client. There was a regression where instead
of sending the delta, the merged remote views were sent. This was
problematic because certain actions are ignored when merging to
avoid clutter (specifically showNext and showPrevious), hence these
actions never reached the client.

bug:16844814

Change-Id: I88ab58e610cda24154985165e6d6d93a1baa9c79
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
6bd702538d90005add1cfc33746da19404090dc1 20-Aug-2014 Svet Ganov <svetoslavganov@google.com> Notify app widget hosts when cross-profile providers change.

1. Notify the hosts in the group if a package gets white-listed or
un-white-listed for providing widgets across profiles.

2. Notify hosts in the group for provider changes when a profile
is deleted.

bug:17126070

Change-Id: Ic719c1c68e45842d50decc95603f1d61583b8f02
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
8e1d299da27da534b508b1da51ebe351a689cefa 08-Aug-2014 Svetoslav <svetoslavganov@google.com> Polish the new cross-profile app widget APIs

bug:14991269

Change-Id: I5996f8c69a3d151ff1ecd8f19403dd606f588150
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
985e566ceca9c11d2f740499053f37dfaeb9033d 07-Aug-2014 Svetoslav <svetoslavganov@google.com> Fix cross-user talk.

An app can access widgets hosted or provided by its uid and package.
Access is also allowed if the caller has the bind app widgets permission
but this caller can be in the wrong user. Now the caller should not
only have the bind app widget permission but also be in the same user
as the host or the provider of the widget.

bug:16834230

Change-Id: I5ddb6309f63f2b4ba95360446c2b9584350fb66f
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
c71c42fdb2ee54a419dc8eb0a5f4f82532b16c0c 06-Aug-2014 Svetoslav <svetoslavganov@google.com> Polish of the app widgets cross-profiles feature.

1. Added API for badging an arbitrary drawable at a given location.

2. Updated the icon and previewImage deprecation as they are no longer
returning a badged drawable. The methods to load the icon and the
preview are now just making it easier for a developer to get the
drawables.

3. Fixed a bug in AppWidgetServiceImpl leading to a crash when a user
is removed.

4. Fixed a bug in AppWidgetHost which was unnecessarily caching its
package name and having code paths where the cached value was not
populated when calling into the system.

bug:14991269

Change-Id: I50d011a6597d88814715d5ec04ee67815e8ce0bd
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
976e8bd2017d0263216c62111454438cc0f130e3 17-Jul-2014 Svetoslav <svetoslavganov@google.com> Allow adding widgets from user profiles.

The goal of this change is to enable support for appwidget from
user profiles to the user main profile. A user profile is a user
which is associated as a child of the main user profile. For example,
a user may have a personal (parent) and corporate (child) profile.
The device policy should be able to control whether adding a widget
from a child profile and given packages is allowed. This change
assumes that all packages from managed profiles are white listed.
Another change will add the device policy changes.

Change-Id: I267260b55d74c48b112a29979a9f59eef7a8194e
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
1c5bffbf5bae6762c8df07350abca61e460653bb 28-May-2014 Adam Cohen <adamcohen@google.com> Fix security issue in bindRemoteViewsService

-> Enforce that the passed intent's component belongs to the same package as the
passed AppWidget id.

issue 15287902

Change-Id: Ic85c38d399fe1cbb6f7efa844ae0f5367a1906ed
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
96472bec7886b54cf7b52e2833bd1b4cf2e730a1 25-Apr-2014 Elliott Hughes <enh@google.com> Track package change.

Change-Id: I6a8123d8e69367fc1ce27bac46c4bcec489d73ba
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
132933dc2e0e67012e6022b04a744a52344b1285 27-Mar-2014 Christopher Tate <ctate@google.com> Unlinked providers STILL shouldn't cause crashes

Bug 13651057

Change-Id: Id7e5ba521ac3f201b1a44f122358ca5af2929e06
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
95ead2c58989c89b7037de377e990ad19d8db3e0 26-Mar-2014 Christopher Tate <ctate@google.com> Don't crash when handling unlinked widget bindings

A host can have an 'instance' the other end of which is still
unlinked to a concrete provider. Don't crash when we hit those.

Bug 13651057

Change-Id: I5a29afb0e6a7ab30976862aee04bd33f609543fa
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
adfe8b86e9178a553b6db9722340fa4ff5201cf1 05-Feb-2014 Christopher Tate <ctate@google.com> App widget backup/restore infrastructure

Backup/restore now supports app widgets.

An application involved with app widgets, either hosting or publishing,
now has associated data in its backup dataset related to the state of
widget instantiation on the ancestral device. That data is processed
by the OS during restore so that the matching widget instances can be
"automatically" regenerated.

To take advantage of this facility, widget-using apps need to do two
things: first, implement a backup agent and store whatever widget
state they need to properly deal with them post-restore (e.g. the
widget instance size & location, for a host); and second, implement
handlers for new AppWidgetManager broadcasts that describe how to
translate ancestral-dataset widget id numbers to the post-restore
world. Note that a host or provider doesn't technically need to
store *any* data on its own via its agent; it just needs to opt in
to the backup/restore process by publishing an agent. The OS will
then store a small amount of data on behalf of each widget-savvy
app within the backup dataset, and act on that data at restore time.

The broadcasts are AppWidgetManager.ACTION_APPWIDGET_RESTORED and
ACTION_APPWIDGET_HOST_RESTORED, and have three associated extras:

EXTRA_APPWIDGET_OLD_IDS
EXTRA_APPWIDGET_IDS
EXTRA_HOST_ID [for the host-side broadcast]

The first two are same-sized arrays of integer widget IDs. The
_OLD_IDS values are the widget IDs as known to the ancestral device.
The _IDS array holds the corresponding widget IDs in the new post-
restore environment. The app should simply update the stored
widget IDs in its bookkeeping to the new values, and things are
off and running. The HOST_ID extra, as one might expect, is the
app-defined host ID value of the particular host instance which
has just been restored.

The broadcasts are sent following the conclusion of the overall
restore pass. This is because the restore might have occurred in a
tightly restricted lifecycle environment without content providers
or the package's custom Application class. The _RESTORED broadcast,
however, is always delivered into a normal application environment,
so that the app can use its content provider etc as expected.

*All* widget instances that were processed over the course of the
system restore are indicated in the _RESTORED broadcast, even if
the backing provider or host is not yet installed. The widget
participant is responsible for understanding that these are
promises that might be fulfilled later rather than necessarily
reflecting the immediate presentable widget state. (Remember
that following a cloud restore, apps may be installed piecemeal
over a lengthy period of time.) Telling the hosts up front
about all intended widget instances allows them to show placeholder
UI or similarly useful information rather than surprising the user
with piecemeal unexpected appearances.

The AppWidgetProvider helper class has been updated to add a new
callback, onRestored(...), invoked when the _RESTORED broadcast
is received. The call to onRestored() is immediately followed by
an invocation of onUpdate() for the affected widgets because
they will need to have their RemoteViews regenerated under the
new ID values.

Bug 10622506
Bug 10707117

Change-Id: Ie0007cdf809600b880d91989c00c3c3b8a4f988b
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
49782e46c0eb85a25ae2abcf80880c48dbab5aea 20-Dec-2013 Amith Yamasani <yamasani@google.com> am 9158825f: Move some system services to separate directories

* commit '9158825f9c41869689d6b1786d7c7aa8bdd524ce':
Move some system services to separate directories
9158825f9c41869689d6b1786d7c7aa8bdd524ce 22-Nov-2013 Amith Yamasani <yamasani@google.com> Move some system services to separate directories

Refactored the directory structure so that services can be optionally
excluded. This is step 1. Will be followed by another change that makes
it possible to remove services from the build.

Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
/frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java