Commit Graph
2909 Commits
Author SHA1 Message Date
Alastor Wu c53b1c7eb6 Bug 1357639 - part3 : change audio focus state before notifying observers. r=sebastian
Notify observer might cause the method (notifyStoppedPlaying) is called by C++ side,
and we should change our internal state before calling the method.

MozReview-Commit-ID: 5xNXhGmAIrR
2017-05-04 15:19:44 +08:00
Alastor Wu a80dc4c53b Bug 1357639 - part2 : use enum for audio focus states. r=sebastian
MozReview-Commit-ID: KE6QuuF8xWm
2017-05-04 15:19:41 +08:00
Alastor Wu 30aee4ee22 Bug 1357639 - part1 : change tab's media playing state when the tab is controlled by media control. r=sebastian
MozReview-Commit-ID: 7CNbMdCJT3K
2017-05-04 15:19:39 +08:00
Jim Chen 4c6bfb07c5 Bug 1365485 - Remove GeckoInterface.getDefaultChromeURI; r=droeh
Add getChromeUri/setChromeUri APIs to GeckoView, to allow each
GeckoView's chrome URI to be set individually. This lets us remove
GeckoInterface.getDefaultChromeURI. This patch also changes the default
chrome URI to the GeckoView default, and let Fennec specify its chrome
URI (browser.xul) inside GeckoApp.

MozReview-Commit-ID: Gkwbp8VyLcu
2017-05-18 18:09:20 -04:00
Jim Chen b42c3eb58c Bug 1365360 - Remove GeckoInterface.setAccessibilityEnabled; r=snorp
Instead of calling GeckoInterface.setAccessibilityEnabled, let
GeckoAccessibility dispatch an "Accessibility:Enabled" event to let
BrowserApp know whether accessibility is enabled or not.

MozReview-Commit-ID: 9ntRP5Pc3lX
2017-05-18 18:09:20 -04:00
Jim Chen 338365274d Bug 1365127 - Move history accessors from GeckoAppShell to GlobalHistory; r=droeh
Move checkUriVisited, markUriVisited, and setUriTitle from
GeckoApp/GeckoAppShell to GlobalHistory. Make them static and directly
accessible from native code, so that we can remove those methods from
GeckoInterface.

MozReview-Commit-ID: JrmlfeKibaW
2017-05-18 18:09:16 -04:00
Jim Chen ae86dd6998 Bug 1365126 - Move shortcut creation to static methods in GeckoApplication; r=droeh
Move shortcut creation code in GeckoApp to GeckoApplication, and make
the methods static so that we can call them without a GeckoInterface
instance. This lets us remove GeckoInterface.createShortcut.

MozReview-Commit-ID: AUnQGI02Bk
2017-05-18 18:09:05 -04:00
Jim Chen f91a210834 Bug 1365122 - Move launchOrBringToFront from GeckoAppShell to GeckoApp; r=droeh
Move GeckoAppShell.launchOrBringToFront to GeckoApp, so that we can use
GeckoActivityMonitor to check whether BrowserApp is the current
foreground Activity. This lets us remove GeckoInterface.isForegrounded.

MozReview-Commit-ID: CgjnaNK8OGW
2017-05-18 18:09:04 -04:00
Jim Chen dd81a7a381 Bug 1365124 - 2. Remove GeckoInterface.invalidateOptionsMenu; r=me
invalidateOptionsMenu is no longer called through GeckoInterface, so we
can safely remove it. r=me for trivial patch.

MozReview-Commit-ID: CFYWNq1KVc
2017-05-18 17:40:32 -04:00
Jim Chen c9dc4d3a5f Bug 1365124 - 1. Remove GeckoInterface.areTabsShown; r=me
Remove areTabsShown because it is never called through GeckoInterface.
r=me for trivial patch.

