History log of /frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
fac592f64c55004e9048e30e03d6dc65bdb4f00a 21-Nov-2016 Makoto Onuki <omakoto@google.com> Fix issue with apps restored to lower versions.

When restoring to a new device, if a restored app is not compatible
with the old version (e.g. lower version or different signature),
then we won't restore shortcuts, which is working as expected.

However when it happens, the shortcut manager forgot to "un-shadow"
the package information, causing the app to not have shortcuts at all.

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests

Bug 32999759

Change-Id: I89832360114de0ce1c57d763bcaccab4fdb87b6d
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
c8c3329dd918b8ea16d6317d19ddee12325800f3 13-Sep-2016 Makoto Onuki <omakoto@google.com> Don't update publisher version code without scanning manifest

- It was (theoretically) possible for shortcut manager to update
the version code for a publisher package without rescanning manifest
shortcuts, if backup happens right after unlocking a user before
SM searches for updated packages. If it happens, then SM will not
scan the manifest for this package until it's updated next time.

So don't refresh the version code during backup, which we only
have to do for launchers but not publishers.

- Also fix the owner-user-id for launchers. (Luckily it's not causing
any issues.)

Bug 31402152

Change-Id: I5d898eb3882b74edaca8b2d5f960849370ffc23b
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
fc4cf2da34335fd7e84c020f51eea1a341d3f134 24-Aug-2016 Makoto Onuki <omakoto@google.com> Shortcut: Improve backup & restore

* Catch RuntimeException from restore, in case restoring from a
partner device with an incompatible file format.

* When a restore target app is already installed, and
- if it has allowBackup=true, we'll restore normally, so all
existing shortcuts will be replaced. (but manifest shortcuts
will be re-published anyway.) We log a warning on logcat.

- if it has allowBackup=false, we don't touch any of the
existing shortcuts.

Bug 31057974
Bug 30766177

Change-Id: Ic3f7e860e7ea0d086fc589d8cbed8c4cebdd4bc6
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
3366328245621fa6e8fd764a4d3c2f073774d096 23-Aug-2016 Makoto Onuki <omakoto@google.com> Do not scan system apps unless after OTA

Bug 30956231

Change-Id: I4af34cdd39cfaf0b8712b9ded1ef119efa3e04b0
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
085a05cd864252314bcf5c339017a16b68105204 19-Aug-2016 Makoto Onuki <omakoto@google.com> Off-load unlocking users onto a worker thread

Bug 29645168

(cherry picked from commit 3107ff78454d54c0494911bf69ca952152af7cf0)

Change-Id: I3f8e768f6afeb6386a08ba9ac48e0e206395da2b
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
1e1732399a48c9521eea7a117f1f0e87ca64d2ab 10-Aug-2016 Makoto Onuki <omakoto@google.com> Fix two shortcut manager issues

- isUserUnlocked check is still racy
We used a local copy of each user state in mUnlockedUsers, and updated
it in the service lifecycle events. However because
SystemService.onUnlockUser() is called on Handler, there was a brief
window between when the user was actually unlocked and the shortcut
manager thought the user was unlocked.
So now check with activity manager for the latest state too. We still
check with the local copy first, because we want to consider STOPPING
as "unlocked".

- Messenger loses all bitmap icons.
Because we delay-save the shortcuts.xml file, if the device shut down
before we save the XML file but after removing the bitmap files,
we'd lose the bitmaps.

(Apparently SystemService.onCleanupUser() may not be called even when
a device is cleanly shutting down.)

So don't remove bitmap files synchronously, ever, and instead after
saving the XML just run the dangling file cleanup.

Bug 30784267
Bug 30730471

Change-Id: Ie58656efba2dca2b00582e145613bc56266a091e
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
377b7970ad70e87f8137ea7d9e7a6b00de1826ae 09-Aug-2016 Makoto Onuki <omakoto@google.com> Rescan apps after restore and re-publish manifest shortcuts

Originally when I wrote backup & restore for ShortcutManager,
there was no manifest shortcuts, so there was no need to
handle preintalled apps specially.

However, now we have manifest shortcuts, which are published
when the user is unlocked, by the time restore happens preinstalled
apps may already have manifest shortcuts, which will be overwritten
by the restored shortcuts.

So we need to re-publish manifest shortcuts after restore.

Bug 30746028

