Commit Graph

508 Commits

Author SHA1 Message Date
Sunny Goyal
1cd01b023a Ensuring that ShortcutInfo always has an icon
> Making iconBitmap public instead of a getter (similar to AppInfo)
> Removing getIcon() which can lead to IO on UI thread
> Removing updateIcon and handling the update at the caller

Bug: 21325319
Change-Id: I6a49b9043f974e9629ea25e77012d97cc04c0594
2016-12-13 10:31:12 -08:00
Sunny Goyal
f75baa9f40 Adding support for deep shortcuts in Install queue
Bug: 32904959
Change-Id: Ida43bcf78da716defdf95eb704c31973bc390ea1
2016-12-03 15:55:13 +05:30
Sunny Goyal
b7f5431232 Merge "Moving ShortcutInfo creation in InstallShortcutReceiver to background thread" into ub-launcher3-master 2016-11-30 16:42:31 +00:00
Sunny Goyal
2bcbe13c64 Moving ShortcutInfo creation in InstallShortcutReceiver to background thread
> Creating shortcut info requires iconCache access

Bug: 21325319
Change-Id: I3317d8b6824aa05b836f3ed3626f169d4d34f783
2016-11-30 05:47:57 +05:30
Sunny Goyal
d423a8b868 Merge "Changing DeepShortcutManager to have a singleton contructor instead of getting it from LauncherAppState" into ub-launcher3-master 2016-11-21 17:07:05 +00:00
Sunny Goyal
dde4fd971e Changing DeepShortcutManager to have a singleton contructor instead
of getting it from LauncherAppState

This follows the design of other managers and makes it easier to access it
from other processes and non-ui thread.

Bug: 33032833
Change-Id: I8ad82ae5b6cc47bae885f9896985675c7dd0d5b8
2016-11-21 22:28:23 +05:30
Sunny Goyal
32f3dda802 Adding a utility class to enforce that icons are always flattened on
the background thread.

Bug: 21325319
Change-Id: I4d0f02557cdbf70cfa86750ac047faf2917e39bf
2016-11-19 23:40:07 +05:30
Sunny Goyal
f0ba8b7ca1 Moving various runnables in LauncherModel to individual tasks
> Adding tests for some of the runnable

Change-Id: I1a315d38878857df3371f0e69d622a41fc3b081a
2016-11-09 15:50:08 -08:00
Sunny Goyal
f5e3744637 Updating version check method names
Change-Id: If98851677545a9bbb9de308c23ff5c155a61a8bf
2016-11-02 10:31:41 -07:00
Sunny Goyal
d164b7f4ab Fixing static instance of Indexer being created in the model
Indexer depends on the locale and should be created when ever the config
changes. Moving the widget indexing to the adapter (similar to allApps)
which gets created whenever the activity is recreated.
This fixes the bug where widgets indexing breaks if locale changes while launcher
process is alive
Also fixing the bug in widget model cloning where the HashMap was not cloning
the underlying ArrayList

Change-Id: I7dbe6290e73299c4c07aa7fa564077a2649e1a4c
2016-10-19 07:42:34 +01:00
Tony Wickham
6982de2485 resolve merge conflicts of 2fd0208 to ub-launcher3-master
Change-Id: I20ad6eaace81786be080e28d6eb551908add6d90
2016-10-12 14:38:43 -07:00
Sunny Goyal
8e0e1d7609 Moving come helper methods to corresponding classes
> Moving isPackageEnabled to InstallShortcutReceiver
> Moving the deep shortcut map to the data model
> Removing appInfo.flags. Instead fetching the flags when needed

Change-Id: I654dd8acefa7b7d183b0419afbe112bef001d536
2016-10-10 20:58:56 +00:00
Tony
2fd0208605 Use Launcher.getLauncher(Context) instead of type-casting.
Bug: 32010039
Change-Id: Icb80d3e547a706740b84df2cb80f99e4a7f81c43
2016-10-07 12:50:01 -07:00
Tony Wickham
8177ac7f88 Remove shortcuts that no longer exist or are no longer pinned.
am: 7695e603bf