MozReview-Commit-ID: 35L4jpnJqk4
2017-05-18 17:40:32 -04:00
Jim Chen b489c2eaf7 Bug 1365120 - Add WakeLockDelegate; r=rbarker
Add and use WakeLockDelegate within GeckoView code to replace the
notifyWakeLockChanged method in GeckoInterface. Fennec will use the
default implementation in GeckoView, while GeckoView users are free to
override the default implementation through
GeckoAppShell.setWakeLockDelegate.

MozReview-Commit-ID: I8S8q2RZRMu
2017-05-18 17:40:32 -04:00
Jim Chen 64079bb16a Bug 1363457 - 2. Remove GeckoApp.getEventDispatcher(); r=droeh
Use the current Activity to derive GeckoApp instances in tests, so we
no longer need GeckoApp.getEventDispatcher() at all.

Also refactor some code for getting an Activity from Context in
FindInPageBar and FormAssistPopup.

MozReview-Commit-ID: H1QNbtt9dB1
2017-05-18 17:40:32 -04:00
Jim Chen 3d48123300 Bug 1363457 - 1. Remove GeckoInterface.getAppEventDispatcher(); r=me
Remove GeckoInterface.getAppEventDispatcher(), which is actually no
longer called by anyone. r=me for trivial patch.

MozReview-Commit-ID: ILjiyMuPwEB
2017-05-18 17:40:31 -04:00
Andrzej Hunt fc52441f68 Bug 1356693 - infer: fix RESOURCE_LEAK's in base r=walkingice
MozReview-Commit-ID: Gm9GqOk37UZ
2017-04-19 08:26:38 -07:00
Andrzej Hunt d53d83cd70 Bug 1356693 - Pre: add comment explaining why MergeCursor can't handle null cursors r=Grisha
MozReview-Commit-ID: CGwMi9LKYTj
2017-04-28 08:38:41 +08:00
Jan Henning 709a12546b Bug 1353857 - Include the tab ID when notifying about leaving/entering a web app's scope. r=daleharvey,walkingice
We only want to process the AppEntered/Left message if it actually concerns our currently displayed tab.

MozReview-Commit-ID: EJ8RzRzDNAz
2017-04-17 16:37:58 +02:00
Jan Henning 5dd5071766 Bug 1351808 - Part 2 - Exclude non-standard tab types from session store. r=sebastian
Restoring anything other than normal browsing tabs (e.g. custom tabs, web apps) is more involved because those tabs
- don't appear in our normal tabs UI
- are opened in separate activities
- when we're starting up, Android's task switcher might or might not still have available task entries corresponding to such tabs from the last session

Therefore, for now, the session store will simply exclude those kinds of tabs from being saved in the session store data.

Instead of a real restore, if the corresponding tab has been closed or Gecko stopped running, we just recreate the custom tab/web app based on the stored Activity intent data we have available (bug 1352997).
Tab zombification while Gecko is running however remains fully supported, as we continue collecting session history data for all tab types, even if we don't necessarily save it to disk.

Because custom tabs/web apps currently still share a common Gecko browser window with normal tabs, we also have to modify our selected tab tracking logic accordingly, so that selecting one of these special tab types doesn't overwrite the last selected normal browsing tab.

To that effect, we now track the selected tab *ID* in memory and only convert that to a tab index when writing the data to disk. As the ID remains stable while Gecko is running, this makes tracking changes for a sub-group of tabs only easier, as we don't have to watch out for closing tabs of *any* kind affecting the tab index of everything behind them.

Bug 1346008#c3 has some preliminary ideas on how session restoring for custom tabs/web apps could be made to work.

MozReview-Commit-ID: 1q5Jtv0DKrE
2017-04-08 13:43:09 +02:00
Jan Henning 9a42cb6409 Bug 1352997 - Part 7 - Don't switch activities if we're closing a tab while exiting the activity. r=sebastian,walkingice
Closing the currently selected tab will select another tab, which can trigger an activity switch if the tab types differ. We don't want that if we're about to close the activity, as that'll bring that activity into the foreground instead of simply walking back along the activity history stack.

