Skip to content

Conversation

@ubozhestvo
Copy link

This feature allows you to select specific applications to use the VPN tunnel, while other applications bypass it.

Changes include:

  • Modified Android native code (OutlineVpnService.java, VpnTunnel.java, IVpnTunnelService.aidl) to use Android's VpnService.Builder.addAllowedApplication() method based on a list of package names.
  • Updated the Cordova plugin (OutlinePlugin.java):
    • Added a GET_INSTALLED_APPS action to retrieve a list of installed applications (name and package name).
    • Modified the START action to accept an optional list of allowed application package names.
  • Added UI elements for app selection:
    • Created a new Polymer component (app-selection-dialog) to display installed applications with checkboxes.
    • Integrated this dialog into the server settings view.
  • Implemented persistence for split-tunneling settings:
    • The list of allowed applications is saved per server configuration using OutlineServerRepository.
    • Settings are loaded when the app starts and applied when connecting to a VPN server.
  • Added comprehensive tests:
    • Unit tests for the Cordova plugin's JavaScript interface.
    • Unit tests for the new app-selection-dialog UI component.
    • Integration tests for settings storage, loading, and application.

If no applications are selected for split-tunneling (the default), all applications will use the VPN tunnel.

This feature allows you to select specific applications to use the VPN tunnel, while other applications bypass it.

Changes include:

- Modified Android native code (`OutlineVpnService.java`, `VpnTunnel.java`, `IVpnTunnelService.aidl`) to use Android's `VpnService.Builder.addAllowedApplication()` method based on a list of package names.
- Updated the Cordova plugin (`OutlinePlugin.java`):
    - Added a `GET_INSTALLED_APPS` action to retrieve a list of installed applications (name and package name).
    - Modified the `START` action to accept an optional list of allowed application package names.
- Added UI elements for app selection:
    - Created a new Polymer component (`app-selection-dialog`) to display installed applications with checkboxes.
    - Integrated this dialog into the server settings view.
- Implemented persistence for split-tunneling settings:
    - The list of allowed applications is saved per server configuration using `OutlineServerRepository`.
    - Settings are loaded when the app starts and applied when connecting to a VPN server.
- Added comprehensive tests:
    - Unit tests for the Cordova plugin's JavaScript interface.
    - Unit tests for the new `app-selection-dialog` UI component.
    - Integration tests for settings storage, loading, and application.

If no applications are selected for split-tunneling (the default), all applications will use the VPN tunnel.
@ubozhestvo ubozhestvo requested review from a team and fortuna as code owners June 15, 2025 12:41
@google-cla
Copy link

google-cla bot commented Jun 15, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

This commit addresses build failures encountered after the initial implementation of the Android split-tunneling feature.

The following files were modified:

- `client/src/www/app/outline_server_repository/server.ts`:
    - Fixed an extra closing brace in the `OutlineServer` constructor.
    - Ensured `OutlineServer` correctly implements the `Server` interface, including adding a getter for `tunnelConfigLocation`.

- `client/src/www/ui_components/app_selection_dialog.ts`:
    - Refactored localization to use `AppLocalizeBehavior` instead of a missing `LocalizeMixin`.
    - Imported `PaperDialogElement` type correctly.
    - Replaced Polymer 1.x/2.x `this.set()` calls with direct property assignments suitable for modern Polymer with TypeScript, ensuring reactivity.

These changes should resolve the TypeScript compilation errors and allow the build process to proceed further.
@fortuna
Copy link
Collaborator

fortuna commented Jun 16, 2025

Hi @ubozhestvo, this is a very large contribution. Thanks for the initiative, but we need to better understand it first.

Could you share screenshots that clarify what the new user experience is?
Also, does the app still work on the other platforms?

@fortuna
Copy link
Collaborator

fortuna commented Jun 16, 2025

I'm also seeing a number of broken tests that will need to pass.

}

@customElement('app-selection-dialog')
export class AppSelectionDialog extends AppLocalizeBehavior(PolymerElement) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Polymer is deprecated and should not be used for new components. We prefer Lit instead.

class OutlineServer implements Server {
errorMessageId?: string;
private tunnelConfig?: FirstHopAndTunnelConfigJson;
public allowedApps?: string[]; // Added property
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a product question that needs to be resolved: should the list of allowed apps be for the entire app or for the server?

/cc @maddyhof

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've discussed this internally and consulted with our user researcher's insights, and the product recommendation is to do this setting at the app-level, for all servers.
@ubozhestvo can you please share either UI screenshots or at least a step by step description of the user journey that you have in mind. We may need to loop in our UX designer since this has front-end implications. Thanks!

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.

3 participants