Commit Graph
21 Commits
Author SHA1 Message Date
Mygod 84ac2b06fa Refine #530 again
Have. To. Do. More. Refinements.

Here's what happened in the buggy versions: (I think)

* `BootReceiver` starts which invokes `Utils.startSsService` which starts `ShadowsocksRunnerService`;
* `ShadowsocksRunnerService` binds to `BaseService`;
* 1s after it's connected, it invokes `bgService.use` which returns immediately after pushing `use` in the queue since it's an oneway method;
* Then `stopSelf` => `detachService`, `BaseService` now have nothing bound to it and not started either (neither foreground nor background), so the system can destroy it any time; (at this point, `BaseService.use` isn't invoked yet)
* `com.github.shadowsocks` process then probably exits since booting is a resource-heavy task, anyway it doesn't matter;
* Some time later `com.github.shadowsocks:bg` resumes running, and `BaseService` is stopped and destroyed. Now the system is no longer aware of this `BaseService` instance but it isn't garbage collected yet;
* `use` is finally invoked;
* `startService` is invoked in `startRunner` and the destroyed background service starts running; (bug of Android?)
* `startForeground` is invoked in `ShadowsocksNotification` but the system probably refused it since the service itself is already destroyed;
* When the main activity UI is brought up and requests binding, `com.github.shadowsocks:bg` which is unaware of the existing instance of `BaseService` creates another `BaseService` and thus everything gets messed up.

This commit fixes this by invoking `getState` (which isn't an oneway method) immediately after `use` so that `ShadowsocksRunnerService` will wait for `BaseService` to start itself before destroying itself and its connection to `BaseService`. And thus its return value is not used.
2016-07-11 19:22:54 +08:00
Max Lv 556d8d78bd Revert "Refine #530"
This reverts commit 56de231c4f.
2016-07-09 08:59:13 +08:00
Mygod 56de231c4f Refine #530 2016-06-17 17:59:12 +08:00
Mygod 89df2bc715 Hide stop action in notification if the quick settings tile is present 2016-06-17 14:40:33 +08:00
Mygod 28ea9dd807 Use app.* instead of ShadowsocksApplication.*
Because typing ShadowsocksApplication is quite troublesome.
2016-05-24 11:37:33 +08:00
Mygod 985b3a6b7d Fix #649 2016-04-19 15:19:09 +08:00
Mygod 7d9686b5b5 UI fixes
* Refine exceptions handling when parsing per-app config string

* Remove redundant profiles Preference

* Move Network Traffic to title bar

* Add ripple to title text

* Animate using animateLayoutChanges

* Hide connection test in NAT mode

* Refine UI.

* Change notification action button icon for hidpi device

* Fix FAB ripple

* Fix usability problem

* Fix changes not commited when snackbar being swiped

* Show import/export as action

* Drop unused drawables

* Move TaskerSettings

* Fix action icons

* Prevent switching to an invalid profile

* Fix line wrap when screen width is small
2016-04-04 13:41:31 -07:00
Mygod 16e39f8b6c Hide quick switch if there's nothing to switch 2016-03-12 15:28:23 +08:00
Lucas Liu 7c5efdaa82 Add quick switch from notification. 2016-03-12 01:13:03 +08:00
Max Lv 187cb28d15 Fix an issue of NAT mode
If call notify() after startForeground() on the same notification id, the
service becomes not that "foreground" and would be killed by system if the
activity is removed from the recent list.
2016-01-30 14:01:46 +08:00
Max Lv dc840fd0e9 Fix #517 2016-01-06 15:28:44 +08:00
Mygod f9667d767e Fix dynamic traffic stat in profile selector
Fix #495
2015-12-29 20:27:30 +08:00
Mygod fd01712b6c Reduce battery usage - use notify instead of startForeground 2015-12-26 17:14:47 +08:00
Mygod 873560be7e Remove redundant string resource 2015-12-03 14:12:58 +08:00
Mygod b0180fb9a1 Fix notification not updated when service is started and the screen is off 2015-12-01 21:47:35 +08:00
Mygod d9179fcc9a Fix ShadowsocksNotification 2015-11-29 18:34:43 +08:00
Mygod 1eda4c47a4 Removed the switch for now 2015-11-24 21:41:09 +08:00
Mygod c1730e4fa6 Add a toggle for showing traffic in notification.
TODO: Disabling it causes weird behavior. :-(
2015-11-24 21:16:08 +08:00
Mygod 9fa57dfe4b Refine service_running string 2015-11-24 19:28:31 +08:00
Mygod 5e0d52324b Add traffic to notification 2015-11-24 19:25:41 +08:00
Mygod 99a6c4ff3e Extract notification logic 2015-11-24 18:11:14 +08:00