To give an example: Without this patch, closing the last custom tab will select a normal browsing tab, which will trigger an activity switch, so instead of returning to the user's previous activity, pressing back will send us to BrowserApp.

There's one additional catch:
If we change our onDone() behaviour and no longer finish() the SingleTabActivity when exiting (in order to avoid a costly restart of Gecko should the user return to us soon), this means that the activity that has just been exited could be brought back into the foreground via the onResume() codepath.

In that case the mLastActiveGeckoApp-check won't be triggered if no other GeckoApp-based activity was active in the meantime, so we wouldn't reselect/reopen the activity's desired tab, but instead display the tab that was selected when closing the previous tab. Therefore, we track this via an additional flag that is set for this case.

MozReview-Commit-ID: 3jOvBXQUrfo
2017-04-14 19:58:09 +02:00
Jan Henning 8903beb338 Bug 1352997 - Part 6 - Switch over web apps and implement additional startup logic for them. r=sebastian,walkingice
Web Apps are single task activities, but Android's task switcher will only ever return the intent that originally created the activity and will never ever update its stored intent for subsequent launches via onNewIntent, so we have to do this ourselves.

Additionally, web apps have some additional logic when being launched via a new intent that checks whether the currently loaded page matches the scope of the web app intent and then resets it if necessary. We now hook up this logic to the new SingleTabActivity wiring.

MozReview-Commit-ID: 9bo4gXbfPNg
2017-04-04 21:50:33 +02:00
Jan Henning ab33946bd2 Bug 1352997 - Part 5 - Implement common behaviour for custom tabs/web apps and switch over the former. r=sebastian,walkingice
This implements the common behaviour for restoring the correct tab when switching to/from custom tab and web app activities. Unlike our normal UI, those activities are basically single tab activities, that is each activity is linked to a certain Gecko tab, with no facilities (bugs aside) for the user to directly load/select a different tab within that activity.

Therefore, here we basically update the selected tab only when the activity is starting up and initially creating its new (or, especially once tab type switching will be implemented, taking over an existing) content tab.

When subsequently restoring, we then check whether the tab is still available. If it is, we select it, if not, we fall back to opening a new tab based on the available intent data.

This also means that we no longer have to finish() the activity on closing so the activity state (finished) matches the tab (closed), which means that we no longer have to prematurely kill Gecko as a side effect of that.

MozReview-Commit-ID: KjFz1qrqWLy
2017-04-08 19:19:32 +02:00
Jan Henning 832cf6a240 Bug 1352997 - Part 4 - Remember the tab selected by session restoring if somebody other than BrowserApp is starting up first. r=sebastian,walkingice
The first activity to run triggers Gecko startup and therefore session restore. Since the selected tab stored in the session file is only of interest for BrowserApp, we need to store it somewhere safe if some other activity (e.g. custom tab/web app) starts up first.

This is because currently everything needs to share the same Gecko browser window, so those other activities selecting a tab of their own when starting up will necessarily override session restore's tab selection.


MozReview-Commit-ID: 9GwTDbzgWF9
2017-04-08 19:15:19 +02:00
Jan Henning bcf91f0d9c Bug 1352997 - Part 3 - Re-implement tracking of last selected tab for BrowserApp. r=sebastian,walkingice
Currently, we basically take a snapshot of the currently selected tab when pausing an activity and then later re-select that tab ID when switching back from another activity within our application. In practice, this doesn't seem entirely fool-proof, so when switching between our normal UI (BrowserApp) and custom tabs or web apps we can eventually end up with the wrong tab being selected in the wrong activity.

In this part, we'll rip out the current code and replace it by a new implementation for BrowserApp - following parts will then cover custom tabs and web apps.

As BrowserApp is our normal tabbed browsing interface, we can simply track all tab switches for BROWSING-type tabs as they happen, which ensures that our data is always up-to-date.

