Back to top

VPN namespace changes

Overview

The Knox v3.4 release merged the Knox VPN SDK into the Knox SDK. All packages, intents, and permission names in the Knox VPN SDK migrated:

  • from the old namespace com.sec.vpn
  • to the new namespace com.samsung.android.knox

Knox v3.0 first introduced the consolidated Knox SDK with this new namespace, and introduced the supportlib.jar library to help older devices translate the old namespace to the new namespace. For details about how to update apps to use the new namespace, see the Migration Tutorial.

All the old namespaces used by the deprecated SDKs (Knox Standard, Premium, Customization, ISV, UCM, VPN) will no longer be supported in the Android 10 (Q) release. Older devices however will continue to support the old namespaces.

If your app used the deprecated Knox VPN SDK, you must migrate to the Knox SDK and its new namespace. Not migrating to the new namespace will cause your VPN app to malfunction in Android 10, leaving your users without VPN access. To prevent this malfunction, we highly recommend updating your VPN apps to use the new namespace.

Namespace architecture

VPN clients developed using the deprecated Knox VPN SDK used the old namespace.

Old namespace architecture

When the Knox VPN SDK merged into the Knox SDK v3.4, a new namespace was introduced. Now, the Knox SDK framework uses the Knox VPN SDK Support Library for Old Namespace Translation (knoxvpn_support.aar) library to act as a proxy and forward any new namespace API requests from VPN clients compatible with Knox SDK v3.0 or lower. All VPN clients must move to the new namespace in Knox v3.4 and above. With this change, old namespace calls from the Knox VPN framework are converted to new namespace APIs on the updated VPN clients. All VPN clients must include the Knox VPN SDK Support Library for Old Namespace Translation (knoxvpn_support.aar) library to provide backward compatibility with old frameworks. The new namespace architecture is as follows.

New namespace architecture

Update VPN client app in Android Studio

Follow the instructions in this section to update your VPN client to use the new namespaces.

  1. In the AndroidManifest.xml file, add a new service declaration as follows:
<service android:name="com.samsung.android.knox.net.vpn.KnoxONSVpnService" android:exported="false" >
  <intent-filter>
    <action android:name="{packageName}.BIND_SERVICE" />
  </intent-filter>
</service>
  1. Change the action name to update existing the Knox VPN service, as highlighted in red:
<service android:name="{packageName}.KnoxVpnServiceImpl"android:exported="false" >
  <intent-filter>
   <action android:name="{packageName}.BIND_SERVICE_NEW" />
  </intent-filter>
</service>
  1. In the build.gradle file (root directory), include the flatDir attribute as follows:
allprojects {
  repositories {
    jcenter()
    flatDir {
      dirs 'libs'
    }
  }
}
  1. In the client’s project, under apps/libs/, add the latest Knox SDK (knoxsdk.jar) and supportlib.jar libraries. You can download both from the Knox developer dashboard Download page.

  2. If your gradle version is 3.0 or lower, add an entry for multiDexEnabled as follows. If your gradle plugin is above 3.0, you can skip this step.

defaultConfig {
  ...
  multiDexEnabled = true
}
  1. In the client’s project, under apps/libs/, add the Knox VPN SDK Support Library for Old Namespace Translation (knoxvpn_support.aar) artifact, you can download the file from the Knox developer dashboard Download page.

  2. Update your gradle dependencies.

If your gradle plugin version is 3.0 or lower

In the build.gradle app directory, under the dependencies entry, include the following compile entry:

dependencies {
  apk files('libs/supportlib.jar')
  provided files('libs/knoxsdk.jar')
  compile(name:'knoxvpn_support', ext:'aar')
}

If your gradle plugin version is above 3.0

In the build.gradle app directory, under the dependencies entry, include the following compile entry:

dependencies {
  runtimeOnly files('libs/supportlib.jar')
  compileOnly files('libs/knoxsdk.jar')
  compileOnly files('libs/knoxvpn_support.aar')
}

Make sure that your gradle file does not include the default line below, which adds all.jars inside apps/libs/:

implementation fileTree(dir: 'libs', include: ['*.jar'])
  1. Update old namespace references to use new namespace—com.samsung.android.knox—as follows:
Existing reference (old namespace) Change to (new namespace)
import android.app.enterprise.CertificateInfo; import com.samsung.android.knox.keystore.CertificateInfo;
import com.sec.enterprise.mdm.services.vpn.knoxvpn.IKnoxVpnService; import com.samsung.android.knox.net.vpn.serviceprovider.IKnoxVpnService;
import com.sec.vpn.knox.GenericVpnContext; import com.samsung.android.knox.net.vpn.serviceprovider.GenericVpnContext;
import com.sec.vpn.knox.GenericVpnService; import com.samsung.android.knox.net.vpn.serviceprovider.GenericVpnService;
  1. From the VPN client’s project folder, remove all old namespace files, such as:
    • Under src/main/aidl/android/app/enterprise, remove CertificateInfo.aidl
    • Under src/main/java/android/app/enterprise, remove CertificateInfo.java
    • Under src/main/aidl/com/sec/enterprise/mdm/services/vpn/knoxvpn, remove IKnoxVpnService.aidl

Is this page helpful?