Change-Id: I525c3342a7559f1cd831cbd4f56c2acd8b6875b9
2016-09-23 00:35:13 +00:00
Tony Wickham
7695e603bf Remove shortcuts that no longer exist or are no longer pinned.
(This change is in the onShortcutsChanged() callback.)

- Remove all workspace icons that correspond to shortcuts that
  are now unpinned
- Remove all workspace icons that have the same package and
  user handle as passed in onShortcutsChanged(), if they aren't
  included in the list of shortcuts that is also passed.

These cases will happen for static and dynamic shortcuts,
respectively, when an app's data is cleared.

Bug: 30316501
Change-Id: I50db6567cb318d087012ab5d8208e765b81c6f99
2016-09-22 16:54:57 -07:00
Sunny Goyal
e9956a76c9 Separating all the static data in a separate class, BgDataModel.
This will allow moving all the Tasks defined in LauncherModel as
separate intependent classes

Change-Id: I0b2f82b90dc22590eb1cc360a5690e2e7f857b5c
2016-09-09 13:32:32 -07:00
Sunny Goyal
40452cf468 Using ItemInfoMatcher in place of similar interfaces and utility methods
Change-Id: I7337b819fe8f42f7a5a1481b5ed5d99a8cf583c4
2016-09-08 15:39:50 -07:00
Sunny Goyal
2ac1918667 Merge "Moving some image handling classes to .graphics package" into ub-launcher3-master 2016-09-02 19:40:58 +00:00
Sunny Goyal
10629b077c Moving some image handling classes to .graphics package
Change-Id: Id6d3d0b9c345a503ff2e09f073eb4b6449e21c7e
2016-09-02 12:34:33 -07:00
Sunny Goyal
c2936bcbdb Moving AppsAvailabilityCheck into a separate class
Change-Id: Ieea1b5100d63752d928049ad9b1d3b4f84234f0d
2016-09-02 11:06:18 -07:00
Tony Wickham
edadc51db4 Use promisedIntent instead of intent when deep shortcuts are restored.
am: fc02c1b446

Change-Id: Ic4c7bc4dfbeb2260f411edd56df2df3769127365
2016-08-29 23:55:57 +00:00
Tony Wickham
765ff3d7c9 Merge "Use promisedIntent instead of intent when deep shortcuts are restored." into ub-launcher3-calgary-polish 2016-08-29 23:38:03 +00:00
Tony Wickham
fc02c1b446 Use promisedIntent instead of intent when deep shortcuts are restored.
This ensures that the intent has the package corresponding to the
shortcut publisher, rather than a market intent. It also ensures that
the intent has the EXTRA_SHORTCUT_ID attached.

Bug: 31123204

Change-Id: I05d56396b629880322e915f52bfc0605b921b0b1
2016-08-29 15:59:28 -07:00
Sunny Goyal
b05a00a441 Adding a debug flag to prevent broken downlodas from getting removed during
restore

After setting this flag apps do not need to have an active settion during restore
which would simplyfy debugging backup-restore bugs.

Change-Id: I89f2d3ec677281887f8bab8559ace991709caadc
2016-08-29 11:19:26 -07:00
Sunny Goyal
cbfe71dba3 Checking for duplicate intent with proper source bounds.
Since we are doing a equality check on the intent, items which already have
the bounds attached to the intent will not get matched, causing duplicate
icons

Bug: 27176189
Change-Id: Ia9ed9120b04e9c234304995aed13777a5773119e
2016-08-23 13:27:38 -07:00
Sunny Goyal
86df138d9f Adding support for pending widgets in AutoInstall layout
> Pending widgets whill show a loading progress while the app
is being installed.
> Extra bind options can be defined using the tub tags
    <extra key="key-name" value="key-value" />
  These are sent as widget options when the widget is bound.
> If the widget has any config activity, it is not shown
> Required attributes:
   className, packageName, x, y, spanY, spanY & screen