Because tab IDs remain unique only within the same application session and are reused if we're terminated and then later restart, we need to take additional precautions to make sure we're really selecting the correct tab object - the savedInstanceState can carry even across (OOM-)kills. Therefore we now additionally also store and compare the current per-session UUID to make sure that the tab we're trying to select is really the same one it was when the activity was last running.

For BrowserApp caring about this is less important because on a full startup, the selection behaviour will be overridden by session restore anyway (although we can still hit it if only BrowserApp gets destroyed while Gecko keeps running, or if BrowserApp is launched after some other activity has already loaded Gecko), but it'll be quite relevant for web apps and custom tabs which don't have that benefit.

As it stands, this patch temporarily breaks behaviour around activity restoring for custom tabs/web apps, but tearing the old implementation out in one go was easier and the patch needs to be split somewhere.

MozReview-Commit-ID: I0Tq9XZGvpV
2017-04-08 22:55:10 +02:00
Jan Henning e420adebbe Bug 1352997 - Part 2 - Provide dedicated methods for typical homepage operations. r=sebastian,walkingice
That is figuring out whether a homepage has been set (but not caring about the specific page), or else getting the homepage URL with an automatic fallback (to about:home) if no homepage has been set.

MozReview-Commit-ID: D6Uy3A4P4Qc
2017-04-09 19:30:21 +02:00
Jan Henning 79ec803b38 Bug 1352997 - Part 1 - Register GeckoApp's onTabsChangedListener earlier. r=sebastian,walkingice
For BrowserApp we want to switch the last selected tab tracking to use tab selection events instead, so we need to register the listener earlier in order to catch the initial selection of the startup tab as well.

MozReview-Commit-ID: F7luIE6oNK
2017-04-08 11:16:13 +02:00
Jan Henning 74fc2fe768 Bug 1351739 - Part 6 - Finish the WebAppActivity when closing via onDone. r=sebastian,walkingice
Custom and web app tabs behave as any other externally launched URLs, that is pressing the back button closes not only the activity, but the tab as well when reaching the beginning of session history. Therefore, we should finish the activity in this case (just as the CustomTabsActivity already does), so the next launch runs through the onCreate code path and opens a new tab again.

MozReview-Commit-ID: 14AhWkmb5O7
2017-04-02 15:43:31 +02:00
Jan Henning 23d92edb83 Bug 1351739 - Part 5 - Implement activity switching for web apps. r=sebastian,walkingice
Differences to custom tabs:
- We don't have to store the full intent, just storing the manifest path is enough.
- Akin to the LauncherActivity we have to route the request to the correct WebAppActivity instance depending on the manifest path.

We also have to modify the intent handling when GeckoApp is starting up - the intent handling of the GeckoApp + BrowserApp combo requires "nulling" out (by setting it to ACTION_MAIN) the current intent if it's not a fresh intent (e.g. the activity is recreated after having been destroyed or relaunched from the task switcher).

For web apps on the other hand we want to keep the intent around even in those cases, as it contains state we need even later on. Additionally, we want to make use of GeckoApp's startup code for either selecting the tab from the intent or loading a new tab. Therefore we save the launch intent and restore it once GeckoApp's onCreate() has run.

Note that this solution is not entirely correct either, because with this each onCreate() call will open a new tab, even when this is not necessary when only the activity (but not Firefox and Gecko as a whole) had been destroyed. This behaviour will be fixed as part of bug 1352997.

This approach is also a bit different than the one chosen in bug 1351605 for custom tabs, which was independently developed in parallel. Bug 1352997 will unify this, too.

MozReview-Commit-ID: 94uZ3c8CUVD
2017-04-02 18:26:45 +02:00
Jan Henning 55f91d51df Bug 1351739 - Part 3 - Switch activities when a custom tab is selected/unselected. r=sebastian,walkingice
On tab selection, the Tabs instance now checks whether the type of the tab to be selected matches the currently running activity. If it doesn't, the tab switching is aborted and instead, an intent for the correct activity is sent. When the new activity launches, it finds that the intent also includes a tab ID, which means that instead of opening a new tab we retry the tab selection, which will then succeed now that we're in the correct activity.

