Commit Graph

487 Commits

Author SHA1 Message Date
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
Sunny Goyal
ff4ba2d995 Refactoring out grid occupancy management in a separate class
Change-Id: I37a830c0f2eb0a0dd4f5fc78fa29127cb18cb3c2
2016-05-27 09:12:26 -07:00
Sunny Goyal
ded0fdba52 Removing logic for workspace migration from Launcher2
Change-Id: I8a121d74862f665c58406f8d5c7eb1263e7ccff3
2016-05-23 16:00:09 -07:00
Sunny Goyal
1acb9e9e29 Rearranging the provider checks to avoid packagemanager lookups
whenever launcher starts

Bug: 28737985
Change-Id: I3ce3e2741b3224fa5419d7ceca496e1bb91f065c
2016-05-18 09:41:27 -07:00
Sunny Goyal
aaf7d1d13b instead of unbinding items from the loader, unregistering listeners
in activity.onDestroy()

Bug: 28740269
Change-Id: I6bf2ad6aca43970fd10cfbcc113e609c227e07bf
2016-05-17 14:42:10 -07:00
Sunny Goyal
eb4b79935e Removing icon_type column
Icon type is not used consistently. It is used initially
during the loader. Afterwards, we save both the icon and resource to the db.
Instead of changing the logic to always read the shortcut-resource first, and fallback to the bitmap if the resource is not available,
always write the bitmap to DB whenever the shortcut is edited.

Change-Id: I0ea5e88f8904bd3250ca669220b3e5d6aeef1bfd
2016-05-11 15:21:42 -07:00
Sunny Goyal
713edfce26 Adding a utility class for persistant logging.
The logs are kept for at max 48 hours. It uses two log files and switches
between the two based on the day of the year.

Change-Id: I9a99499b3445a62f29f62a5cd13db20b1783bcd3
2016-05-09 12:47:42 -07:00
Sunny Goyal
d09c37052e Removing dependency on getApplicationInfo method added in N
This method is goiing away. We don't need this method anyway
since LauncherActivityInfo already has the information

Change-Id: Ic6afa1df14958b894925d730e01a2e2d2a6fb98c
2016-04-07 11:38:10 -07:00
Sunny Goyal
c52ba71005 Fixing folder icon not getting redrawn when the contents change
> Removing parent from ItemOperator as inconsistant values were
being passed in workspace and folderPagedView
> Fixing itemChanged causing multiple redraws, by passing a
'animate' parameter to explicitely request animation

Bug:27740161
Bug:28015426

Change-Id: Ide7b266bde9aad5f450a3f808a59182fe01a5110
2016-04-06 12:46:36 -07:00
Sunny Goyal
e1f1c34c09 Merge "Fixing bug where folders on the first screen and hotseat are not registered by the Launcher if there are folders on other screens" into ub-launcher3-calgary 2016-04-06 00:49:22 +00:00
Rubin Xu
ac6e5d7956 Listen on new broadcasts for profile changes.
The change is due to API review comments on the platform side.

Bug: 27532254
Change-Id: I44133fbb5c3ee13d0523a72b25d2e1c5d1eba6a0
2016-04-04 16:13:35 +01:00
Sunny Goyal
44c06437e2 Fixing bug where folders on the first screen and hotseat are not
registered by the Launcher if there are folders on other screens

Instead of maintaing a static map of folder items, searching it
in the workspace during item removal.

Change-Id: I8aa93b3aa1d0bd812204471e3103f4bd29d1cd3d
2016-04-02 11:00:56 -07:00
Sunny Goyal
8ab8fe9441 Merge "No need to differentiate package event into app or updated based on a package is being updated or not" into ub-launcher3-calgary 2016-04-01 22:51:54 +00:00
Tony Wickham
6ed21eebb4 Merge "Added ColorExtractionService and ExtractedColors." into ub-launcher3-calgary 2016-04-01 22:44:58 +00:00
Tony Wickham
827cef203f Added ColorExtractionService and ExtractedColors.
- Launcher has an instance of ExtractedColors, which is loaded from
  LauncherProvider in onCreate() and whenever the wallpaper changes.
  - When the wallpaper changes, the ColorExtractionService is started
    in the :wallpaper-chooser process.
  - ColorExtractionService builds an ExtractedColors instance and saves
    it as a String in LauncherProvider.
  - When the results are saved, Launcher gets a callback through
    LauncherProviderChangeListener and reloads the ExtractedColors.
- Whenever Launcher loads Extractecolors, it also re-colors items
  (currently a no-op).

Change-Id: I319e2cfe0a86abcbc6bb39ef6b9fbbcad54ad743
2016-04-01 15:40:57 -07:00
Sunny Goyal
93f878c168 Fixing the loader to bind the first screen as well as the hotseat together
When the loader ran for the first time (or when called due to force-reload),
it was binding with page = -1 (invalid pageId is -1001). This was causing loader
to assume the workspace to be on a valid screen, and causing the loader to
only bind the hotseat first.

Bug: 27705838
Change-Id: Ia8eb2543d8cee1268256b2d6bccf33828937c54a
2016-03-30 18:24:07 -07:00
Sunny Goyal
144154d435 No need to differentiate package event into app or updated based on
a package is being updated or not

Package update handling is a super set of package add handling  which
also updates the all-apps and package disabled state.
This also prevents addtion of a home screen icon when a managed profile
app on SD card become available.

Bug: 27877926
Change-Id: I9264e422fd30b94ce6ebb2e5adea820b3cda3063
2016-03-30 16:51:12 -07:00
Sunny Goyal
17763cb1d2 Fixing debug log
Change-Id: I85c1f7707a3ea9cae2701aa781b74d758602f643
2016-03-24 13:58:35 -07:00
Sunny Goyal
da891c1a22 Instead of reloading the launcher, updating items dynamically when
Quiet mode changes

Bug: 27632028,27763316
Change-Id: I55f018e855448df0abcbf4fd0fcb39344594980c
2016-03-24 12:19:29 -07:00
Sunny Goyal
3bbbabc54a Fixing model being updated on UI thread
> When package gets unavailable or suspended, the disabled flag was getting
updated on the UI thread. This could lead to inconsistent model if launcher
activity didn't exist.
> Fixing: When unsuspending one work profile apps, all work profile apps get
unsuspended

Bug: 27673573,27673373,27403236
Change-Id: I7fde3f79c36204e73ca66ccf8431fa0f0cce3d08
2016-03-18 15:13:28 -07:00
Sunny Goyal
2e1efb480a Changing the widget loading strategy
Widget is loaded only when the user enters the overview mode and we keep
the list updated as long as the user is in the overview mode. Once the user
leaves the overview mode, we stop responding to widget updates

Bug: 26077457
Change-Id: I9e4904b8f1300bfe0d77e2bc5f59aa6963fad8d1
2016-03-09 20:21:22 -08:00
Sunny Goyal
261194387b Revert "Reverting refactoring of Folder and FolderIcon to avoid dependencies breakage"
This reverts commit fc956e5a2a.

Change-Id: Ib3b5156b8fc3cad35c4634d61d5390c848ce1f93
2016-02-23 02:02:54 +00:00