Bug: 30279609
Change-Id: I1338618bfa5d86967339dffb68c12b1add6eb5d7
2016-08-16 12:37:29 -07:00
Sunny Goyal
95f3d6ba2c Reloading workspace when the shortcuts permission changes
> Check for permission on every onResume
> If the permission is different than last known permission,
reload and rebind workspace.

Bug: 30789422
Change-Id: Idfa445815e29e2336505779545507d106b33a253
2016-08-10 17:00:15 -07:00
Sunny Goyal
5f06401807 Fixing potential ConcurrentModificationException
mBgDeepShortcutMap is only accessed on the background thread. But
the same instance of list of values was getting passed to the UI
thread, instead of being cloned.

Change-Id: Ie7d0442d895304489ce9323ea872b9091d668ae5
2016-08-08 10:13:33 -07:00
Sunny Goyal
50941fb8a6 Adding support for updating the pinned shortcuts without updating
the ID map

Bug: 30654182
Change-Id: I30082bd87466a29b7bafe1e8cbf1446e1d1e4f3e
2016-08-04 12:32:11 -07:00
Sunny Goyal
49f4f03dc8 Handling IllegalStateException which can be thrown by the system when the user is locked
Bug: 30411561
Change-Id: I0d7fc0aaecba01b1aaac95b98654f6e3ee090ce8
2016-08-01 16:13:28 -07:00
Sunny Goyal
d3b87ef196 Adding quiet mode support for shortcuts
> LauncherApps returns empty list when the user is locked. Not relying on
LauncherApps in this case
> When the user is locked, removing all dynamic shortcuts
> Loading shortcuts from DB when the user is locked
> Verifying the shortcuts again when the user is available

Bug: 30411561
Change-Id: Ib6eb372c5b009cadb86a8f6e781f3f3cbf787ceb
2016-07-29 16:10:31 -07:00
Tony Wickham
ca258b36be Only add shortcuts to the deep shortcut map if they are dynamic/manifest.
Bug: 30475465
Change-Id: I93aff6330b86a3bfa3e6b5741ab759d835618f0b
2016-07-28 12:31:28 -07:00
Sunny Goyal
55f5bd730c Merge "Showing the shortcuts in the disabled state and removing ti from the menu when its disabled" into ub-launcher3-calgary 2016-07-28 19:23:29 +00:00
Sunny Goyal
70a7c9b700 Showing the shortcuts in the disabled state and removing ti from the menu
when its disabled

Bug: 30315906
Change-Id: Ice747e7be955d8bb2dd65191f7613e2afd4abc1c
2016-07-28 12:22:51 -07:00
Sunny Goyal
e34dd33156 Merge "Fading in the first screen, when launcher loads for the first time" into ub-launcher3-calgary 2016-07-28 19:13:17 +00:00
Tony Wickham
672d07f3f0 Check package name and user handle in onShortcutsChanged().
Otherwise shortcuts with the same id would be updated,
even if they were in different packages.

Bug: 28980830

Change-Id: Ideefe3aaac83af38c03a38d821bac192ae55fe67
2016-07-28 17:17:51 +00:00
Sunny Goyal
b5b9ad68b7 Fading in the first screen, when launcher loads for the first time
Bug: 29007436
Bug: 27705838
Change-Id: I95891d0bad19a67985b689bb96d6068dcd85004a
2016-07-28 10:13:30 -07:00
Sunny Goyal
10923b30a2 Removing shadow and badging from the icon which is shown in the menu
These are added as soon as the icon is added to the workspace

Bug: 28980830
Change-Id: I725d2ee8994324f09d9ecf7bbbb0090a7ceb5769
2016-07-26 14:18:09 -07:00
Sunny Goyal
860538df1d Fixing missing user check when updating shortcuts for an app
Change-Id: I889c555d3402fd71098af29b78eb6d959a071080
2016-07-20 15:04:23 -07:00
Tony Wickham
d82a39da1c Add status to DeepShortcutManager api calls.
This way we can handle SecurityExceptions differently. For instance,
if a SecurityException causes us to fail to get details for pinned
shortcuts, we keep the pinned shortcuts in the database so that they
will be loaded next time launcher has the correct permissions.