Because for custom tabs the launch intent can contain all sorts of customisations, we now have to save the intent when a custom tab is opened for the first time, so that later on, when switching e.g. from BrowserApp back to a custom tab we can use the correct intent to launch the custom tab activity.

MozReview-Commit-ID: KWdkweKBocz
2017-04-08 23:10:51 +02:00
Jan Henning 2df85dd781 Bug 1351739 - Part 2 - Convert CustomTabsActivity to SafeIntents. r=sebastian,walkingice
These are potentially untrusted external intents, so we should use SafeIntents for interacting with them.

MozReview-Commit-ID: 3nmjg85wbr1
2017-04-02 14:09:36 +02:00
Jan Henning fae93e321f Bug 1351739 - Part 1 - Track the currently active activity. r=sebastian,walkingice
Required because later on, we'll need to know if we're in the correct activity for a tab or need to switch activities.

As a follow-up, we can later also hook up our current manual activity tracking from GeckoApplication to this (we most probably won't be able to get rid of the GeckoActivityStatus shenanigans, though).

MozReview-Commit-ID: 5lZrAMsB9Gy
2017-04-02 11:22:12 +02:00
Jan Henning 6c68386e49 Bug 1351739 - Part 0 - Use INVALID_TAB_ID more. r=sebastian,walkingice
-1 is probably not all that mysterious as far as magic numbers go, but still...

MozReview-Commit-ID: zK3P6HeWzK
2017-04-06 21:30:55 +02:00
Jan Henning 4f418c3e10 Bug 1351739 - Part -1 - Housekeeping. r=sebastian,walkingice
MozReview-Commit-ID: Ev6jl4N3K0g
2017-04-07 20:51:41 +02:00
Sebastian Hengst 95767c972a Backed out changeset 4aa74fee0d37 (bug 1351808) 2017-04-27 20:33:03 +02:00
Wes Kocher e8b333b815 Backed out changeset 9ce0883ffd62 (bug 1353857) because a dependent bug failed to land a=backout
MozReview-Commit-ID: GuGF9G3KmS6
2017-04-27 11:25:22 -07:00
Jan Henning 46ece69a8f Bug 1353857 - Include the tab ID when notifying about leaving/entering a web app's scope. r=daleharvey,walkingice
We only want to process the AppEntered/Left message if it actually concerns our currently displayed tab.

MozReview-Commit-ID: EJ8RzRzDNAz
2017-04-17 16:37:58 +02:00
Jan Henning 4952395188 Bug 1351808 - Part 2 - Exclude non-standard tab types from session store. r=sebastian
Restoring anything other than normal browsing tabs (e.g. custom tabs, web apps) is more involved because those tabs
- don't appear in our normal tabs UI
- are opened in separate activities
- when we're starting up, Android's task switcher might or might not still have available task entries corresponding to such tabs from the last session

Therefore, for now, the session store will simply exclude those kinds of tabs from being saved in the session store data.

Instead of a real restore, if the corresponding tab has been closed or Gecko stopped running, we just recreate the custom tab/web app based on the stored Activity intent data we have available (bug 1352997).
Tab zombification while Gecko is running however remains fully supported, as we continue collecting session history data for all tab types, even if we don't necessarily save it to disk.

Because custom tabs/web apps currently still share a common Gecko browser window with normal tabs, we also have to modify our selected tab tracking logic accordingly, so that selecting one of these special tab types doesn't overwrite the last selected normal browsing tab.

To that effect, we now track the selected tab *ID* in memory and only convert that to a tab index when writing the data to disk. As the ID remains stable while Gecko is running, this makes tracking changes for a sub-group of tabs only easier, as we don't have to watch out for closing tabs of *any* kind affecting the tab index of everything behind them.

Bug 1346008#c3 has some preliminary ideas on how session restoring for custom tabs/web apps could be made to work.

MozReview-Commit-ID: 1q5Jtv0DKrE
2017-04-08 13:43:09 +02:00
Carsten "Tomcat" Book eb1595e913 Merge mozilla-central to autoland 2017-04-27 16:36:41 +02:00
Carsten "Tomcat" Book 8967bbc269 Backed out changeset 76c560e8d908 (bug 1356693) 2017-04-27 15:19:55 +02:00
Carsten "Tomcat" Book 5c578703fa Backed out changeset 8b672583d57c (bug 1356693) 2017-04-27 15:19:53 +02:00
Nevin Chen 92197d880b Bug 1329156 - Add telemetry for customtab customization usage. r=walkingice
MozReview-Commit-ID: EJrFzvHOqOU
2017-04-26 13:37:38 +08:00
Andrzej Hunt 5dd7e436c4 Bug 1356693 - infer: fix RESOURCE_LEAK's in base r=walkingice
MozReview-Commit-ID: Gm9GqOk37UZ
2017-04-19 08:26:38 -07:00
Andrzej Hunt cf917b4822 Bug 1356693 - Pre: MergeCursor can handle null cursors r=Grisha
MergeCursor can handle null cursors (and is lightweight), we
don't need to specifically handle each case - which results in simpler
code.

MozReview-Commit-ID: CGwMi9LKYTj
2017-04-27 11:57:41 +08:00
Michael Kaply d40d38bc89 Bug 1357121 - Allow dashes and underscore in OTA distribution name. r=nalexander
MozReview-Commit-ID: 9PchGiKPGLi
2017-04-17 13:11:43 -05:00
Carsten "Tomcat" Book 8eb146d908 Merge mozilla-central to autoland 2017-04-26 09:08:31 +02:00
Carsten "Tomcat" Book dc7e8b78ef merge mozilla-inbound to mozilla-central a=merge 2017-04-26 08:41:31 +02:00
Carsten "Tomcat" Book 00da9b8f70 merge autoland to mozilla-central a=merge 2017-04-26 08:40:02 +02:00
Wes Kocher 1bb3fcd58a Merge inbound to m-c a=merge
MozReview-Commit-ID: A85cs7Yriqj
2017-04-25 13:53:00 -07:00
Dale Harvey 6e14aa23b9 Bug 1355676 - Check for nulls when decoding icons. r=sebastian 2017-04-25 16:53:29 +01:00
Randall Barker cf39f6d7d1 Bug 1358805 - part 4: Allow custom tabs to pin the dynamic toolbar r=droeh
MozReview-Commit-ID: BXoLU0BGrZq
2017-04-25 15:13:59 -07:00
Randall Barker 11c2920ea2 Bug 1358554 - On Android devices that use static action bar prevent content from sliding down after a long press r=jchen
Only show real toolbar chrome for fixed action bar. Showing the static
snapshot causes the content to shift.

MozReview-Commit-ID: D4EN8qbe8Fu
2017-04-25 09:54:28 -07:00
Jan Henning 6035ba2330 Bug 1357579 - Correctly copy the sparse Boolean array when clearing Site Settings. r=ahunt
The checked items are stored in a *sparse* Boolean array, which we want to transform into an array (list) of the checked indices for transmission to Gecko.

The current approach doesn't do this correctly, as it iterates over all (sparse and non-sparse) items, but uses SparseBooleanArray.size() (which only counts non-sparse items) as its iteration limit. This means that we only copy the checked state of the first n items, where n is the total count of checked items.

For correctly iterating over the array to retrieve all indices that are true, we'd either have to use the largest available key (if we'd want to iterate over everything, including the sparse indices), or else use the approach chosen in this patch, namely using valueAt/keyAt in order to iterate over the internal array that's storing the values for all non-sparse indices.

MozReview-Commit-ID: FRGI4Rr0uCb
2017-04-21 22:53:19 +02:00