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
2016-07-03 17:27:50 +08:00
2016-07-11 19:22:54 +08:00
2016-07-03 18:37:09 +08:00
2016-07-01 14:40:40 +08:00
2015-11-07 10:43:51 +08:00
2016-07-06 13:32:03 +08:00
2016-07-06 13:34:34 +08:00
2016-06-17 16:22:05 +08:00
2016-07-06 12:54:59 +08:00
2015-07-24 18:56:01 +08:00
2016-05-20 20:26:58 +08:00
2013-05-20 16:13:03 +08:00
2013-05-06 18:59:28 +08:00
2016-06-17 16:16:21 +08:00
2014-02-22 17:34:18 +08:00
2014-02-25 10:22:51 +08:00
2014-06-08 12:45:32 +08:00

Shadowsocks for Android

A shadowsocks client for Android, written in Scala.

CI STATUS

Build Status

PREREQUISITES

  • JDK 1.8
  • SBT 0.13.0+
  • Android SDK r25+
  • Android NDK r10d+

BUILD

  • Set environment variable ANDROID_HOME to /path/to/android-sdk
  • Set environment variable ANDROID_NDK_HOME to /path/to/android-ndk
  • Create your key following the instructions at https://developer.android.com/studio/publish/app-signing.html
  • Put your key in ~/.keystore
  • Create local.properties from local.properties.example with your own key information
  • Invoke the building like this
    git submodule update --init
    
    # Build the App
    sbt native-build clean android:package-release

BUILD on Mac OS X (with HomeBrew)

  • Install Android SDK and NDK by run brew install android-ndk android-sdk
  • Add export ANDROID_HOME=/usr/local/Cellar/android-sdk/$version to your .bashrc , then reopen the shell to load it.
  • Add export ANDROID_NDK_HOME=/usr/local/Cellar/android-ndk/$version to your .bashrc , then reopen the shell to load it.
  • echo "y" | android update sdk --filter tools,platform-tools,build-tools-23.0.2,android-23,extra-google-m2repository --no-ui -a
  • echo "y" | android update sdk --filter extra-android-m2repository --no-ui --no-https -a
  • Create your key following the instructions at http://developer.android.com/guide/publishing/app-signing.html#cert
  • Put your key in ~/.keystore
  • Create local.properties from local.properties.example with your own key information .
  • Invoke the building like this
    git submodule update --init

    # Build native binaries
    ./build.sh

    # Build the apk
    sbt clean android:package-release

OPEN SOURCE LICENSES

LICENSE

Copyright (C) 2016 by Max Lv <max.c.lv@gmail.com>
Copyright (C) 2016 by Mygod Studio <mygodstudio@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

S
Description
No description provided
Readme
63 MiB
Languages
Kotlin 78.8%
C 8.4%
Makefile 3.6%
Gradle 2.8%
HTML 1.6%
Other 4.7%