Change-Id: I6afbae7790c9ed38483637f33c381ecb6f854677
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
64183d518813cc65efcaeaf0d4c28de092b32868 08-Aug-2016 Makoto Onuki <omakoto@google.com> ShortcutManager improve app udpate check

- Don't use lastUpdateTime for system apps since it's not reliable.

- Scan downgraded apps too.

Bug 30708050
Bug 30734178
Change-Id: I98253f4c635466197548385275ab08c5e3a1a10b
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
9c850012cacf0af4a392294566a8c7c897dc8771 27-Jul-2016 Makoto Onuki <omakoto@google.com> Prevent shortcut access when user is locked

Also add some test utility methods that'll be used by CTS.

Bug 30406401

Change-Id: I9396acebbdb3cbe64f6e85877ee62a2131cd6e61
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
7e5c3e85420a255bd79242dd97b90340c6e3a4df 22-Jul-2016 Makoto Onuki <omakoto@google.com> Fix intent flags

Bug 30307198

Change-Id: If127001320dcabdc53ee73860dbb9983cb25b611
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
3fa345b5c2cf5d7fd8c87e44d1887f011787c548 22-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Unit tests for "cmd shortcut"" into nyc-mr1-dev
440a1ea8e2204ecb171e0187318beb2f08f6012c 20-Jul-2016 Makoto Onuki <omakoto@google.com> Support multiple intents in ShortcutInfo

Also fix b/30230996.

TODO: Support the sourceBounds argument to LauncherApps.
startShortcut().

Bug 30218829
Bug 30230996

Change-Id: Ibb6c59d5b7c0a320c21d09436d016d0eac94644f
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
0b9d1db5c1aab9017daf05abd0ba0f4de2c7192d 18-Jul-2016 Makoto Onuki <omakoto@google.com> Unit tests for "cmd shortcut"

Also removed unnecessary commands.

Bug 29612099

Change-Id: Id554163c861fb144cb5140d7eb709178347f7868
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
6fa0e4d518a67380fada76bb78b4e7b697b4d7a4 16-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Don't accept resource references in string fields" into nyc-mr1-dev
1030520822c42cc7357b463d301c7e97e928ba22 15-Jul-2016 Makoto Onuki <omakoto@google.com> Cache the default launcher.

Originally we always checked with PM for the default launcher,
which would take ~2ms.

Now we cache the result, and clears the cache when (any) preferred
activities change.

Bug 30126557

Change-Id: Iceef288cd372c8bb9b119aa493e5173d894f2302
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
6771d73703d35f2b28b8602dcbbed88fdffb9a0b 14-Jul-2016 Makoto Onuki <omakoto@google.com> Don't accept resource references in string fields

Detect it when a developer accidentally uses @string/... in string fields
and log an error rather than publishing shortcuts with wrong values.

Bug 30140672

Change-Id: I98a60afd7f52282019a94a7a8c30a85ea4c7806b
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
4e6cef49ef11bbb5bfc0e9f0fb865188492d88b0 14-Jul-2016 Makoto Onuki <omakoto@google.com> Handle locale change and pacakge change in different way

- Stop using a custom callback from AM to detect locale changes
and use the LOCALE_CHANGED broadcast instead.

- This would open up a chance where a publisher app fetches
its won manifest shortcuts after a locale change but
ShortcutManager hasn't updated string resources.

- So instead, at every entry point from ShortcutManager, check
if the locale has changed, and if so, update all resources
(and reset throttling).

- Do the same for package change events too. At every entry point
from ShortcutManager, check if the caller package has been updated,
or any target activities have been disabled. If so, rescan the
caller package.

- We do *not* do the same check at the LauncherApps entry points,
because the launcher should use the callback to listen to
shortcut changes.

- Also stopped using PackageMonitor for now because we want to
set a higher priority and changing PackageMonitor at this point
seems too much for DR.

Bug 29895275
Bug 30123329

Change-Id: Ib4a2f626a936c7328e2cc032324f5c3d1c3b9122
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
f34c308dfd9cdda428b8ead8bf655de1608501a9 13-Jul-2016 Makoto Onuki <omakoto@google.com> Revert "Revert "Revert "Handle package broadcasts before apps do"""

This reverts commit 886ba78dfb105eb45416587b73b6c6b336448de5.

With the tests updated.

