├── .gitignore ├── HIPRIKeeper ├── .gitignore ├── .idea │ ├── .name │ ├── codeStyleSettings.xml │ ├── compiler.xml │ ├── copyright │ │ ├── GPLv3.xml │ │ └── profiles_settings.xml │ ├── dictionaries │ │ └── mbaerts.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── misc.xml │ ├── modules.xml │ ├── scopes │ │ └── scope_settings.xml │ └── vcs.xml ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── be │ │ │ └── uclouvain │ │ │ └── hiprikeeper │ │ │ └── ApplicationTest.java │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── ic_launcher-web.png │ │ ├── java │ │ └── be │ │ │ └── uclouvain │ │ │ └── hiprikeeper │ │ │ ├── Boot.java │ │ │ ├── Config.java │ │ │ ├── HIPRIKeeper.java │ │ │ ├── MainActivity.java │ │ │ ├── MainService.java │ │ │ ├── Manager.java │ │ │ ├── MobileDataMgr.java │ │ │ └── Notifications.java │ │ └── res │ │ ├── drawable-hdpi-v11 │ │ └── ic_stat_name.png │ │ ├── drawable-hdpi-v9 │ │ └── ic_stat_name.png │ │ ├── drawable-hdpi │ │ └── ic_stat_name.png │ │ ├── drawable-mdpi-v11 │ │ └── ic_stat_name.png │ │ ├── drawable-mdpi-v9 │ │ └── ic_stat_name.png │ │ ├── drawable-mdpi │ │ └── ic_stat_name.png │ │ ├── drawable-xhdpi-v11 │ │ └── ic_stat_name.png │ │ ├── drawable-xhdpi-v9 │ │ └── ic_stat_name.png │ │ ├── drawable-xhdpi │ │ └── ic_stat_name.png │ │ ├── drawable-xxhdpi-v11 │ │ └── ic_stat_name.png │ │ ├── drawable-xxhdpi-v9 │ │ └── ic_stat_name.png │ │ ├── drawable-xxhdpi │ │ └── ic_stat_name.png │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── MultipathControl ├── .gitignore ├── .settings │ └── org.eclipse.jdt.core.prefs ├── AUTHORS ├── AndroidManifest.xml ├── LICENSE ├── ic_launcher-web.png ├── libs │ └── android-support-v4.jar ├── proguard-project.txt ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── layout │ │ ├── main.xml │ │ ├── tcp_cc.xml │ │ └── tcp_cc_list_view.xml │ ├── menu │ │ └── main.xml │ ├── values-sw600dp │ │ └── dimens.xml │ ├── values-sw720dp-land │ │ └── dimens.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ ├── values-w820dp │ │ └── dimens.xml │ └── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml └── src │ └── be │ └── uclouvain │ └── multipathcontrol │ ├── MPCtrl.java │ ├── activities │ ├── MainActivity.java │ └── TCPCCActivity.java │ ├── global │ ├── Config.java │ ├── ConfigServerExample.java │ └── Manager.java │ ├── ifaces │ ├── IPRoute.java │ └── MobileDataMgr.java │ ├── services │ ├── Boot.java │ └── MainService.java │ ├── stats │ ├── GetIPTask.java │ ├── HttpUtils.java │ ├── JSONSender.java │ ├── JSONSenderTask.java │ ├── LocationState.java │ ├── PhoneState.java │ ├── SaveDataAbstract.java │ ├── SaveDataApp.java │ ├── SaveDataHandover.java │ └── StatsCategories.java │ ├── system │ ├── Cmd.java │ ├── IPRouteUtils.java │ └── Sysctl.java │ └── ui │ └── Notifications.java └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | .metadata 5 | .gradle 6 | build 7 | 8 | # files for the dex VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # generated files 15 | bin/ 16 | gen/ 17 | 18 | # Local configuration file (sdk path, etc) 19 | local.properties 20 | 21 | # Eclipse project files 22 | .classpath 23 | .project 24 | project.properties 25 | 26 | # Proguard folder generated by Eclipse 27 | proguard/ 28 | 29 | # Intellij project files 30 | *.iml 31 | *.ipr 32 | *.iws/ 33 | .idea/workspace.xml 34 | .idea/libraries 35 | google-play-services_lib 36 | .idea/dictionaries/*.xml 37 | -------------------------------------------------------------------------------- /HIPRIKeeper/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | -------------------------------------------------------------------------------- /HIPRIKeeper/.idea/.name: -------------------------------------------------------------------------------- 1 | HIPRI Keeper -------------------------------------------------------------------------------- /HIPRIKeeper/.idea/codeStyleSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 171 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /HIPRIKeeper/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /HIPRIKeeper/.idea/copyright/GPLv3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /HIPRIKeeper/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /HIPRIKeeper/.idea/dictionaries/mbaerts.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /HIPRIKeeper/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /HIPRIKeeper/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /HIPRIKeeper/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /HIPRIKeeper/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /HIPRIKeeper/.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /HIPRIKeeper/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 21 5 | buildToolsVersion "21.1.2" 6 | 7 | defaultConfig { 8 | applicationId "be.uclouvain.hiprikeeper" 9 | minSdkVersion 16 10 | targetSdkVersion 19 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:22.0.0' 25 | } 26 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in android-sdk-linux/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/androidTest/java/be/uclouvain/hiprikeeper/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package be.uclouvain.hiprikeeper; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/java/be/uclouvain/hiprikeeper/Boot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of HIPRI Keeper. 3 | * 4 | * Copyright 2015 UCLouvain - Matthieu Baerts 5 | * 6 | * This application is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | package be.uclouvain.hiprikeeper; 21 | 22 | import android.content.BroadcastReceiver; 23 | import android.content.Context; 24 | import android.content.Intent; 25 | 26 | public class Boot extends BroadcastReceiver { 27 | @Override 28 | public void onReceive(Context context, Intent intent) { 29 | if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { 30 | context.startService(new Intent(context, MainService.class)); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/java/be/uclouvain/hiprikeeper/Config.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of HIPRI Keeper. 3 | * 4 | * Copyright 2015 UCLouvain - Matthieu Baerts 5 | * 6 | * This application is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | package be.uclouvain.hiprikeeper; 21 | 22 | import android.content.Context; 23 | import android.content.SharedPreferences; 24 | 25 | /** 26 | * Created by Matthieu Baerts on 19/04/15. 27 | */ 28 | public class Config { 29 | public static final String PREFS_NAME = "HIPRIKeeper"; 30 | public static final String PREFS_STATUS = "enableMultiInterfaces"; 31 | public static final String PREFS_SAVE_BATTERY = "saveBattery"; 32 | 33 | public static boolean enable = true; 34 | public static boolean saveBattery = true; 35 | 36 | private Config() { 37 | } 38 | 39 | public static void getDefaultConfig(Context context) { 40 | SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 41 | Context.MODE_PRIVATE); 42 | enable = settings.getBoolean(PREFS_STATUS, true); 43 | saveBattery = settings.getBoolean(PREFS_SAVE_BATTERY, true); 44 | } 45 | 46 | public static void saveStatus(Context context) { 47 | SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 48 | Context.MODE_PRIVATE); 49 | SharedPreferences.Editor editor = settings.edit(); 50 | 51 | editor.putBoolean(PREFS_STATUS, enable); 52 | editor.putBoolean(PREFS_SAVE_BATTERY, saveBattery); 53 | editor.apply(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/java/be/uclouvain/hiprikeeper/HIPRIKeeper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of HIPRI Keeper. 3 | * 4 | * Copyright 2015 UCLouvain - Matthieu Baerts 5 | * 6 | * This application is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | package be.uclouvain.hiprikeeper; 21 | 22 | import android.content.BroadcastReceiver; 23 | import android.content.Context; 24 | import android.content.Intent; 25 | import android.content.IntentFilter; 26 | import android.net.ConnectivityManager; 27 | import android.os.Handler; 28 | import android.os.PowerManager; 29 | import android.os.StrictMode; 30 | import android.util.Log; 31 | 32 | /** 33 | * Created by Matthieu Baerts on 19/04/15. 34 | */ 35 | public class HIPRIKeeper { 36 | 37 | private Context context; 38 | private final Notifications notif; 39 | private final MobileDataMgr mobileDataMgr; 40 | private final Handler handler; 41 | private static long lastTimeHandler; 42 | 43 | public HIPRIKeeper(Context context) { 44 | this.context = context; 45 | 46 | StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); 47 | StrictMode.setThreadPolicy(policy); 48 | 49 | Config.getDefaultConfig(context); 50 | notif = new Notifications(context); 51 | mobileDataMgr = new MobileDataMgr(context); 52 | Log.i(Manager.TAG, "new HIPRI Keeper"); 53 | 54 | handler = new Handler(); 55 | initHandler(); 56 | 57 | /* 58 | * mConnReceiver will be called each time a change of connectivity 59 | * happen 60 | */ 61 | context.registerReceiver(mConnReceiver, new IntentFilter( 62 | ConnectivityManager.CONNECTIVITY_ACTION)); 63 | 64 | if (Config.enable) 65 | notif.showNotification(); 66 | if (! Config.saveBattery) 67 | mobileDataMgr.keepMobileConnectionAlive(); 68 | } 69 | 70 | public void destroy() { 71 | try { 72 | context.unregisterReceiver(mConnReceiver); 73 | } catch (IllegalArgumentException e) { 74 | } 75 | 76 | Log.i(Manager.TAG, "destroy MPCtrl"); 77 | 78 | handler.getLooper().quit(); 79 | 80 | notif.hideNotification(); 81 | } 82 | 83 | public boolean setStatus(boolean isChecked) { 84 | if (isChecked == Config.enable) 85 | return false; 86 | 87 | Log.i(Manager.TAG, "set new status " 88 | + (isChecked ? "enable" : "disable")); 89 | Config.enable = isChecked; 90 | Config.saveStatus(context); 91 | 92 | if (isChecked) 93 | notif.showNotification(); 94 | else 95 | notif.hideNotification(); 96 | 97 | return true; 98 | } 99 | 100 | public boolean setSaveBattery(boolean isChecked) { 101 | if (isChecked == Config.saveBattery) 102 | return false; 103 | Config.saveBattery = isChecked; 104 | Config.saveStatus(context); 105 | return true; // nothing to do here: we need to restart app 106 | } 107 | 108 | private BroadcastReceiver mConnReceiver = new BroadcastReceiver() { 109 | @Override 110 | public void onReceive(Context context, Intent intent) { 111 | Log.i(Manager.TAG, "BroadcastReceiver " + intent); 112 | PowerManager pm = (PowerManager) context 113 | .getSystemService(Context.POWER_SERVICE); 114 | if (pm.isScreenOn()) 115 | mobileDataMgr.setMobileDataActive(Config.enable); 116 | } 117 | }; 118 | 119 | /* 120 | * Will not be executed in deep sleep, nice, no need to use both connections 121 | * in deep-sleep 122 | */ 123 | private void initHandler() { 124 | lastTimeHandler = System.currentTimeMillis(); 125 | 126 | // First check 127 | handler.post(runnableSetMobileDataActive); 128 | } 129 | 130 | /* 131 | * Ensures that the data interface and WiFi are connected at the same time. 132 | */ 133 | private Runnable runnableSetMobileDataActive = new Runnable() { 134 | final long fiveSecondsMs = 5 * 1000; 135 | 136 | @Override 137 | public void run() { 138 | long nowTime = System.currentTimeMillis(); 139 | // do not try keep mobile data active in deep sleep mode 140 | if (Config.enable 141 | && nowTime - lastTimeHandler < fiveSecondsMs * 2) 142 | // to not disable cellular iface 143 | mobileDataMgr.setMobileDataActive(Config.enable); 144 | lastTimeHandler = nowTime; 145 | handler.postDelayed(this, fiveSecondsMs); 146 | } 147 | }; 148 | } 149 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/java/be/uclouvain/hiprikeeper/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of HIPRI Keeper. 3 | * 4 | * Copyright 2015 UCLouvain - Matthieu Baerts 5 | * 6 | * This application is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | package be.uclouvain.hiprikeeper; 21 | 22 | import android.content.Intent; 23 | import android.os.Bundle; 24 | import android.support.v7.app.ActionBarActivity; 25 | import android.widget.CompoundButton; 26 | import android.widget.Switch; 27 | import android.widget.Toast; 28 | 29 | 30 | public class MainActivity extends ActionBarActivity { 31 | 32 | private HIPRIKeeper hipriKeeper; 33 | 34 | private Switch multiIfaceSwitch; 35 | private Switch saveBatterySwitch; 36 | 37 | @Override 38 | protected void onCreate(Bundle savedInstanceState) { 39 | super.onCreate(savedInstanceState); 40 | setContentView(R.layout.activity_main); 41 | 42 | multiIfaceSwitch = (Switch) findViewById(R.id.switch_enable); 43 | saveBatterySwitch = (Switch) findViewById(R.id.switch_save_battery); 44 | 45 | hipriKeeper = Manager.create(getApplicationContext()); 46 | 47 | multiIfaceSwitch 48 | .setOnCheckedChangeListener(onCheckedChangeListenerMultiIface); 49 | saveBatterySwitch 50 | .setOnCheckedChangeListener(onCheckedChangeListenerSaveBattery); 51 | 52 | // start a new service if needed 53 | startService(new Intent(this, MainService.class)); 54 | } 55 | 56 | @Override 57 | protected void onResume() { 58 | super.onResume(); 59 | 60 | setChecked(); 61 | } 62 | 63 | protected void onDestroy() { 64 | super.onDestroy(); 65 | Manager.destroy(getApplicationContext()); 66 | } 67 | 68 | 69 | private void setChecked() { 70 | multiIfaceSwitch.setChecked(Config.enable); 71 | saveBatterySwitch.setChecked(Config.saveBattery); 72 | } 73 | 74 | private CompoundButton.OnCheckedChangeListener onCheckedChangeListenerMultiIface = new CompoundButton.OnCheckedChangeListener() { 75 | @Override 76 | public void onCheckedChanged(CompoundButton buttonView, 77 | boolean isChecked) { 78 | if (hipriKeeper.setStatus(isChecked) && !isChecked) 79 | Toast.makeText( 80 | MainActivity.this, 81 | "The second interface will be disabled in a few seconds", 82 | Toast.LENGTH_LONG).show(); 83 | } 84 | }; 85 | 86 | private CompoundButton.OnCheckedChangeListener onCheckedChangeListenerSaveBattery = new CompoundButton.OnCheckedChangeListener() { 87 | @Override 88 | public void onCheckedChanged(CompoundButton buttonView, 89 | boolean isChecked) { 90 | if (hipriKeeper.setSaveBattery(isChecked)) 91 | Toast.makeText( 92 | MainActivity.this, 93 | "Please disconnect/reconnect cellular interface or reboot", 94 | Toast.LENGTH_LONG).show(); 95 | } 96 | }; 97 | } 98 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/java/be/uclouvain/hiprikeeper/MainService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of HIPRI Keeper. 3 | * 4 | * Copyright 2015 UCLouvain - Matthieu Baerts 5 | * 6 | * This application is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | package be.uclouvain.hiprikeeper; 21 | 22 | import android.app.Service; 23 | import android.content.Intent; 24 | import android.os.IBinder; 25 | import android.util.Log; 26 | 27 | public class MainService extends Service { 28 | 29 | private HIPRIKeeper hipriKeeper; 30 | 31 | @Override 32 | public IBinder onBind(Intent intent) { 33 | return null; 34 | } 35 | 36 | public void onCreate() { 37 | super.onCreate(); 38 | hipriKeeper = Manager.create(getApplicationContext()); 39 | Log.i(Manager.TAG, "Create service"); 40 | } 41 | 42 | public void onDestroy() { 43 | super.onDestroy(); 44 | if (hipriKeeper != null) { 45 | Manager.destroy(getApplicationContext()); 46 | Log.i(Manager.TAG, "Destroy service"); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/java/be/uclouvain/hiprikeeper/Manager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of HIPRI Keeper. 3 | * 4 | * Copyright 2015 UCLouvain - Matthieu Baerts 5 | * 6 | * This application is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | package be.uclouvain.hiprikeeper; 21 | 22 | import android.content.Context; 23 | import android.util.Log; 24 | 25 | /** 26 | * Created by Matthieu Baerts on 19/04/15. 27 | */ 28 | public class Manager { 29 | public static final String TAG = "hiprikeeper"; 30 | public static final boolean DEBUG = false; 31 | 32 | private static HIPRIKeeper hipriKeeper = null; 33 | private static int instances = 0; 34 | private static Context usedContext; 35 | 36 | private Manager() { 37 | } 38 | 39 | /** 40 | * Create a new instance of hipriKeeper. 41 | * 42 | * @return null if you're not root. 43 | */ 44 | public static HIPRIKeeper create(Context context) { 45 | if (hipriKeeper == null) { 46 | usedContext = context; 47 | hipriKeeper = new HIPRIKeeper(context); 48 | } 49 | instances++; 50 | return hipriKeeper; 51 | } 52 | 53 | /** 54 | * Destroy the instance only if we are using this context. 55 | * 56 | * @return true if the instance has really been fully destroyed 57 | */ 58 | public static boolean destroy(Context context) { 59 | if (context != usedContext || hipriKeeper == null) 60 | return false; 61 | instances--; 62 | if (instances != 0) { 63 | Log.e(TAG, "destroying the non last instance"); 64 | return false; 65 | } 66 | hipriKeeper.destroy(); 67 | hipriKeeper = null; 68 | return true; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/java/be/uclouvain/hiprikeeper/MobileDataMgr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of HIPRI Keeper. 3 | * 4 | * Copyright 2015 UCLouvain - Matthieu Baerts 5 | * 6 | * This application is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | package be.uclouvain.hiprikeeper; 21 | 22 | import android.content.Context; 23 | import android.net.ConnectivityManager; 24 | import android.net.NetworkInfo; 25 | import android.util.Log; 26 | 27 | import java.lang.reflect.Method; 28 | import java.net.InetAddress; 29 | import java.net.UnknownHostException; 30 | import java.util.Date; 31 | 32 | /** 33 | * Created by Matthieu Baerts on 19/04/15. 34 | */ 35 | public class MobileDataMgr { 36 | private final Context context; 37 | /* 38 | * We need an existing domain that nobody uses in order to have a existing 39 | * route assigned to the cellular connection. The goal is to not disable 40 | * Cellular interface when switching to a new Wi-Fi. example.org domain is 41 | * reserved by IANA, nobody will want to use it! 42 | */ 43 | private static final String DEFAULT_LOOKUP_HOST = "example.org"; 44 | 45 | public MobileDataMgr(Context context) { 46 | this.context = context; 47 | } 48 | 49 | private boolean isWifiConnected() { 50 | ConnectivityManager connManager = (ConnectivityManager) context 51 | .getSystemService(Context.CONNECTIVITY_SERVICE); 52 | NetworkInfo mWifi = connManager 53 | .getNetworkInfo(ConnectivityManager.TYPE_WIFI); 54 | return mWifi.isConnectedOrConnecting(); 55 | } 56 | 57 | /* Check whether Mobile Data has been disabled in the System Preferences */ 58 | private boolean isMobileDataEnabled() { 59 | boolean mobileDataEnabled = false; 60 | ConnectivityManager cm = (ConnectivityManager) context 61 | .getSystemService(Context.CONNECTIVITY_SERVICE); 62 | try { 63 | Class cmClass = Class.forName(cm.getClass().getName()); 64 | Method method = cmClass.getDeclaredMethod("getMobileDataEnabled"); 65 | method.setAccessible(true); 66 | mobileDataEnabled = (Boolean) method.invoke(cm); 67 | } catch (Exception e) { 68 | } 69 | return mobileDataEnabled; 70 | } 71 | 72 | /* Enable having WiFi and 3G/LTE enabled at the same time */ 73 | public void setMobileDataActive(boolean mEnabled) { 74 | if (Manager.DEBUG) 75 | Log.d(Manager.TAG, "setMobileDataActive " + new Date()); 76 | 77 | ConnectivityManager cManager = (ConnectivityManager) context 78 | .getSystemService(Context.CONNECTIVITY_SERVICE); 79 | if (isMobileDataEnabled() && isWifiConnected() && mEnabled) 80 | cManager.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, 81 | "enableHIPRI"); 82 | else 83 | cManager.stopUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, 84 | "enableHIPRI"); 85 | } 86 | 87 | private static int getAddr(InetAddress inetAddress) { 88 | byte[] addrBytes; 89 | int addr; 90 | addrBytes = inetAddress.getAddress(); 91 | addr = ((addrBytes[3] & 0xff) << 24) | ((addrBytes[2] & 0xff) << 16) 92 | | ((addrBytes[1] & 0xff) << 8) | (addrBytes[0] & 0xff); 93 | return addr; 94 | } 95 | 96 | /** 97 | * Transform host name in int value used by 98 | * {@link android.net.ConnectivityManager#requestRouteToHost(int, int)} method 99 | * 100 | * @param hostname 101 | * @return -1 if the host doesn't exists, elsewhere its translation to an 102 | * integer 103 | */ 104 | private static int lookupHost(String hostname) { 105 | InetAddress inetAddress; 106 | try { 107 | inetAddress = InetAddress.getByName(hostname); 108 | } catch (UnknownHostException e) { 109 | return -1; 110 | } 111 | return getAddr(inetAddress); 112 | } 113 | 114 | /** 115 | * Enable mobile connection even when switching to WiFi 116 | *

