Java Code Examples for android.net.vpn.PptpProfile

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project android-vpn-server, under directory /src/android/net/vpn/.

Source file: VpnTest.java

  22 
vote

@SmallTest public void testGetType(){
  assertEquals(VpnType.L2TP,new L2tpProfile().getType());
  assertEquals(VpnType.L2TP_IPSEC,new L2tpIpsecProfile().getType());
  assertEquals(VpnType.L2TP_IPSEC_PSK,new L2tpIpsecPskProfile().getType());
  assertEquals(VpnType.PPTP,new PptpProfile().getType());
}
 

Example 2

From project android-vpn-settings, under directory /src/android/net/vpn/.

Source file: VpnTest.java

  21 
vote

@SmallTest public void testGetType(){
  assertEquals(VpnType.L2TP,new L2tpProfile().getType());
  assertEquals(VpnType.L2TP_IPSEC,new L2tpIpsecProfile().getType());
  assertEquals(VpnType.L2TP_IPSEC_PSK,new L2tpIpsecPskProfile().getType());
  assertEquals(VpnType.PPTP,new PptpProfile().getType());
}
 

Example 3

From project android-vpn-settings, under directory /src/com/android/settings/vpn/.

Source file: PptpEditor.java

  21 
vote

private Preference createEncryptionPreference(Context c){
  final PptpProfile profile=(PptpProfile)getProfile();
  CheckBoxPreference encryption=mEncryption=new CheckBoxPreference(c);
  boolean enabled=profile.isEncryptionEnabled();
  setCheckBoxTitle(encryption,R.string.vpn_pptp_encryption_title);
  encryption.setChecked(enabled);
  setEncryptionSummary(encryption,enabled);
  encryption.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    public boolean onPreferenceChange(    Preference pref,    Object newValue){
      boolean enabled=(Boolean)newValue;
      profile.setEncryptionEnabled(enabled);
      setEncryptionSummary(mEncryption,enabled);
      return true;
    }
  }
);
  return encryption;
}
 

Example 4

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/vpn/.

Source file: PptpEditor.java

  21 
vote

private Preference createEncryptionPreference(Context c){
  final PptpProfile profile=(PptpProfile)getProfile();
  CheckBoxPreference encryption=mEncryption=new CheckBoxPreference(c);
  boolean enabled=profile.isEncryptionEnabled();
  setCheckBoxTitle(encryption,R.string.vpn_pptp_encryption_title);
  encryption.setChecked(enabled);
  setEncryptionSummary(encryption,enabled);
  encryption.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    public boolean onPreferenceChange(    Preference pref,    Object newValue){
      boolean enabled=(Boolean)newValue;
      profile.setEncryptionEnabled(enabled);
      setEncryptionSummary(mEncryption,enabled);
      return true;
    }
  }
);
  return encryption;
}
 

Example 5

From project android-vpn-server, under directory /src/com/android/server/vpn/.

Source file: VpnServiceBinder.java

  19 
vote

private VpnService<? extends VpnProfile> createService(VpnProfile p){
switch (p.getType()) {
case L2TP:
    L2tpService l2tp=new L2tpService();
  l2tp.setContext(this,(L2tpProfile)p);
return l2tp;
case PPTP:
PptpService pptp=new PptpService();
pptp.setContext(this,(PptpProfile)p);
return pptp;
case L2TP_IPSEC_PSK:
L2tpIpsecPskService psk=new L2tpIpsecPskService();
psk.setContext(this,(L2tpIpsecPskProfile)p);
return psk;
case L2TP_IPSEC:
L2tpIpsecService l2tpIpsec=new L2tpIpsecService();
l2tpIpsec.setContext(this,(L2tpIpsecProfile)p);
return l2tpIpsec;
default :
return null;
}
}
 

Example 6

From project android-vpn-server, under directory /VpnServices/src/com/android/server/vpn/.

Source file: VpnServiceBinder.java

  19 
vote

private VpnService<? extends VpnProfile> createService(VpnProfile p){
switch (p.getType()) {
case L2TP:
    L2tpService l2tp=new L2tpService();
  l2tp.setContext(this,(L2tpProfile)p);
return l2tp;
case PPTP:
PptpService pptp=new PptpService();
pptp.setContext(this,(PptpProfile)p);
return pptp;
case L2TP_IPSEC_PSK:
L2tpIpsecPskService psk=new L2tpIpsecPskService();
psk.setContext(this,(L2tpIpsecPskProfile)p);
return psk;
case L2TP_IPSEC:
L2tpIpsecService l2tpIpsec=new L2tpIpsecService();
l2tpIpsec.setContext(this,(L2tpIpsecProfile)p);
return l2tpIpsec;
default :
return null;
}
}
 

Example 7

From project android-vpn-settings, under directory /src/com/android/settings/vpn/.

Source file: VpnEditor.java

  19 
vote

private VpnProfileEditor getEditor(VpnProfile p){
switch (p.getType()) {
case L2TP_IPSEC:
    return new L2tpIpsecEditor((L2tpIpsecProfile)p);
case L2TP_IPSEC_PSK:
  return new L2tpIpsecPskEditor((L2tpIpsecPskProfile)p);
case L2TP:
return new L2tpEditor((L2tpProfile)p);
case PPTP:
return new PptpEditor((PptpProfile)p);
default :
return new VpnProfileEditor(p);
}
}
 

Example 8

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/vpn/.

Source file: VpnEditor.java

  19 
vote

private VpnProfileEditor getEditor(VpnProfile p){
switch (p.getType()) {
case L2TP_IPSEC:
    return new L2tpIpsecEditor((L2tpIpsecProfile)p);
case L2TP_IPSEC_PSK:
  return new L2tpIpsecPskEditor((L2tpIpsecPskProfile)p);
case L2TP:
return new L2tpEditor((L2tpProfile)p);
case PPTP:
return new PptpEditor((PptpProfile)p);
default :
return new VpnProfileEditor(p);
}
}