Change-Id: I1102fce612ade10ad7f577b44a99c8cf087d5ccd
2016-07-13 12:02:33 -07:00
Sunny Goyal
a5c8a9eb66 Adding logic to pull in workspace data from another Launcher3 based
provider. This allows OEMs to keep the user's homescreen intact while
changing the default home app package.

Bug: 28536314
Change-Id: Ibebfd7dd33aa2cbd9ca28d2d611dd0a4a5971444
2016-07-09 16:19:26 -07:00
Tony Wickham
80f5787b1c Call bindDeepShortcuts() from runBindSynchronousPage().
Otherwise Launcher's copy of the deep shortcut map is cleared when Launcher
is re-created, such as on rotation, so the UI won't show shortcuts.

Change-Id: I3bb6a904762dc4661cc2b5da28485e4bf778c9e7
2016-06-30 14:14:48 -07:00
Tony
acd86ff486 Surround shortcut API calls with try-catch.
Bug: 29732661
Change-Id: Iba96eedab67e7715f34139c64f96b1a81ba30ea5
2016-06-27 11:53:58 -07:00
Sunny Goyal
9994b2b171 Making some shortcut manager calls protected by MR1 version check
Change-Id: Ifdfa95a58aa18a825c1838c61055928dbe0ea3be
2016-06-23 14:55:56 -07:00
Tony Wickham
ec1b1c542c Merge "Add support for launcher shortcuts." into ub-launcher3-calgary 2016-06-22 20:35:31 +00:00
Tony Wickham
bfbf7f9f4a Add support for launcher shortcuts.
- This CL has no UI but provides the necessary backing for one.
- Adds new item type: ITEM_TYPE_DEEP_SHORTCUT, to distinguish from
  ITEM_TYPE_SHORTCUT. We can reconsider these names.
- Adds ShortcutCache, using LruCache for up to 30 dynamic shortcuts
  (pinned shortcuts are always cached in a HashMap).
- DeepShortcutManager queries for shortcuts and other things like
  pin them. In a future CL it will use the cache, but for now it
  simply makes an RPC for all queries.
- LauncherModel maintains counts for pinned shortcuts, pinning and
  unpinning when counts reach 1 or 0, respectively.
- LauncherModel maintains a map of components to lists of shortcut ids,
  which Launcher gets a copy of after it is changed in the background.
  This will allow us to know how many shortcuts an app has immediately,
  and query for details as the UI is animating.

Change-Id: Ic526f374dd10d72a261bae67f07f098fca8d8bca
2016-06-21 15:49:16 -07:00
Sunny Goyal
e26d1008eb Adding some tracing sections around launcher startup
Bug: 29007436
Change-Id: I53afd9130a2dc70a2223f1623e862faf44370f26
2016-06-20 15:56:22 -07:00
Sunny Goyal
bb011dad4e Adding a flag (enabled by default) to remove the all-apps button.
All apps can still be opened by clicking the caret.

Bug: 29398447
Change-Id: I61f1b05cea83a0a49d7cc16c518c5419618ba779
2016-06-17 08:17:22 -07:00
Sunny Goyal
a9e2f5abb3 Adding a DB update path to handle the QSB position change
> Renamed the id of 1st screen to 0 and making space for the QSB
by running the grid migration task.
> Added a feature flag to easily disable the QSB-in-workspace behavior

Change-Id: Ie3369f0d4433d916e9d6215d414770d4333f3e26
2016-06-15 10:03:12 -07:00
Sunny Goyal
da4fe1a624 Moving the QSB to the workspace grid.
The QSB will only be resent on the first screen of the workspace
covering the full width of the first row. If will not be movable.
The first screen of the workspace will not be movable.
The searchDropTargetBar no longer contains the QSB (it can be
renamed in aseparate cl).

Refactoring all QSB related logic by moving it to a custom view
inflated only using xml.
Change-Id: Icb4fd6eb855df1af15f685961c38351bf4fd4f4a
2016-05-27 18:23:29 -07:00