Change-Id: I162e6ca23c667f90feddc1e9f42b554a416295cf
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
98802f6007eef7a36237087111c38a998a388903 13-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Revert "Revert "Handle package broadcasts before apps do""" into nyc-mr1-dev
886ba78dfb105eb45416587b73b6c6b336448de5 13-Jul-2016 Makoto Onuki <omakoto@google.com> Revert "Revert "Handle package broadcasts before apps do""

This reverts commit efbbe7ea9db8adab6bff407db1d7fc54bbaf31ee.

Change-Id: I3dbb080db5121307f533a7d411f4f5d47225500e
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
7f3187bb0d12d288bc7211549c08adeb5ff651aa 13-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Revert "Handle package broadcasts before apps do"" into nyc-mr1-dev
4885b274c1502b8e478e16d4418b7fd86ab6c865 13-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Don't backup & restore disabled shortcuts." into nyc-mr1-dev
efbbe7ea9db8adab6bff407db1d7fc54bbaf31ee 12-Jul-2016 Makoto Onuki <omakoto@google.com> Revert "Handle package broadcasts before apps do"

And fix b/29939691 (don't try to load locked users) in a different way

Bug 29939691
Bug 29895275

Change-Id: Ib55f9c5d5547c54daa4e05c1e50bf4bbceaf1991
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
f3ba2e04be20d33fee989e782ba1966322e7e263 12-Jul-2016 Makoto Onuki <omakoto@google.com> Don't backup & restore disabled shortcuts.

Also a backup & restore test where an app has manifest shortcuts.

Bug 30016960
Bug 29921267

Change-Id: I8c4c3ece50f26d778b2f8f42251c317eb25d1e14
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
83f6d2da372de339dc563d6a7786be3facc52e76 11-Jul-2016 Makoto Onuki <omakoto@google.com> Throw ActivityNotFoundException when failed to launch shortcut

Originally the code used IIntentSender, but I had to switch to calling
startActivitiesInPackage() directly, because sendIntentSender() does
not support returning errors.

Bug 30035853

Change-Id: I5d7669c96a2f1805373c71aebf45b97ac1d01ff6
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
a2241834a54dc91e2eef858741f1a56a743c27b2 06-Jul-2016 Makoto Onuki <omakoto@google.com> Handle package broadcasts before apps do

- Have PM to call the shortcut manager directly before sending a
pacakge broadcast.

- The shortcut manager will enqueue a task to handle a package
broadcast, which will be executed on Handler.

- At the entry points of all external facing methods, block until
all pending tasks are finished.

Bug 29895275

Change-Id: Ib29fa3c9c8d9b9e0ca5c8f1e9da2a390324960a4
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
7df9ce075fddc8f3b4e5f177b41bab864c759e8b 01-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Make sure re-published dynamic shortcuts are always enabled" into nyc-mr1-dev
ee6b6e4a1861336f8db52d8c93dbf32ee9615cfa 30-Jun-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Make sure persisted default launcher still exists.

- Also make sure to ignore unexported activities.
(e.g. unexported activities shouldn't have shortcuts.)

- Also add unit tests for package manager related operations.

- Also remove stale TODOs (per-activity shortcut count check is
implemented already.)

Bug 29699769
Bug 29516954

Change-Id: Ia18301baf6bec1ad71ae195d9ae3d10bd8386fc4
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
ff14f73152775f91fe211729e2cb16a5da6933ab 01-Jul-2016 Makoto Onuki <omakoto@google.com> Make sure re-published dynamic shortcuts are always enabled

- Originally there was explicit code to take over the disabled flag,
which was simply not necessary.

- Also fix the startShortcut() tests that have temporarily
been disabled.

(Also remove the stale TODOs to avoid conflict with Ia18301ba)

Bug 29633681

Change-Id: I58b12ad6918d7fef4b79059b0c2c7f2df6e32269
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
bc8e0052fdf92efd0471b97092ee6a7e1eb2320d 30-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "Fix updateShortcuts() with icons" into nyc-mr1-dev
d6880797f72e1e397e18c6e709c0125f795c7d2e 29-Jun-2016 Makoto Onuki <omakoto@google.com> Address API council feedback (continued)

Got a second set of comments.

Bug 29757958

Change-Id: Ib3a3ffd28bc3e35eb0218b0819870eb5c6ebadb5
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
dd097812fa84b898a46cb5dd253422e78779a150 29-Jun-2016 Makoto Onuki <omakoto@google.com> Fix updateShortcuts() with icons

But 29822569

Change-Id: I72a0903ccc8acffc42f40d9df7b99ed6de26b66d
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
b08790c3b2f3bdb0c2e2f7ff46e4584fb1127769 23-Jun-2016 Makoto Onuki <omakoto@google.com> Shortcut: Only "main" activities can have shortcuts.

- Don't publish shortcuts when their target activities are not main.
- Only scan manifest shortcuts for main activities.
- When an app is updated, remove shortcuts that no longer belong to
valid main activities.

- Also re-publish manifest shortcuts after 'clear data'
- Also listen to PACKAGE_CHANGED and disable/re-publish shortcuts
properly.

Bug 29355786
Bug 29582255
Bug 29601844

Change-Id: I6c701ce669cf30a227bc2af4aa01de467ef73e3a
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
b5a012fd6f088629746057a3902b5926f9fe8e08 21-Jun-2016 Makoto Onuki <omakoto@google.com> Shortcut Manager: Address API council feedback and fix TODOs

Bug 29515722
Bug 29516909
Bug 29515090
Bug 29516954
Bug 29515088

Change-Id: Ibe1d27033cbd0fd50d37e3d9945b47551211c568
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
4d6b87ffdf06df3303239130ced685bc1a3fae50 17-Jun-2016 Makoto Onuki <omakoto@google.com> Launcher shortcut callback should deliver manifest shortcuts too

- Also include "activity" in the key fields, as this is now an
important field.

- Also optimize ShortcutInfo parceling for the "key field only" case.

Bug 29394043
Bug 29451629

Change-Id: I61b2bc2f61ad6ebdcbaf6d02f1bd88777c45a7f0
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
df6da040e00cba255cad64d2d231aae62928607a 16-Jun-2016 Makoto Onuki <omakoto@google.com> Update manifest shortcut XML schema

Use the standard <intent> tag instead of custom tags.

- Also fix setDynamicShortcuts(), which was broken in the previous CL.
- Also tolerate runtime exceptions while parsing XMLs
- Also fix b/29422018 while I'm at it

Bug 29390156
Bug 29077932
Bug 29422018

Change-Id: I2756c9d66c6d7b2962a982d9e57a7d84a5755b28
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
489bafbb4ba53fd104c898975cf48c8815a1cb59 16-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "Shortcut: Reset throttling upon inline reply" into nyc-mr1-dev
9e1f5595bd7ffe3af6ca35b3235dfca0ecd07978 08-Jun-2016 Makoto Onuki <omakoto@google.com> ShortcutManger: Auto-adjust ranks.

Spec: go/shortcutmanager-spec-ranks

Bug 28984376
Bug 28536066

Change-Id: Ibffb92233c62792af06eeadc5a9a6379d0506a3c
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
d6e1f3bec18167f726ccc20f9bcbc6526dfc78fe 14-Jun-2016 Makoto Onuki <omakoto@google.com> Shortcut: Reset throttling upon inline reply

When the user does an "inline reply", we consider the notification
publisher app is "activated" and reset the shortcut throttling.

Bug 28705275

Change-Id: Ic9ffa13635274ead7e9d1e832cd31dea997830aa
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
157b1628fd84dc3ef0355fddd8d281618f94d33e 03-Jun-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: deal with changing resource IDs on app update

- When an app is upgraded, all the resource IDs may change. So
if a shortcut is previously published with an icon for res ID 100
and the publisher is upgraded, resource #100 may refer to something
different.

- So now the service also remembers resource names for icon resources,
as wells as string resources. When an app is updated, the service
fetch the updated resource IDs by name.

- Also extract all string resources when a shortcut is published
and persist them, so that even when the original string resources are
removed from the app, the launcher can still show the extracted strings.

- When the system locale changes, re-extract all string resources.

- Also really hide the constants in ShortcutInfo that were
accidentally made public.

Change-Id: I23c29b45c1de5d76175229190a1533c9c62c5960
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
51ab2b3fd04e24e0ca98afd1c1832d84f3a9e62c 02-Jun-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Break down unit tests

The test file is getting too big and making the IDE very slow.
Now it's split into multiple files

Change-Id: I50ed89f19defd3809f327bc21e7d9ea790dcde4e
/frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java