Handover Lte Wifi
Handover Lte Wifi
phones
Department of Informatics
Faculty of mathematics and natural sciences
UNIVERSITY OF OSLO
Spring 2019
WiFi to LTE handover in mobile
phones
http://www.duo.uio.no/
Today many devices like laptops and smartphones have access to both WiFi
and LTE at the same time. The reliability and performance of wireless
networks and the Internet is not perfect. Sometimes users need to manually
disconnect devices from slow or unreliable WiFi networks in order to
switch to LTE. The Android operating system already includes a way
to automatically switch to using LTE when the connected WiFi network
becomes unstable. In this thesis we analyse this switching between WiFi
and LTE in Android. We do this by emulating various network conditions
in order to provoke an Android phone to switch from WiFi to LTE.
We show that the Android phone sometimes can stay connected to WiFi
network networks even when there is very poor Internet access. Informed
by this we propose and implement a simple algorithm to disconnect
from WiFi networks that are performing poorly. We show that our
implementation is more consistent in switching to LTE from WiFi networks
with poor performance, however it also leads to much higher overhead in
terms of data usage.
i
ii
Contents
1 Introduction 1
1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Problem statement . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Scope and limitations . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Research method . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Main contributions . . . . . . . . . . . . . . . . . . . . . . . . 3
1.6 Thesis structure . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Background 5
2.1 WiFi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Cellular networks . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Handover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3.1 Horizontal handover . . . . . . . . . . . . . . . . . . . 6
2.3.2 Vertical handover . . . . . . . . . . . . . . . . . . . . . 6
2.3.3 Handover control . . . . . . . . . . . . . . . . . . . . . 7
2.3.4 The handover process . . . . . . . . . . . . . . . . . . 7
2.3.5 Soft vs hard handover . . . . . . . . . . . . . . . . . . 7
2.3.6 The ping-pong effect . . . . . . . . . . . . . . . . . . . 8
2.3.7 The focus of this thesis . . . . . . . . . . . . . . . . . . 8
2.4 Handover in Android . . . . . . . . . . . . . . . . . . . . . . . 8
2.5 Network performance metrics . . . . . . . . . . . . . . . . . . 9
2.5.1 Bandwidth and throughput . . . . . . . . . . . . . . . 10
2.5.2 Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5.3 Packet loss . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5.4 Signal strength and signal to noise ratio . . . . . . . . 10
2.6 captive portals . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.7 Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.8 summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3 Methodology 17
3.1 Experimental setup . . . . . . . . . . . . . . . . . . . . . . . . 17
3.1.1 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.1.2 choice of operating systems . . . . . . . . . . . . . . . 20
3.1.3 Router configuration . . . . . . . . . . . . . . . . . . . 20
3.1.4 software tools . . . . . . . . . . . . . . . . . . . . . . . 20
3.2 WiFi to LTE handover experiments . . . . . . . . . . . . . . . 21
3.2.1 Signal strength . . . . . . . . . . . . . . . . . . . . . . 21
iii
3.2.2 Captive Portal . . . . . . . . . . . . . . . . . . . . . . . 22
3.2.3 Prerequisites to run to automate experiments . . . . . 23
3.2.4 Traffic control in linux . . . . . . . . . . . . . . . . . . 23
3.2.5 Android automation with ADB . . . . . . . . . . . . . 24
3.2.6 Testing performance thresholds for triggering han-
dover . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.2.7 Testing how long it takes before handover is initiated. 27
3.3 Battery consumption . . . . . . . . . . . . . . . . . . . . . . . 27
3.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6 Conclusion 55
6.1 Summary of contributions . . . . . . . . . . . . . . . . . . . . 55
6.2 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
iv
List of Figures
3.1 Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2 hardware setup . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.3 Transmit power configuration . . . . . . . . . . . . . . . . . . 22
3.4 This figure shows the steps we used to find out if handover
is triggered at a boundary value for various network perfor-
mance metrics. First the phone connects to WifI, then we
apply a command on the router to create packet loss, de-
lay or other network conditions. We keep three variables,
limit, upper_limit and lower_limit. Limit is used as a param-
eter to determine for example how many kbps of through-
put to allow. Then based on if handover is detected or not,
we update the variable_upper limit or lower_limit. Then we
update limit and check if upper_limit and lower_limit have
converged. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.5 Procedure for measuring time until handover initiation. . . . 29
4.1 Frequency of ping packets sent from the mobile phone when
Smart network switch disabled. The X axis is time in seconds
and Y axis is packets per second. . . . . . . . . . . . . . . . . 39
4.2 Frequency of ping packets sent from the mobile phone when
Smart network switch is set to aggressive. The X axis is time
in seconds and Y axis is packets per second. . . . . . . . . . . 40
4.3 Ping packets between phone and router captured by TCP-
dump with packet loss created by the router. . . . . . . . . . 41
4.4 captive portal check in Android . . . . . . . . . . . . . . . . . 42
v
vi
List of Tables
vii
viii
Listings
ix
x
Preface
xi
xii
Chapter 1
Introduction
1.1 Motivation
Smartphones often have access to both WiFi and cellular networks. There
are many factors that can affect the quality of wireless networks. Poor
network quality can prevent the use of resources over the Internet. In
our opinion having to manually switch between networks in order to
determine the best one is not optimal. This is illustrated in Figure 1.1 on
the following page.
Network connectivity can fail in many different ways. I often want
to access the Internet through my phone while waiting for the microwave
oven to finish. This is usually impossible even with good signal strength.
The phone stays connected to WiFi, but interference from the microwave
oven makes it completely impossible to reach anything on the Internet.
Another annoying situation is when you are waiting for a buss or similar
outside of your home or office. At this distance your phone might still
be able to maintain contact with the WiFi access point, but due to the low
signal strength the connection can be very unreliable.
By 2021 smartphone traffic is expected to exceed PC traffic, and more
than 63 percent of total IP traffic will be caused by mobile and wireless
devices.[7] If it is possible to make any sort of improvement to the way
mobile phones handle multiple network connections that would be quite
useful.
Switching from one network to another is called a handover, and
Android phones already includes the ability to automatically switch from
WiFi to LTE when the WiFi network becomes unstable. However, our
subjective experience as users of android phones is that the phones
sometimes gets stuck on poor WiFi networks even when the most
aggressive handover settings are applied. In this thesis we investigate
experimentally whether this actually is the case.
1
Figure 1.1: xkcd: WiFi vs cellular [43]
access to both WiFi and mobile network connections. In this thesis we will
examine handover from WiFi to LTE in Android phones. More specifically
we will attempt to answer the following two research questions:
2
There are many different manufacturers of Android based smart-
phones, and the handover process might be handled differently in Android
based smartphones made by other manufacturers and it could change in
newer versions of Android.
The ACM task force on the core of computer science proposed three
research paradigms for computer science [8]. These are theory, abstraction
and design.
In the theory paradigm one follows four steps to develop a coherent
and valid theory. These are: (1) characterize objects of study(definition),
(2) hypothesize possible relationships among them(theorem), (3) determine
whether the relationships are true (proof) and (4) interpret results.
The abstraction paradigm is used in the investigation of a phenomenon
and consists of the steps: (1) form a hypothesis, (2) construct a model and
make a prediction, (3) design an experiment and collect data (4) analyse
results.
The final paradigm is design, which is rooted in engineering and
consists of four steps. These are described in the report in the following
way; (1) state requirements, (2) state specifications, (3) design and
implement the system, (4) test the system.
The research method for this thesis support the design paradigm
through proposing an system for automatically initiating handover from
WiFi to LTE and then implementing and testing this system. In our
methodology we analyse an existing system for handover in Android,
then we develop a prototype for a new system and test the prototype in
comparison to the existing system.
The main contributions we have done during the work on this master
thesis is firstly to perform experiments to evaluate the existing solution
to automatic handover from WiFi to LTE in Android phones. We find that
Android does manage to handover to LTE, but that it often takes more than
a minute of being connected to a WiFi network with practically no Internet
access before handover is initiated. We also attempt to analyse how the
handover mechanism in Android works and why it performs the way it
does.
Secondly, informed and motivated by the results of analyzing handover
in Android and related works, we have proposed an alternative way to
automatically initiate handover. Finally, we compare it with the existing
solution in Android.
3
1.6 Thesis structure
This thesis is organized as follows. Chapter 2 covers the relevant
background and related work. We describe how handover algorithms can
be defined, and how different handover algorithms can be classified. Then
we cover metrics for measuring network performance, which can be used
as part of the handover decision. Finally, we look at some other relevant
studies of handover algorithms.
Chapter 3 describes the methodology we used to answer the research
questions. It covers the hardware and software setup and the procedure
for how we performed experiments.
In chapter 4 we analyse the results of performing the experiments
described in chapter 3 with the existing handover mechanism in Android.
We look at how handover was triggered by packet loss, high delay and low
data throughput. We also look at how long it takes to trigger handover in
Android.
In chapter 5 we propose a new algorithm for initiating handover, which
is motivated by the results presented in the previous chapter. We also
present the results of performing experiments to test how handover is
triggered and how long it takes to trigger handover on the proposed
algorithm and compare the results of this with the results of the testing
the existing Android handover mechanism.
Finally in chapter 6 we conclude the thesis with a summary of what
we have presented and the most important conclusions in addition to
discussing potential future work.
4
Chapter 2
Background
The focus in this thesis is preventing mobile phones with access to both
WiFi and LTE from being stuck on WiFi network with no or poor Internet
access. We start this chapter by briefly cover what LTE and WiFi are.
Then we discuss the basics of handover. Switching from one network to
another is called a handover, and We will elaborate on how handover can
be defined and classified and the different kinds of handover algorithms
that exist. We also discuss the options for automatically switching from
WiFi to LTE that already exist in Android. After this, we also discuss and
some metrics that can be used to evaluate network performance. These can
potentially be used as parameters for the decision of initiating handover.
Finally we will discuss existing work that has been done on handover
algorithms.
2.1 WiFi
Wireless local area networks (WLAN) are wireless computer networks
where two or more computers form a network using wireless communica-
tion. WLANs are typically at the scale of a building and are commonly used
within homes and companies. WiFi is a set of communication standards
for WLAN. It contains specifications for the data-link layer and physical
layer of the Open Systems Interconnection (OSI) model. These specifica-
tions are for implementing wireless communication in the 2.4GHz, 5GHz,
and 60GHz frequency bands. Table 2.1 on the next page shows an overview
of WiFi generations. In addition to the ones listen in the table the WI-FI Al-
liance has introduced 802.11ax, which is also know as WiFi 6 and will be
the next generation WiFi standard. The router we are using in this thesis is
using the 802.11ac wave 1 standard.
5
Standard release year
Legacy 802.11 1997
802.11b 1999
802.11a 1999
802.11g 2003
802.11n 2009
802.11ac wave 1 2014
802.11ac wave 2 2016
Generation Technologies
1G NMT, AMPS, TACS
2G GSM, IS-136, PDC, IS-95
3G WCDMA/HSPA, cdma2000, TD-SCDMA
4G LTE
2.3 Handover
Handover or handoff is the process where a network node changes or
attempts to change its attachment point to a network. Within the literature,
the terms "handoff" and "handover" are used interchangeably according to
[31]. In this thesis the Android phone takes the role of the network node.
Handover can be classified into different types based on various aspects
involved [24]. The following subsections discuss some of these types and
how they relate to handover from WiFi to LTE.
6
to allow seamless roaming among multiple access network technologies,
and they also need to be designed to provide the quality of service that is
required by a wide range of applications.
Handover can also be classified as soft or hard. The terms soft and hard
handover are defined for the UMTS system [23]. Hard handovers are also
known as break-before-make. In this type of handover the connection to
the old cell is released before a connection to the new cell is established.
Soft handovers are also known as make-before-break. In this variant
connection to the old cell is not broken before connection to the new cell is
established. It is possible that both connections will be used simultaneously
for a long period of time in soft handover.
The terms soft and hard handover are also used in the context of vertical
handover. Here an example of a soft handover could be that the mobile
terminal executes handover from WiFI to LTE, but retains connection to the
WiFi access point while using the LTE connection.
7
2.3.6 The ping-pong effect
The ping-pong effect was introduced in the context of horizontal handover
in cellular networks. When a mobile node is moving at the boundary
between the two base stations, rapid changes in received signal strengths
could force the node to hand over from one base station to the next and
then back to the original again. The mobile node may continue to "ping-
pong" between the base two stations until it moves sufficiently far into the
coverage of one of them [31].
The ping-pong effect is also used to describe undesired handing back
and forth between networks in the context of vertical handover. For
example, some of the vertical handover algorithms surveyed in [44] use
heuristics to eliminate the ping-pong effect.
8
Figure 2.1: WiFi handover related settings in Android
options one must first enable developer mode. On Samsung devices this
is done by touching build number under software info in the settings
app[19]. The fact that the setting to more aggressively switch over from
WiFi to cellular is only accessible in developer options suggests that it is
not yet meant to be used by ordinary users and that it still might be under
development.
In this thesis we will investigate if these settings actually can prevent
the problem of getting stuck on a WiFi network with poor connectivity, and
why they how they solve or don’t solve the problem. By using experiments
in a controlled setup we can investigate if Android phones actually do get
stuck on poor networks without initiating handover and if applying these
settings makes any difference. If we find that the mobile phone does get
stuck, then we can use the results as a basis for comparison that we can use
in our attempt to improve the handover behavior.
9
cope with various performance problems in the networks.
In [17] Hanemann et al. have created a study on network performance
metrics and their composition. There they provide explanations of some
network performance metrics. The metrics relevant for this thesis will be
explained in this section.
2.5.2 Delay
The delay metric can be either one way delay (OWD), which measures how
much time it takes to transfer a packet from the sender to the destination,
or it can be round trip time(RTT) which is the time it takes to send it takes
to send a packet from sender to receiver and to send a reply back again.
Packet loss indicates how many of the sent packets that are lost. It is usually
measured as the percentage of packets lost compared to the total number of
packets. There are various reasons that packets can get lost in the network.
For example, transmission errors or congestion.
10
2.6 captive portals
Captive portals are used to restrict access to public WiFi networks.
When a user connects to a WiFi network they get redirected to a web
portal where they can log in to gain access to the Internet. Captive
portals are relevant to this thesis because they restrict Internet access and
therefore makes it impossible to reach the Internet for devices that have
not been authenticated. If the captive portal somehow is not detected
when connecting to WiFi, then the result is that the phone could end up
connected to the unusable WiFi without handing over to LTE. Another
potential problem with captive portals is that a device might become
deauthenticated after using the network for some time and therefore be
prevented from accessing the Internet. The phones should be able to detect
that Internet access is no longer available, and maybe do a handover to
LTE.
We typically find captive portals in places like hotels or airports. So a
potential scenario where a captive portal causes problems would be that
you are visit a hotel you have stayed at before and your phone connects
to the WiFi which is known from the previous visit. Internet access is
restricted by the captive portal and you need to get a password from the
staff before you can log in. In this situation the phone should correctly
detect the captive portal and prompt the user to authenticate or disconnect.
11
Received signal strength (RSS) RSS is used as the main criterion in
the majority of existing horizontal
handover algorithms and is also
an important criterion for vertical
handover algorithms.
12
handover delay This is a measure of the total time
of the handover process, from ini-
tiation to completion. Handover
delay is affected by the complex-
ity of process and is especially im-
portant for voice and multimedia
which are sensitive to delay or in-
terruptions.
13
RSS based algorithms This class of algorithms use RSS
as the main criterion for taking the
handover decision.
14
In [22] Inzerilli et al. proposes a location based handover algorithm
with the goal of limiting the ping-pong effect and maximizing goodput.
The algorithm they propose is a mobile controlled, soft and vertical
between WiFi and UMTS. They then evaluate the performance of their
algorithm versus a power based algorithm using simulation. Their results
show that the location based algorithm reduces the number of handovers
compared to the power based algorithm, thus reducing the ping-pong
effect. They also show that there is a reduction in cumulative received
bits with the location based algorithm versus the power based one. So the
power based algorithm needs a waiting time constraint between handovers
to increase stability and reduce number handovers. On the other hand
this waiting time constraint should not be applied to the location based
algorithm to limit the reduction in cumulative received bits.
Both [28] and [13] focus on selecting the best wireless interface. This
thesis is different in that it focuses on the handover initiation decision
instead of selecting between handover candidates. Another difference
is that [13] uses a server component in its bandwidth estimation. The
algorithm in this thesis will not use a server component.
15
2.8 summary
In this chapter we discussed background and related works about han-
dover algorithms. This includes the basics of handover algorithms and
how they can be classified in different ways. Additionally, we discussed
how the focus of this thesis fits into these classifications. The chapter also
includes a discussion of the options for handover from WiFi to LTE that
exist in Android today. To the best of our knowledge, there does not ex-
ist detailed documentation of how these are implemented. This further
motivates investigating how the handover mechanism works in Android.
Finally, we discussed related studies about vertical handover algorithms.
The next chapter elaborates the experimental setup and the experiments
performed in order to answer the research questions. We analyse how han-
dover works in Android, and if Android devices get "stuck" on a network
with poor connectivity instead of doing a handover to an alternative net-
work.
16
Chapter 3
Methodology
3.1.1 Hardware
The hardware resembles a typical network setup found in a home or office,
and should be representative of the networks that an Android phone would
17
Figure 3.1: Setup
For the Android phone we use a Samsung Galaxy S7. According to [35]
the galaxy S7 was the best selling smartphone in H1 2016, so this phone is
one of the most widely used models and should be a good representation
of Android phones in use by people today.
For the router we use a TP-link AC1750[4]. This router is compatible
with with the OpenWrt[29] operating system. [18] gives more detailed
hardware specifications than those provided by the manufacturer. These
can be seen in table 3.1 on the facing page.
18
Figure 3.2: hardware setup
19
3.1.2 choice of operating systems
We use Android 7.0 as the operating system for the phone. Newer versions
of Android have been released, however for consistency we have decided
to focus on Android 7.0 throughout the work with this thesis. According
to [12] the combination of devices running either android 7.0 or 7.1 makes
up 28.2 % of all Android devices, making Android 7 the most used major
version of Android.
OpenWrt is an open source linux based operating system for emebeded
devices. It gives us more control over the router than the factory firmware,
including the ability to change wireless signal strength and simulating
packet loss, which is necessary for experimenting with handover.
The specific version of the operating systems are listed below.
• Nodogsplash 3.2.1-1
20
Listing 3.1: Capturing packets with tcpdump
$ tcpdump − i INTERFACE −v −w FILENAME
Nodogsplash
The command in Listing 3.2 on the next page can be used to obtain a
list of client connected to the wlan0 interface and their signal strengths. On
21
Figure 3.3: Transmit power configuration
the phone we can write the rssi value to the system log when handover is
initiated.
By polling this command while the phone disconnects we can get see
the last values for signal strength and signal to noise ratio before the phone
disconnected.
22
Listing 3.4: Throughput limit with tbf
$ t c q d i s c add dev wlan0 r o o t t b f r a t e LIMIT k b i t
b u r s t 100 k b i t l a t e n c y 50ms
23
Listing 3.5: Setting delay with netem
$ t c q d i s c add dev INTERFACE r o o t netem delay TIME
[27] is another queuing discipline for the linux packet scheduler. It provides
the ability to emulate various network properties like delay and packet loss.
Listing 3.5 shows an example command for setting delay with netem, and
Listing 3.6 shows an example of setting loss.
The Android API provides the ability to get notified about network
changes through the NetworkCallback class [10], which provides several
callback funcions. Applications wanting notifications about network
changes can extend this class and then register a NetworkCallback.
Listing 3.11 on page 26 shows example code that extends the Network-
Callback class by overriding the onCapabilitiesChanged and onLost meth-
24
Listing 3.8: Broadcast with adb
$ adb s h e l l am b r o a d c a s t −a WifiChange −e w i f i t r u e
public c l a s s C o n t r o l W i f i extends B r o a d c a s t R e c e i v e r {
public void onReceive ( Context c , I n t e n t i n t e n t ) {
WifiManager wfm = ( WifiManager ) c .
g e t S y s t e m S e r v i c e ( Context . WIFI_SERVICE ) ;
wfm . s e t W i f i E n a b l e d ( Boolean . parseBoolean ( i n t e n t
. getStringExtra ( " wifi " ) ) ) ;
}
}
25
Listing 3.11: Detecting WiFi handover in Android
ConnectivityManager c o n n e c t i v i t y M a n a g e r = (
ConnectivityManager ) g e t S y s t e m S e r v i c e ( Context .
CONNECTIVITY_SERVICE ) ;
NetworkRequest . B u i l d e r b u i l d e r = new NetworkRequest .
Builder ( ) ;
connectivityManager . registerNetworkCallback (
builder . build ( ) ,
new ConnectivityManager . NetworkCallback ( ) {
public void onLost ( Network network ) {
Log . i (TAG, " network " + network + "
lost . " ) ;
}
26
3.2.6 Testing performance thresholds for triggering handover
Figure 3.4 on the following page shows the algorithm in the testing script.
The first step is to initialize the upper and lower limit. These could be
percentage of dropped packets or data rates. Then WiFi is enabled on the
phone so that it connects to the WiFi network. Next we apply some sort
of traffic shaping on the router like explained in section 3.2.4 on page 23.
Then we wait for a set period of time while monitoring for handover in the
phone. Next upper or lower limit is updated based on whether handover
was triggered or not. Then we update the limit variable to be the average of
upper and lower limit. Then the process is repeated until upper and lower
limit close in on each other and we find the threshold value that will trigger
handover.
27
start
(re)connect to WiFi
no yes
upper limit = limit handover? lower limit = limit
upper limit -
no lower limit < 10
yes
end
Figure 3.4: This figure shows the steps we used to find out if handover is
triggered at a boundary value for various network performance metrics.
First the phone connects to WifI, then we apply a command on the router
to create packet loss, delay or other network conditions. We keep three
variables, limit, upper_limit and lower_limit. Limit is used as a parameter
to determine for example how many kbps of throughput to allow. Then
based on if handover is detected or not, we update the variable_upper
limit or lower_limit. Then we update limit and check if upper_limit and
lower_limit have converged.
28
start
connect to WiFi
end
Now we can open bugreport.zip in the battery historian tool and inspect
device power usage of the running apps.
3.4 Summary
In this chapter we have covered the setup used in the experiments in this
thesis. This includes the devices used and the software packages installed.
In addition we covered the procedures used in the various tests, which
includes using logging and callback functions to read changes in the WiFi
state in the Android phone and using adb to control the phone and ssh to
control the openwrt router from scrips running on computer. Finally, we
covered how to generate an Android debug log which contains detailed
information about power usage. In the next chapter we will look at the
results of running the experiments described in this chapter on the existing
handover mechanisms in Android.
29
30
Chapter 4
31
Boundary for triggering handover.
gradually adjusting throughput
gradually adjusting delay
gradually adjusting packet loss
physically moving phone away from router to adjust signal strength
How long does it take to trigger handover?
Time from limiting throughput until handover is initiated
Time from adding delay until handover is initiated
Time from adding packet loss until handover is initiated
Captive portal
Internet is no longer reachable because of deauthentication from captive
portal.
with the handover setting in Android called "smart network switch" turned
off, with the setting set to normal and with the setting set to aggressive. As
expected we do not get handover when "smart network switch" is turned
off.
In the remainder of this section we look at the results of how the
existing handover mechanism in Android behaves when we simulate
various network conditions with the router.
32
setup mean standard deviation
Smart network switch 970ms 213,3ms
normal
Smart network switch 377.3ms 160ms
aggressive
Smart network 580ms 67,7ms
switch aggressive
and streaming video
Even with the high variation indicated by the standard deviation and
skewed results we can still see a trend. It is clear that enabling the handover
setting actually causes handover when the delay becomes higher, and that
the threshold for taking the handover decision is lower with the aggressive
setting. When we had smart network switch set to aggressive and a video
steaming to the phone the mean threshold for added delay needed to
trigger handover actually increased to 580ms. One possible reason for this
might be that the algorithm for smart network switch keeps track of how
many bytes are sent and received by the phone and that because the video
stream is generating traffic that indicates that there is some connectivity
despite the high delay.
[14] recommends that one-way end-to-end delay should be kept below
150ms for high quality voice communication, but it also notes that delays
between 150ms to 400ms are still acceptable. The mean value for the
aggressive setting does fall within this 400ms acceptable value, but it might
also be advantageous to have an even more aggressive option that to assure
meeting the 150ms recommendation.
33
setup mean standard deviation
Smart network switch 38,7% 10,4%
normal
Smart network switch 8,2% 3,2%
aggressive
Smart network 15,8% 5,2%
switch aggressive
and streaming video
purposes than VoIP, and reliable protocols like TCP ensures retransmits of
lost packets, so instating handover in networks with a mere one percent
packet loss is probably not desireable.
Table 4.4 on the next page shows the results of the experiments where
we set limits on throughput to provoke handover. The leftmost column
contains the settings we used on the mobile phone. We remember from
section 2.4 on page 8 in the background chapter, that Android includes a
setting called smart network switch, which can be set to off, aggressive
or normal, and is supposed to automatically switch to using LTE when
the Internet connection on WiFi becomes unstable. The middle column
shows the mean of 30 repetitions and the rightmost column shows standard
deviation.
The mean throughput value were handover was triggered with smart
network switch set to normal was only 11,3 kbps, and with the aggressive
setting it was 198kbps. streaming a video to the phone while throughput
is limited gives a mean threshold of 173kbps. For these the values for
standard deviation are 9,7kbps, 40,2kbps and 53,1kbps respectively. Unlike
the experiments with packet loss and delay the test with streaming video
does not give very different results from the tests without streaming video.
Because throughput is limited here streaming video results in buffering
and lower values for total bytes received by the phone is not a good
indication of good performance of the WiFi network. This can be a possible
explanation for why the result look the way they do.
The threshold for the normal setting is so low that it is not useful in
many situations. For example, trying to load most webpages will result
in a timeout if we only have 11kbps available. 200kbps is also quite low,
however it is possible to load webpages with this value. The requirements
for streaming videos on YouTube is 500kbps and the requirements for
steaming live movies, TV shows and live broadcasts is 1+ Mbps[37]. So
for the purposes of video streaming an even more aggressive handover
algorithm could be beneficial.
34
setup mean standard deviation
Smart network switch 11,3kbps 9,7kbps
normal
Smart network switch 198kbps 40,2kbps
aggressive
Smart network 173kbps 53,1kbps
switch aggressive
and streaming video
35
setup RSSI read DBM read
by phone by router
mean standard mean standard
deviation deviation
Smart net- -84,8 3,4 -83 3,85
work switch
normal
Smart net- -85,33 3,1 -76 4,4
work switch
aggressive
Aggressive -86,2 1,3
WiFi to
mobile
handover
36
setup mean time before standard deviation
handover
Throughput limited to 75s 28,5s
50kbps
700ms delay 95.9s 71.7s
50% packet loss 35.1s 23.6s
handover was 12.5s for the test with limited throughput, 145.5s for the tests
with 700ms added delay and 52.8 seconds for the tests with 50% packet
loss. Compared to the tests without streaming a video to generate traffic
handover was much faster for the test with limited throughput. On the
other hand it was somewhat slower, though not by a meaningful amount,
in the other tests. The result with limited throughput seems to suggest that
bytes received by the phone is used as part of the smart network switch
handover mechanism.
In most of the scenarios the phone takes more than a minute to
handover, and there is quite a high variation in how long it takes from
the network performance becomes poor and until handover is initiated.
The aggressive handover setting does help with switching from low
performance WiFI to LTE, however it is quite inconsistent. Even though
the WiFi is practically useless it sometimes fails completely or takes several
minutes to initiate handover. In situations where the a user actively is using
the phone’s Internet connection, for example streaming a video or using
voice over IP,it most likely becomes necessary for the user to disconnect
from WiFi manually in order to restore Internet connectivity.
One possible reason for taking a long time to initiate handover is to
avoid handover in cases where an issue arises in the network but resolves
it self after a few seconds. In such cases it might not be desireable to hand
over to LTE in order to avoid the higher cost which is often associated with
LTE.
In the background chapter one of the vertical handover decision criteria
we presented is network connection time. According to Yan et al. [44],
it is important to keep track of network connection time in order to
choose the right moment to trigger handover. In the survey they say
that initiating handover from WLAN to a cellular network too early
would waste network resources, and that being too late would result in a
handover failure. Therefore, another possible reason for the slow handover
initiation would be avoiding waste of network resources.
37
setup mean time before standard deviation
handover
Throughput limited to 12.5s 6.5s
50kbps
700ms delay 145.5 97.9
50% packet loss 52.8s 46.25s
Table 4.7: Time taken before making the handover decision while streaming
video.
Figure 4.2 on page 40 and 4.1 on the next page shows the frequency
of ping packets sent from the Android phone to the router with time in
seconds on the X axis and packets per second ond the Y axis. These
were generated by capturing packets from the phone using TCPdump and
filtering the packets using wireshark. Figure 4.2 on page 40 shows the
frequency of sending ping packets when the smart network switch setting
was set to aggressive. In the figure we can see that nine ping packets was
sent at first and then it sends pings in groups of four packets with about
10 second intervals. After two minutes groups of only two packets are sent
instead of four and the interval stays about the same. It is possible that
the reason for sending more packets in the beginning is part of validating
the connection upon connecting to a WiFi network, and then the number
of packets is reduced to reduce overhead.
Figure 4.1 on the next page shows the frequency of sending ping packets
when smart network switch was disabled. In this figure ping packets are
sent in the phone first sends four ping packets and then after about 30
seconds it sends four packets again, and after this four packets are sent
with 60 second intervals.
By comparing the graphs we can see that the frequency of sending
ping packets is higher when we set smart network switch to aggressive vs
when smart network switch is disabled, with roughly 10 second intervals
between sending pings with smart network switch in comparison to
roughly one minute intervals with smart network switch disabled.
Figure 4.3 on page 41 shows part of a TCPdump where the Android
phone was connected to the OpenWrt router with the "smart network
switch" setting set to aggressive. In this figure the first column shows
the time of day instead of seconds since last displayed packet, and it also
includes a column with info about the packets . It shows that the Android
phone is sending ping requests to the wireless router and getting reply
packets back. When the time was 13:42:00 we applied a 50% packet loss on
the router. By looking at the timestamps in the figure we can see that not
all the ping requests are getting replies any more. At 13:42:44 the phone
handed over to LTE. After this the phone was still connected to the WiFi
router but it stopped sending pings. This suggests that the pinging is used
as part of the decision to hand over from WiFi.
38
39
Figure 4.1: Frequency of ping packets sent from the mobile phone when Smart network switch disabled. The X axis is time in seconds
and Y axis is packets per second.
40
Figure 4.2: Frequency of ping packets sent from the mobile phone when Smart network switch is set to aggressive. The X axis is time in
seconds and Y axis is packets per second.
Figure 4.3: Ping packets between phone and router captured by TCPdump
with packet loss created by the router.
41
Figure 4.4: captive portal check in Android
When an Android device connects to a WiFi network it will make a DNS re-
quest to get the address of connectivitycheck.gstatic.com Then the Android
device makes an HTTP get request to connectivitycheck.gstatic.com. If 204
No Content is received as a response then there is no captive portal an the
device can connect normally. This can be seen in Figure 4.4. Otherwise, if a
307 temporary redirect is received then there is a captive portal on the WiFi
network.
42
Setup observation
Smart network switch off and ag- A few seconds after deauthentica-
gressive WiFi to mobile handover tion “Internet may not be avail-
off able” is displayed in the WiFi set-
tings menu, and the phone is still
connected to the WiFi access point.
The phone is now using LTE when
opening a webpage etc
Smart network switch normal “connected” is still displayed 2
min after deauthentication, and
the phone is still connected to the
WiFi access point.
Loading web pages or using the In-
ternet is not possible before manu-
ally disconnecting from WiFi.
Smart network switch aggressive Same behavior as Smart network
switch normal
Aggressive WiFi to mobile han- Same behavior as smart network
dover switch off and aggressive WiFi to
mobile handover off
43
44
Chapter 5
45
while true do
rtt, loss ← PING ()
if loss > threshold or rtt > threshold then
INITIATE H ANDOVER ()
end if
rx ← CHECK R X ()
if rx < threshold then
HTTP D OWNLOAD
if timeout then
INITIATE H ANDOVER ()
end if
end if
S LEEP
end while
In the next chapter we will look at the effect of adjusting the parameters
of the algorithm and how it compares with current handover in Android.
46
start
connect to WiFi
no
MonitorRX
yes
RX > targetRX
no
no timeout
test download
timeout
Initiate handover
end
47
setup mean standard deviation
Smart network switch 970ms 213,3ms
normal
Smart network switch 377.3ms 160ms
aggressive
Smart network 580ms 67.7ms
switch aggressive
and streaming video
New handover Algo- 205ms 15.2ms
rithm
that the throughput threshold for initiating handover ends up quite close
to 500kbps when using this timeout. Timeout and rtt are compared directly
with the results from ping so these can easily be adjusted. We propose
for instance using 300ms as the upper boundary for delay which means
that we achieve the 150ms one-way delay which is recommended by [14]
and for instance not accepting more than 10 % packet loss which is close
what we saw when testing the aggresive setting of smart network switch
in Android.
48
setup mean standard deviation
Smart network switch 38,7% 10,4%
normal
Smart network switch 8,2% 3,2%
aggressive
Smart network 15,8% 5,2%
switch aggressive
and streaming video
New handover Algo- 7,6% 3,8%
rithm
49
setup mean time before standard deviation
handover
Android smart network switch aggressive
Throughput limited to 75s 28,5s
50kbps
700ms delay 95,9s 71,7s
50% packet loss 35,1s 23,6s
New handover algorithm with sleep set to 0 seconds
Throughput limited to 6,6s 3,1
50kbps
700ms delay 7,3s 3,6s
50% packet loss 6,6s 3,3s
New handover algorithm with sleep set to 20 seconds
Throughput limited to 18,2s 7,2s
50kbps
700ms delay 17,3s 9,3s
50% packet loss 14,9s 10s
50
The higher mean for the tests with delay could be because the increased
delay causes it to take a longer time before the ping response packets arrive
at the phone.
For the set of tests with a 20 second sleep the mean times before
handover are 18,2 seconds with a standard deviation of 7.2s for limited
throughput 17,3 seconds with a standard deviation of 9,3 seconds for the
tests with added delay and finally 14,9 seconds with 10 seconds standard
deviation for the packet loss tests.
The results in this section have shows that When we run tests more
frequently we can initiate handover more quickly in the event of loss of
Internet connectivity or poor performance. In the next section we look at
the overhead of running this algorithm.
5.3 Overhead
5.3.1 Data usage
To estimate data usage we started by using tcpdump to capture all traffic
generated when executing ping and when downloading a webpage. The
rest of the time the process is either sleeping or monitoring RX which does
not send any data over WiFi.
The size of each ping packet is 98 bytes and we are sending 10 ping
packets and receiving 10 in reply if there is no loss. In the download test
we are downloading https://www.google.com. The get request to start the
download as captured in tcpdump is 255 bytes. At this time the total size
of the received packets containing the google webpage is 47398 bytes. The
total download for one round of the active tests is 98 ∗ 10 + 47398 bytes,
and total upload is 98 ∗ 10 + 255. The total data usage in day depends on
the frequency of the active tests of the algorithm. The goal of the algorithm
is to automatically disconnect from WiFi when performance is insufficient
to remove the need for users to manually disconnect from the WiFi access
point. Therefore we don’t need to run the algorithm when WiFi is disabled
or when the phone is not in use like when the screen is off.
We also used TCPdump to capture packets from the phone to compare
data usage of the existing handover method vs the algorithm proposed in
this thesis. As we saw in section 4.3 on page 37, Android is sending ping
packets to the default gateway and when we activate the aggressive smart
network switch it sends pings more frequently.
The participants in a study by Andrews et al. [2] used their mobile
phones for a total of 5.05 hours each day. Assuming that the phone is
connected to WiFi and used for 5 hours a day we can estimate the total
data usage of running the proposed handover initiation algorithm. The
download test will only be executed when the measured RX is low, but to
get a worst case estimate we assume that the measured RX always is so low
that the download test will be executed.
In Figure 5.3 on the following page we see a comparison of the effect of
adjusting parameters of the algorithm. How much data is used depends on
51
Data usage
160000
140000
the frequency of the active tests. Active tests, in the form of a file download
or ping, are not done during the sleep period, and they are not done during
the period of monitoring RX on the phone. When we decrease the values
of these parameters we see that the data usage is increased.
52
Battery usage
1.20%
1.00%
Battery usage
0.80%
0.60%
0.40%
0.20%
0.00%
sleep 0 sec, monitor sleep 0 sec, monitor sleep 10 sec, monitor sleep 20 sec, monitor
RX 1 sec RX 5 sec RX 5 sec RX 5 sec
53
54
Chapter 6
Conclusion
55
the real world performance of these algorithms and to see if this is in line
with the results form running simulations.
In the proposed algorithm we, used a file transfer as an active test of the
throughput of the WiFi network. If we had developed a server in addition
to the code running on the Android phone itself then we could have tried
other bandwidth estimation techniques, which for example could result in
lower overhead in data usage.
56
Bibliography
57
[12] Distribution Dashboard. URL: https : / / developer . android . com / about /
dashboards (visited on 03/03/2019).
[13] Paweł Foremski and Krzysztof Grochla. “LTE or WiFi? Client-Side
Internet Link Selection for Smartphones.” In: Computer Networks.
Ed. by Piotr Gaj, Andrzej Kwiecień, and Piotr Stera. Springer
International Publishing, 2015, pp. 43–53. ISBN: 978-3-319-19419-6.
[14] G.114 : One-Way Transmission Time. URL: https://www.itu.int/rec/T-
REC-G.114-200305-I/en (visited on 03/11/2019).
[15] GitHub - Google/Battery-Historian: Battery Historian Is a Tool to Analyze
Battery Consumers Using Android "Bugreport" Files. URL: https : / /
github.com/google/battery-historian (visited on 04/24/2019).
[16] GitHub - Nodogsplash/Nodogsplash: Nodogsplash Offers a Simple Way
to Provide Restricted Access to an Internet Connection Using a Captive
Portal. Pull Requests Are Welcome! URL: https : / / github . com /
nodogsplash/nodogsplash (visited on 11/10/2018).
[17] Andreas Hanemann et al. “A Study on Network Performance Metrics
and Their Composition.” In: Campus-Wide Information Systems 23.4
(Aug. 2006). Ed. by Ingrid Melve, pp. 268–282. ISSN: 1065-0741. DOI:
10.1108/10650740610704135. URL: http://www.emeraldinsight.com/
doi/10.1108/10650740610704135 (visited on 11/15/2018).
[18] Tim Higgins. TP-LINK Archer C7 V2 Reviewed. URL: https : / / www .
smallnetbuilder.com/wireless/wireless-reviews/32498-tp-link-archer-c7-
v2-reviewed (visited on 02/24/2019).
[19] How Do I Turn on the Developer Options Menu on My Samsung Galaxy
Device? | Samsung Support UK. URL: / / www . samsung . com / uk /
support / mobile - devices / how - do - i - turn - on - the - developer - options -
menu-on-my-samsung-galaxy-device/ (visited on 03/13/2019).
[20] “IEEE Standard for Information Technology– Telecommunications
and Information Exchange between systemsLocal and Metropoli-
tan Area Networks– Specific Requirements–Part 11: Wireless LAN
Medium Access Control (MAC) and Physical Layer (PHY) Speci-
fications–Amendment 4: Enhancements for Very High Throughput
for Operation in Bands below 6 GHz.” In: IEEE Std 802.11ac-2013
(Amendment to IEEE Std 802.11-2012, as amended by IEEE Std 802.11ae-
2012, IEEE Std 802.11aa-2012, and IEEE Std 802.11ad-2012) (Dec. 2013),
pp. 1–425. DOI: 10.1109/IEEESTD.2013.6687187.
[21] Index of /Releases/18.06.1/Targets/Ar71xx/Generic/. URL: http : / /
downloads.openwrt.org/releases/18.06.1/targets/ar71xx/generic/ (vis-
ited on 03/21/2019).
[22] T. Inzerilli et al. “A Location-Based Vertical Handover Algorithm for
Limitation of the Ping-Pong Effect.” In: 2008 IEEE International Con-
ference on Wireless and Mobile Computing, Networking and Communi-
cations. 2008 IEEE International Conference on Wireless and Mobile
Computing, Networking and Communications (WIMOB). Avignon,
France: IEEE, Oct. 2008, pp. 385–389. DOI: 10 . 1109 / WiMob . 2008 .
58
64. URL: http : / / ieeexplore . ieee . org / document / 4654269/ (visited on
02/25/2019).
[23] Heikki Kaaranen et al. UMTS Networks: Architecture, Mobility and
Services. 2 edition. Chichester, West Sussex, England ; Hoboken, NJ:
Wiley, Mar. 4, 2005. 422 pp. ISBN: 978-0-470-01103-4.
[24] Markku Kojo and Jukka Manner. Mobility Related Terminology. URL:
https://tools.ietf.org/html/rfc3753 (visited on 02/13/2019).
[25] G. Lampropoulos et al. “Handover Management Architectures in
Integrated WLAN/Cellular Networks.” In: IEEE Communications
Surveys Tutorials 7.4 (Fourth 2005), pp. 30–44. ISSN: 1553-877X. DOI:
10.1109/COMST.2005.1593278.
[26] Linux Advanced Routing & Traffic Control HOWTO. URL: https://lartc.
org/howto/ (visited on 03/01/2019).
[27] Networking:Netem [Wiki]. URL: https : / / wiki . linuxfoundation . org /
networking/netem (visited on 02/10/2019).
[28] Shahriar Nirjon et al. “MultiNets: A System for Real-Time Switching
between Multiple Network Interfaces on Mobile Devices.” In: ACM
Transactions on Embedded Computing Systems 13 (4s Apr. 1, 2014),
pp. 1–25. ISSN: 15399087. DOI: 10.1145/2489788. URL: http://dl.acm.
org/citation.cfm?doid=2601432.2489788 (visited on 12/08/2018).
[29] OpenWrt Project: Welcome to the OpenWrt Project. URL: https://openwrt.
org/ (visited on 11/07/2018).
[30] Ping(8) - Linux Man Page. URL: https : / / linux . die . net / man / 8 / ping
(visited on 02/03/2019).
[31] G. P. Pollini. “Trends in Handover Design.” In: IEEE Communications
Magazine 34.3 (Mar. 1996), pp. 82–90. ISSN: 0163-6804. DOI: 10.1109/
35.486807.
[32] Profile Battery Usage with Batterystats and Battery Historian | Android
Developers. URL: https://developer.android.com/studio/profile/battery-
historian (visited on 04/11/2019).
[33] “Quality of Service for Voice over IP.” In: (), p. 44.
[34] Samsung Galaxy S7 and S7 Edge. URL: http://www.samsung.com/global/
galaxy/galaxy-s7/ (visited on 03/21/2019).
[35] Samsung Galaxy S7 Edge Was World’s Top-Selling Android Smartphone in
H1 2016, Says Strategy Analytics. URL: https://www.strategyanalytics.
com/strategy-analytics/news/strategy-analytics-press-releases/2016/08/
01/strategy-analytics-samsung-galaxy-s7-edge-was-world’s-top-selling-
android-smartphone-in-h1-2016 (visited on 02/14/2019).
[36] Specifications Home. URL: http : / / www . 3gpp . org / specifications /
specifications (visited on 12/10/2018).
[37] System Requirements - YouTube Help. URL: https://support.google.com/
youtube/answer/78358?hl=en (visited on 03/14/2019).
59
[38] Tc(8) - Linux Manual Page. URL: http://man7.org/linux/man- pages/
man8/tc.8.html (visited on 02/10/2019).
[39] tcpdump. Tcpdump/Libpcap Public Repository. URL: https : / / www .
tcpdump.org (visited on 02/08/2019).
[40] The Evolution of WiFi Standards: A Look at 802.11a/b/g/n/Ac. June 22,
2017. URL: https : / / www . actiontec . com / wifihelp / evolution - wi - fi -
standards-look-802-11abgnac/ (visited on 03/04/2019).
[41] What Is Adaptive Wi-Fi? | Samsung Support Australia. URL: / / www .
samsung . com / au / support / mobile - devices / galaxy - note - 8 - what - is -
adaptive-wifi/ (visited on 11/14/2018).
[42] Wireshark · Go Deep. URL: https : / / www . wireshark . org/ (visited on
02/08/2019).
[43] Xkcd: Wifi vs Cellular. URL: https : / / xkcd . com / 1865/ (visited on
12/06/2018).
[44] Xiaohuan Yan, Y. Ahmet Şekercioğlu, and Sathya Narayanan. “A
Survey of Vertical Handover Decision Algorithms in Fourth Gen-
eration Heterogeneous Wireless Networks.” In: Computer Networks
54.11 (Aug. 2010), pp. 1848–1863. ISSN: 13891286. DOI: 10 . 1016 / j .
comnet.2010.02.006. URL: https://linkinghub.elsevier.com/retrieve/pii/
S1389128610000502 (visited on 02/25/2019).
60