117 | * Source: http://stackoverflow.com/a/4756630 118 | * 119 | * @return true for success, else false 120 | */ 121 | public boolean keepMobileConnectionAlive() { 122 | ConnectivityManager connectivityManager = (ConnectivityManager) context 123 | .getSystemService(Context.CONNECTIVITY_SERVICE); 124 | if (null == connectivityManager) { 125 | Log.d(Manager.TAG, 126 | "ConnectivityManager is null, cannot try to force a mobile connection"); 127 | return false; 128 | } 129 | 130 | // create a route for the specified address 131 | int hostAddress = lookupHost(DEFAULT_LOOKUP_HOST); 132 | if (-1 == hostAddress) { 133 | Log.e(Manager.TAG, 134 | "Wrong host address transformation, result was -1"); 135 | return false; 136 | } 137 | // wait some time needed to connection manager for waking up 138 | try { 139 | for (int counter = 0; counter < 30; counter++) { 140 | NetworkInfo.State checkState = connectivityManager.getNetworkInfo( 141 | ConnectivityManager.TYPE_MOBILE_HIPRI).getState(); 142 | Log.d(Manager.TAG, "TYPE_MOBILE_HIPRI network state: " 143 | + checkState); 144 | if (0 == checkState.compareTo(NetworkInfo.State.CONNECTED)) 145 | break; 146 | Thread.sleep(1000); 147 | } 148 | } catch (InterruptedException e) { 149 | // nothing to do 150 | } 151 | boolean resultBool = connectivityManager.requestRouteToHost( 152 | ConnectivityManager.TYPE_MOBILE_HIPRI, hostAddress); 153 | Log.d(Manager.TAG, "requestRouteToHost result: " + resultBool); 154 | if (!resultBool) 155 | Log.e(Manager.TAG, 156 | "Wrong requestRouteToHost result: expected true, but was false"); 157 | 158 | return resultBool; 159 | } 160 | } -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/java/be/uclouvain/hiprikeeper/Notifications.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of HIPRI Keeper. 3 | * 4 | * Copyright 2015 UCLouvain - Matthieu Baerts 5 | * 6 | * This application is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | package be.uclouvain.hiprikeeper; 21 | 22 | import android.app.Notification; 23 | import android.app.NotificationManager; 24 | import android.app.PendingIntent; 25 | import android.content.Context; 26 | import android.content.Intent; 27 | 28 | /** 29 | * Created by Matthieu Baerts on 19/04/15. 30 | */ 31 | public class Notifications { 32 | private final NotificationManager mNotification; 33 | private final Context context; 34 | 35 | public Notifications(Context context) { 36 | this.context = context; 37 | mNotification = (NotificationManager) context 38 | .getSystemService(Context.NOTIFICATION_SERVICE); 39 | } 40 | 41 | public void showNotification() { 42 | Intent intent = new Intent(context, MainActivity.class); 43 | PendingIntent pendingIntent = PendingIntent.getActivity(context, 1, 44 | intent, 0); 45 | 46 | Notification notif = new Notification.Builder(context) 47 | .setWhen(System.currentTimeMillis()) 48 | .setSmallIcon(R.drawable.ic_stat_name) 49 | .setContentTitle( 50 | context.getResources().getString( 51 | R.string.notification_title)) 52 | .setContentText( 53 | context.getResources().getString( 54 | R.string.notification_text)) 55 | .setContentIntent(pendingIntent).build(); 56 | 57 | notif.flags |= Notification.FLAG_NO_CLEAR; 58 | 59 | mNotification.notify(1, notif); 60 | } 61 | 62 | public void hideNotification() { 63 | NotificationManager mNotification = (NotificationManager) context 64 | .getSystemService(Context.NOTIFICATION_SERVICE); 65 | mNotification.cancelAll(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/drawable-hdpi-v11/ic_stat_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/drawable-hdpi-v11/ic_stat_name.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/drawable-hdpi-v9/ic_stat_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/drawable-hdpi-v9/ic_stat_name.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/drawable-hdpi/ic_stat_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/drawable-hdpi/ic_stat_name.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/drawable-mdpi-v11/ic_stat_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/drawable-mdpi-v11/ic_stat_name.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/drawable-mdpi-v9/ic_stat_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/drawable-mdpi-v9/ic_stat_name.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/drawable-mdpi/ic_stat_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/drawable-mdpi/ic_stat_name.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/drawable-xhdpi-v11/ic_stat_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/drawable-xhdpi-v11/ic_stat_name.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/drawable-xhdpi-v9/ic_stat_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/drawable-xhdpi-v9/ic_stat_name.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/drawable-xhdpi/ic_stat_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/drawable-xhdpi/ic_stat_name.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/drawable-xxhdpi-v11/ic_stat_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/drawable-xxhdpi-v11/ic_stat_name.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/drawable-xxhdpi-v9/ic_stat_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/drawable-xxhdpi-v9/ic_stat_name.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/drawable-xxhdpi/ic_stat_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/drawable-xxhdpi/ic_stat_name.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 17 | 18 | 29 | 30 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | HIPRI Keeper 3 | 4 | HIPRI Enabled 5 | Click to change options 6 | 7 | Enable 8 | Save battery by allowing deep sleep mode 9 | The cellular connection will not be maintained on deep sleep if a WiFi connection is available 10 | 11 | -------------------------------------------------------------------------------- /HIPRIKeeper/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /HIPRIKeeper/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.1.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /HIPRIKeeper/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /HIPRIKeeper/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/HIPRIKeeper/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /HIPRIKeeper/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip 7 | -------------------------------------------------------------------------------- /HIPRIKeeper/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /HIPRIKeeper/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /HIPRIKeeper/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /MultipathControl/.gitignore: -------------------------------------------------------------------------------- 1 | ConfigServer.java 2 | -------------------------------------------------------------------------------- /MultipathControl/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.7 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.7 12 | -------------------------------------------------------------------------------- /MultipathControl/AUTHORS: -------------------------------------------------------------------------------- 1 | This project has been started by Gregory Detal. 2 | 3 | The current development is now maintained by Matthieu Baerts and Quentin De Coninck. 4 | 5 | Thanks to Carmen Alvarez for his Network-Monitor project! It was useful for the logging part. 6 | https://github.com/caarmen/network-monitor/ (Licensed under the Apache License, Version 2.0) -------------------------------------------------------------------------------- /MultipathControl/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 40 | 41 | 42 | 43 | 44 | 45 | 48 | 49 | 52 | 53 | 54 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /MultipathControl/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/MultipathControl/ic_launcher-web.png -------------------------------------------------------------------------------- /MultipathControl/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/MultipathControl/libs/android-support-v4.jar -------------------------------------------------------------------------------- /MultipathControl/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | 22 | -keep class * extends java.util.ListResourceBundle { 23 | protected Object[][] getContents(); 24 | } 25 | 26 | -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { 27 | public static final *** NULL; 28 | } 29 | 30 | -keepnames @com.google.android.gms.common.annotation.KeepName class * 31 | -keepclassmembernames class * { 32 | @com.google.android.gms.common.annotation.KeepName *; 33 | } 34 | 35 | -keepnames class * implements android.os.Parcelable { 36 | public static final ** CREATOR; 37 | } -------------------------------------------------------------------------------- /MultipathControl/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/MultipathControl/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /MultipathControl/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/MultipathControl/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /MultipathControl/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/MultipathControl/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MultipathControl/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MPTCP-smartphone-thesis/MultipathControl/6fa8658d1af373af72be1e818b323849e29490a6/MultipathControl/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MultipathControl/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 19 | 20 | 28 | 29 | 38 | 39 | 47 | 48 | 57 | 58 | 66 | 67 | 76 | 77 | 85 | 86 | 94 | 95 | 103 | 104 | 112 | 113 |