Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Android O preview #1258

Merged
merged 21 commits into from
Jul 19, 2017
Merged

Support for Android O preview #1258

merged 21 commits into from
Jul 19, 2017

Conversation

Mygod
Copy link
Contributor

@Mygod Mygod commented May 18, 2017

DO NOT MERGE YET! This is a work in progress.

Note: Fixes for NDK compiling issues (and other related stuff) have already been merged to master branch.

TODO

  • Notification channel
    NB: it's possible that NAT service notifications in lock screen are not hiding correctly, needs more tests
  • Overture crashing (looks like Android emulator bug)
  • Replace Typeface with native font support with support library (blocked by upstream: New font resources not recognized scala-android/sbt-android#306)
  • Port plugin platform to Android O
  • Use PreferenceDataStore to make SharedPreference process-safe (a historical problem)

Lower priorities:

  • Adaptive icon?

Mygod added 4 commits May 18, 2017 14:35
* Update support library to beta1;
* Adapt to new foreground service policy;
* Add a separate notification channel for NAT service;
* Adapt to `findViewById` method signature changes.

Possible issues: NAT notification will possibly not hide in lockscreen.
@Mygod
Copy link
Contributor Author

Mygod commented May 18, 2017

@madeye Could you investigate why overture is crashing? It seems to crash when launched by Shadowsocks:

12067-12756/com.github.shadowsocks:bg D/GuardedProcess: start process: /data/app/com.github.shadowsocks-QkCmGBEGOrqtXp1bS-DAgQ==/lib/x86/liboverture.so -c overture-vpn.conf -V
12067-12756/com.github.shadowsocks:bg W/GuardedProcess: process exit too fast, stop guard: /data/app/com.github.shadowsocks-QkCmGBEGOrqtXp1bS-DAgQ==/lib/x86/liboverture.so -c overture-vpn.conf -V

However launching it from adb shell (with root/correct uid, and correct cwd) works fine:

12858-12858/? I/overture: level=info msg="If you need any help, please visit the project repository: https://github.com/shadowsocks/overture" 
12858-12862/? I/overture: level=info msg="Load IP network file successful" 
12858-12862/? I/overture: level=info msg="Load domain file successful" 
12858-12862/? I/overture: level=info msg="Minimum TTL is 3600" 
12858-12862/? I/overture: level=info msg="CacheSize is 4096" 
12858-12862/? I/overture: level=info msg="Load hosts file successful" 
12858-12862/? I/overture: level=info msg="Start overture on 127.0.0.1:1133" 

@madeye
Copy link
Contributor

madeye commented May 18, 2017

I don't have any Android O device yet. Let me try it on emulator first.

It looks related to new private API protector or something similar.

@Mygod
Copy link
Contributor Author

Mygod commented May 18, 2017

@madeye I'm just trying it on emulator as well.

Also I just noticed that there's a new option in VPN settings: "Block connections without VPN" for "Always-on VPN". This could be useful for users that are concerned about security.

@madeye
Copy link
Contributor

madeye commented May 18, 2017

I can reproduce this issue on the emulator now. The process of overture is killed at the very beginning. No related log or dmesg can be found.

@madeye
Copy link
Contributor

madeye commented May 18, 2017

I just tried 4.1.7. Everything works well on Android O (Pixel and Emulator)...

@madeye
Copy link
Contributor

madeye commented May 18, 2017

@Mygod
Copy link
Contributor Author

Mygod commented May 18, 2017

@madeye But why does the C binaries work well?

@madeye
Copy link
Contributor

madeye commented May 18, 2017

I tried starting kcptun plugin with shadowsocks. In that case, ss-local is also killed...

@madeye
Copy link
Contributor

madeye commented May 18, 2017

Is it possible that the issue is caused by this d5dc3a8?

@madeye
Copy link
Contributor

madeye commented May 18, 2017

Interesting. It seems only the emulator is not working. The latest APK works well on Pixel with Android O.

@Mygod
Copy link
Contributor Author

Mygod commented May 18, 2017

@madeye Haha what a mysterious bug.

IIRC old GCC binaries (compiled with old ndk) doesn't work either. So no.

You could do a single stepping with gdb. Could be a bug in qemu?

@Mygod
Copy link
Contributor Author

Mygod commented May 18, 2017

*actually old GCC binaries exhibits more bug even when launched from adb shell (in preview 1). For example, failure to load any file other than overture-vpn.conf. (it gives open : file or directory not found)

@Mygod
Copy link
Contributor Author

Mygod commented May 18, 2017

@madeye
Copy link
Contributor

madeye commented May 19, 2017

A new finding is it seems we cannot execute a armv7a binary from a arm64-v8a process on Android O. It caused the crash of kcptun plugin and has been fixed via shadowsocks/kcptun-android@90b2b38

@Mygod
Copy link
Contributor Author

Mygod commented May 19, 2017 via email

@madeye
Copy link
Contributor

madeye commented May 19, 2017

Maybe it's just a bug of x86 emulator? According to my local test, shadowsocks (with kcptun and simple-obfs) works well on a Pixel (Android O).

Let's wait for the next release of Android O SDK and emulator. Hope it will fix our issue.

@Mygod
Copy link
Contributor Author

Mygod commented May 19, 2017

Okay. Maybe we should file a bug report at Google issue tracker.

@Mygod
Copy link
Contributor Author

Mygod commented May 22, 2017

@madeye Btw planning on migrating to Kotlin?

@madeye
Copy link
Contributor

madeye commented May 22, 2017

@Mygod Yes, I think we can schedule this.

@madeye
Copy link
Contributor

madeye commented May 22, 2017

BTW, is there any tool can easily convert Scala to Kotlin?

@madeye
Copy link
Contributor

madeye commented May 22, 2017

What about creating a new branch for Kotlin porting effort?

@Mygod
Copy link
Contributor Author

Mygod commented May 22, 2017

Okay I'll look into this and create a branch for Kotlin based off o-preview branch.

Because our data store is process-safe, we can remove the `use` function
entirely and move more components to :bg process.
@madeye
Copy link
Contributor

madeye commented Jul 15, 2017

No function regression is observed in the latest changes.

One weird thing is now we need to long press the number picker dialog to enter the number manually.

@madeye
Copy link
Contributor

madeye commented Jul 15, 2017

What about reverting number picker to number only edit text for port numbers? Actually, I never used the picker to change the port number...

@madeye
Copy link
Contributor

madeye commented Jul 15, 2017

A trade off is keeping the number picker for local port, but using edit text for remote port. It helps to avoid illegal local port numbers.

@Mygod
Copy link
Contributor Author

Mygod commented Jul 16, 2017

ShadowsocksRunnerActivity is not tested. Everything else seems to work fine on Android 7.1.2, including number picker. I will go investigate number picker on Android 8.0 later.

@Mygod
Copy link
Contributor Author

Mygod commented Jul 16, 2017

Keyboard is also popping up for me in Android 8.0 emulator.

@Mygod
Copy link
Contributor Author

Mygod commented Jul 16, 2017

Adaptive icons are here. Design source.

image

screenshot_1500188693

From: Adaptive icon playground.

@Mygod
Copy link
Contributor Author

Mygod commented Jul 16, 2017

screenshot_1500189789

This app is now Android 8.0 ready and this PR is ready to merge.

@madeye
Copy link
Contributor

madeye commented Jul 16, 2017

Fix a crash in ShadowsocksRunnerActivity that the activity exists too early when preparing VPN in background service.

@madeye
Copy link
Contributor

madeye commented Jul 16, 2017

The only one item left is the number picker for port number.

  1. Soft keyboard shows up correctly.
  2. However, the number picker is not focused by default.
  3. By long pressing the picker, the user is able to input the number manually.

What I've tried:

  1. requestFocus() at first, but it seems to not work.

@madeye
Copy link
Contributor

madeye commented Jul 16, 2017

Surprisingly, after enlarging the text size of number picker, I managed to focus number picker by clicking now...

IMO, It looks that if the number text is too small, the click action may be recognized as scrolling, which prevents focusing the text and enabling manual input.

@madeye
Copy link
Contributor

madeye commented Jul 19, 2017

A new crash is observed during auto start:

1757 07-19 08:52:48.596  5926  6596 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'void        java.util.concurrent.CountDownLatch.countDown()' on a null object reference
1758 07-19 08:52:48.596  5926  6596 E AndroidRuntime:    at com.evernote.android.job.JobRescheduleService.                          onHandleIntent(JobRescheduleService.java:104)
1759 07-19 08:52:48.596  5926  6596 E AndroidRuntime:    at android.app.IntentService$ServiceHandler.                               handleMessage(IntentService.java:68)
1760 07-19 08:52:48.596  5926  6596 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:105)
1761 07-19 08:52:48.596  5926  6596 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:164)
1762 07-19 08:52:48.596  5926  6596 E AndroidRuntime:    at android.os.HandlerThread.run(HandlerThread.java:65)

Steps to reproduce this crash:

  1. Set auto start enable.
  2. Restart the phone.
  3. Unlock the phone.
  4. Wait until VPNService is started.
  5. Open Shadowsocks' main activity.
  6. Wait 30 seconds.

It looks an issue of evernote/android-job library.

@madeye
Copy link
Contributor

madeye commented Jul 19, 2017

Updating the library to 1.2.0-alpha3 fixed the issue via d8179b5.

@madeye madeye merged commit f950037 into develop Jul 19, 2017
@Mygod Mygod deleted the o-preview branch September 3, 2017 22:28
@Mygod
Copy link
Contributor Author

Mygod commented Oct 28, 2017

Update: It's not possible to dynamically update notification channel's importance in Oreo: (source)

The importance of an existing channel will only be changed if the new importance is lower than the current value and the user has not altered any settings on this channel. All other fields are ignored for channels that already exist.

@Mygod Mygod mentioned this pull request Dec 23, 2017
@Mygod
Copy link
Contributor Author

Mygod commented Jun 15, 2019

Updated design for Google Play new icon specification.

play

bannedbook pushed a commit to bannedbook/SpeedUp.VPN that referenced this pull request Dec 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants