Session Password Authentication Using Images Pattern

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 203

ICCT COLLEGES FOUNDATION INCORPORATED

S E S S I O N P AS S W O R D AU T H E N T I C AT I O N
S C H E M E U S I NG S L I D E P U Z Z L E AN D
C O L O R / I M AG E S P AT T E R N

TITLE
A Thesis

P r e se n t e d t o t h e Fa c u lt y

C o m p u t e r S c ie n ce a n d I n f o rm a t i o n T e c h n o lo g y

I C C T C o l le g e s Fo u n d a t i o n I n c .

C a i n t a , R i za l

I n P a rt i a l Fu lf i l lm e n t o f t h e d e g r e e

B a ch e lo r o f S c i e n c e in I n f o rm a t io n T e c h n o lo g y.

B y:

Alforque, Chadrich

Aparice, Joenelyn

Aranilla, Jessica A.

Bautista, Br yle

Malarde, Roselle

Ram os, John Lester

Ranido, Alicia

August 24, 2018

Page | i
ICCT COLLEGES FOUNDATION INCORPORATED

PREFACE

T h i s p a p e r i s o u r f i n a l p r o je c t f o r R e s e a r ch P ro j e ct i n

C o l l e g e o f C o m p u t e r S c ie n c e a n d I n f o r m a t io n T e ch n o lo g y a t t h e

I C C T C o l le g e s . I n t h e p ro j e ct , W e co n d u c t e d a s u r ve y t o t h o s e

a n d r o id u s e r s a n d we i n t r o d u ce d o u r m o b i l e a p p s t o re p r e s e n t

t h e i d e a o f g r a p h ic a l p a s s wo r d a u t h e n t ic a t i o n f o r A p p lo c k a n d

L o c ks c r e e n a s a h i g h l y s e c u r i t y f o r t h e i r m o b i le d e vi c e s . T h e

R e s e a r c h wa s d o n e d u r i n g t r i m e s t e r wi t h s u r ve y c o n d u c t e d in

A u g u st .

W e i n sp i r e d t o c o n d u c t t h i s r e se a r c h t o im p l e m e n t a h i g h l y

s e c u r it y i n t e rm s o f c o m p u t e r t e c h n o lo g y. S i n c e , I n t h e t e c h n o lo g y

e r a , T h e e vo l vi n g o f d e vi c e s/ g a d g e t s o r so f t wa r e a p p l ic a t io n a r e

c o n t i n u o u s l y i m p ro ve a n d i n n o va t e b u t t h e r i s k o f vu l n e r a b i l i t ie s

a n d m e t h o d s o f t h o s e c yb e r c r im i n a l s a r e c o n t in u o u s l y i m p ro vi n g

too.

T h i s re se a r ch wo u l d se r ve a s a f o l l o w u p d i ss e r t a t io n f r o m

m y l a s t t h e s is a b o u t I P S p o o f i n g : S e c u r i t y P r o b l e m i n T r a n sf e r

C o n t ro l P r o t o co l / I n t e r n e t P r o t o c o l su i t e .

Page | ii
ICCT COLLEGES FOUNDATION INCORPORATED

DEDICATION

I d e d ic a t e t h i s r e se a r ch t o G o d A l m ig h t y m y c r e a t o r, m y s t r o n g

p i l l a r , m y so u r ce o f i n sp i r a t i o n , wi s d o m , kn o wl e d g e a n d

u n d e r st a n d in g . He h a s b e e n t h e s o u rc e o f m y s t re n g t h

t h r o u g h o u t t h i s p ro g r a m a n d o n h i s wi n g s o n l y h a ve I s o a re d .

I d e d ic a t e t h i s r e se a r ch t o yo u a n d t o a l l g e n e r a l u se r s o f m o b i l e

d e vi c e s b e c a u se t h e go a l o f t h i s re se a r ch t o h a ve a n in s i g h t a n d

p r o t e c t t h o se m o b il e u s e r s a b o u t vu ln e r a b i l i t ie s o f t h e ir m o b i le

d e vi c e s a n d t o b e c o m e a wa r e a g a i n s t t o t h e h a c ke r s . I s t i l l a l so

d e d i c a t e d t o m y p ro f e s s o r s i n d a t a co m m u n i ca t io n a n d

n e t wo r k i n g wh o h a s e n c o u r a g e d m e a l l t h e wa y b e ca u se t h i s i s a

f o l l o w u p a n d t h e n e xt p a r t o f m y r e s e a r ch la s t t r im e .

T h a n k yo u a n d G o d B le s s.

Page | iii
ICCT COLLEGES FOUNDATION INCORPORATED

APP ROV AL SHEET

T h i s t h e s i s e n t i t le d “ S e s s i o n P a s s w o r d Au t h e n t i c a t i on

S c he m e U s i n g S l i d e P u z z l e a n d C ol o r / I m a ge s P a t t e rn ”

p r e p a r e d a n d s u b m i t t e d b y C h a d r i c h Al f o r q u e , J oe ne l yn

Ap a r i c e , J e s s i c a Ar a n i l l a , B r yl e B a u t i s t a , R os e l l e Ma l a r d e ,

J o h n Le s te r Ra mo s a n d Al i c i a R a ni d o , in p a r t ia l f u lf il l m e n t

o f t h e re q u i r e m e n t s f o r t h e d e g r e e o f B a c h e l o r o f S c ie n c e in

I n f o rm a t io n T e c h n o l o g y i s h e r e b y r e c o m m e n d e d f o r a p p r o va l

and acceptance.

M r . M a r c K e vi n I m p e r i a l

T h e s i s A d vi s e r

A c ce p t e d i n p a r t ia l f u lf i l lm e n t o f t h e re q u i r e m e n t s f o r
t h e co u r se Re s e a rc h P r o j e c t (I T P R O J ) .

Mr. MANUEL DANGAN Mrs. ANALIZA R. KHO, MAT

Head,College of Computer Studies Vice President for Academ ic Affairs

Page | iv
ICCT COLLEGES FOUNDATION INCORPORATED

ACKNOWLEDGEMENT

I wi s h t o e xp r e ss m y s in c e re g r a t it u d e t o Jo e R o c k f o r s h a r i n g

h i s t u t o r i a l s t u f f o f b u i ld i n g m o b i le a p p s. A ls o t h a n k t o m y f r ie n d s

o n s o c ia l m e d ia wh o k n o wl e d g a b le a n d e xp e rt i n P ro g r a m m in g

and De ve l o p in g a p p l i ca t io n s as a mentor for d e ve l o p in g

apps.

I s i n c e re l y t h a n k M r . M a r c K e vi n I m p e r i a l f o r h i s gu i d a n c e a n d

e n co u ra g e m e n t i n c a r r yi n g o u t t h i s re s e a r c h wo r k .

Page | v
ICCT COLLEGES FOUNDATION INCORPORATED

TABLE OF CONTENTS

TITLE ............................................................................................................................... i
PREFACE ....................................................................................................................... ii
DEDICATION ................................................................................................................. iii
APPROVAL SHEET ....................................................................................................... iv
ACKNOWLEDGEMENT .................................................................................................. v

CHAPTER 1 PROBLEM AND ITS BACKGROUND ........................................................ 1


1.1 INTRODUCTION ................................................................................................................ 1
2.1 BACKGROUND OF THE STUDY .................................................................................... 2
1.3 STATEMENT OF THE PROBLEM ................................................................................. 4
1.3.1 GENERAL PROBLEM ................................................................................................ 4
1.3.2 SPECIFIC PROBLEM ................................................................................................ 4
1.4 OBJECTIVES OF THE STUDY........................................................................................ 5
1.4.1 GENERAL OBJECTIVES ......................................................................................... 5
1.4.2 SPECIFIC OBJECTIVES .......................................................................................... 5
1.5 SIGNIFICANCE OF THE STUDY .................................................................................... 7
1.6.1 Scope ............................................................................................................................ 8
1.6.1 Limitation .................................................................................................................... 10

CHAPTER 2 REVIEW OF RELATED LITERATURE .....................................................12


2.1 FOREIGN LITERATURE AND STUDIES ..................................................................... 12
2.2 LOCAL LITERATURE ...................................................................................................... 16
2.3 SYNTHESIS OF THE STUDY ........................................................................................ 19

Page | vi
ICCT COLLEGES FOUNDATION INCORPORATED

CHAPTER 3 CONCEPTUAL FRAMEWORK AND THEORETICAL FRAMEWORK ......20


3.1 CONCEPTUAL FRAMEWORK ...................................................................................... 20
3.2 THEORETICAL FRAMEWORK ..................................................................................... 21
3.4 PROJECT WORK BREAKDOWN ANALYSIS ............................................................. 22
3.4 ORGANIZATIONAL FLOW CHART .............................................................................. 23

CHAPTER 4 RESEARCH METHODOLOGY ................................................................24


4.1 METHODS OF RESEARCH ........................................................................................... 24
4.2 SOURCES OF DATA ....................................................................................................... 25
4.3 DESCRIPTION OF RESPONDENTS ........................................................................... 26
4.4 DATA GATHERING INSTRUMENT .............................................................................. 27
4.5 STATISTICAL TREATMENT OF DATA........................................................................ 29
4.6 ETHICAL CONSIDERATIONS ....................................................................................... 30

CHAPTER 5 PRESENTATION, ANALYSIS AND INTERPRETATION OF DATA ..........31


5.1 COMPONENTS OF THE SYSTEM ............................................................................... 31
5.1.2 SOFTWARE COMPONENTS ................................................................................. 31
5.4 INTEGRATED SYSTEMS TRAINING ........................................................................... 38
5.5 SURVEY RESULTS ......................................................................................................... 53

CHAPTER 6 SUMMARY , CONCLUSION AND RECOMMENDATION .........................75


6.1 SUMMARY ........................................................................................................................ 75
6.2 CONCLUSION ................................................................................................................. 76
6.3 RECOMMENDATION .................................................................................................... 77

APPENDIX ....................................................................................................................78

Page | vii
ICCT COLLEGES FOUNDATION INCORPORATED

CHAPTER 1
PROBLEM AND ITS BACKGROUND

1.1 INTRODUCTION
The researchers decided to create an innovated password authentication for

mobile devices to protect their personal information and protect themselves

against to the thieves and hackers. The vulnerabilities of accessing a system

is illegal but stealing or attempting to open a mobile devices of the users is a

crime too. And since it has not yet been shown to all and not already to introduce

widely. The color / images password authentication will be made on mobile

devices. The color/images pattern password authentication were inspired to the

slide puzzle game and candy crush games where the user are able to create

their own pattern of images and arrange their own images and colors when the

user are setting up a password before it can would activated. The password

authentication color /images pattern can be used on screenlock and applock.

Especially with mobile contacts and other personal information of the user. This

mobile application has two options for enabling innovative password

authentication that the user can choose to protect his/her information for his

mobile device and may also choose the user how many attempts to open the

mobile device if there someone attempts to open it. For mobile

application security, It has a features that automatically opens the GPS and

intruder selfie after the user activates his mobile app with his password. The

Page | 1
ICCT COLLEGES FOUNDATION INCORPORATED

i n t r u d e r s e lf i e s e n t t h e p h o t o t o h is G m a i l A c c o u n t a n d h e c o u l d

u se i t a s e vi d e n ce if h i s p h o n e wa s s t o le n . I t h a s o t h e r f e a t u re s

t o a c t i va t e a n d d e a c t i va t e i t s n o t if i ca t i o n p a s s wo r d a n d i t s

p a s s wo r d f o r s c re e n lo c k a n d a p p l o ck .

2.1 BACKGROUND OF THE STUDY

A password is used for user authentication to prove identity or access approval to

gain access to a resource, which is to be kept secret from those who are not

allowed to access. The first computer password was developed in 1961 by

Fernando Corbató’s team for MIT’s Compatible Time-Sharing System (CTSS).

CTSS was a computer designed for multiple users (like computers in a modern

day computer lab).

The security aspect of information systems has always been seen as an

important issue, but with the high level of digitalization today it is not seen as

only important, but instead as an absolute necessity. All the different systems

that are used by a person are often protected with some sort of authentication,

hindering unauthorized personnel from using the systems. A person living in the

modern society today needs to keep track of many different methods to confirm

their identity.

However, many users find it difficult to remember complex passwords over time.

Page | 2
ICCT COLLEGES FOUNDATION INCORPORATED

Thus, users normally cope with password memory problems by decreasing the

complexity and number of passwords, resulting in reducing the password

security. Nevertheless, psychological studies show that images are much more

effective on memory recall rather than with words. Since technology continues to

evolve, it is essential to think of ways for improvement. Therefore, the

researchers thought of a way to enhance the security aspect of user

authentication by developing a user authentication based on using color and

images pattern.

h t t p s : / / e n . wi k i p e d ia . o r g / wi k i / P a s s wo r d

h t t p s : / / ww w. s l i d e sh a r e . n e t / C A in c / h i st o r y - o f - t h e - p a s s wo r d / 5 -
T h e _ f i r s t _ co m p u t e r _ p a s s wo r d _ wa s

h t t p : / / ww w. d i va -
p o r t a l . o r g / sm a sh / ge t / d i va 2 : 1 0 3 0 8 2 8 / F U L L T E X T 0 2

h t t p s : / / ww w. u k e s sa ys . c o m / e s sa ys / p s yc h o l o g y/ t h e - e f f e c t i ve n e ss -
o f - p i ct u re s - a n d - wo r d s - o n - m e m o r y - r e c a l l - p s yc h o l o g y - e s s a y. p h p

Page | 3
ICCT COLLEGES FOUNDATION INCORPORATED

1.3 STATEM ENT OF THE PROBLEM

T h i s s t u d y f o c u s e s o n i n n o va t i ve p a s s wo r d a u t h e n t ic a t io n f o r
m o b i l e d e vi c e s .

1 . 3 . 1 G E N E R AL P R O B L E M

 M o b i l e d e vi c e s o f t e n la c k p a s s wo rd s t o a u t h e n t i c a t e
u s e r s a n d c o n t ro l a c ce s s t o d a t a s t o r e d o n t h e
d e vi c e s . L a c k o f s e c u r it y wi t h t h e f a c t t h a t m o b i le
d e vi c e s are being targeted by c yb e r c r i m i n a l s

 U s e r s d o u se a p a s s wo r d o r P I N t h e y o f t e n ch o o se
p a s s wo r d s o r P I Ns t h a t ca n b e e a s i l y d e t e rm i n e d o r
b yp a s se d , s u c h a s 1 2 3 4 o r 0 0 0 0 . W it h o u t p a ss wo r d s
o r P I N s t o l o ck t h e d e vi c e , t h e r e i s i n c r e a s e d r i s k t h a t
s t o le n o r l o st p h o n e s ' in f o rm a t io n co u ld b e a c c e ss e d
b y u n a u t h o r i ze d u se r s wh o c o u l d vi e w s e n s i t ive
i n f o rm a t io n a n d m is u s e m o b i l e d e vi c e s .

1.3.2 SPECIFIC PROBLEM

 T wo -f a c t o r a u t h e n t i ca t i o n i s n o t a l wa ys u s e d wh e n
conducting s e n s it i ve t ra n sa c t io n s o n m o b i l e d e vi c e s .

 C o n su m e r s g e n e ra l l y u s e s t a t ic p a s s wo r d s i n s t e a d o f t wo -
f a c t o r a u t h e n t i c a t i o n wh e n co n d u c t i n g o n l in e s e n s i t i ve
t r a n sa ct i o n s wh i l e u s i n g m o b i l e d e vi c e s. U s in g s t a t ic
p a s s wo r d s f o r a u t h e n t i ca t i o n h a s s e cu r i t y d r a wb a c k s :
p a s s wo r d s ca n b e g u e s s e d , f o r g o t t e n , wr i t t e n d o wn a n d
s t o le n , o r e a ve s d ro p p e d .

Page | 4
ICCT COLLEGES FOUNDATION INCORPORATED

1.4 OBJECTIVES OF THE STUDY


T h e o b j e ct i ve o f t h e s t u d y t o d e ve l o p a h i g h l y se cu r i t y m o b i l e
a p p s n o t o n l y t h e vi r u s s c a n n e r t o p r o t e ct t h e d e vi c e b u t t o
i m p ro ve t h e t r a d i t io n a l p a s s wo r d a u t h e n t ic a t io n .

1 . 4 . 1 G E N E R AL O B J E C TI V E S

 T h e Re s e a r ch e r s wi l l d e ve l o p co lo r / im a g e s p a t t e r n t h a t
a r e d if f e r e n t t o t h e t r a d i t io n a l p a s swo r d a u t h e n t ic a t i o n a n d
wi l l p r o vi d e a h i g h e r s e c u r i t y f o r m o b i l e d e vi c e s.

 S l i d e p u zzl e s a n d C o lo r / I m a g e s wi l l r e p l a ce t o t h e P I N
p a s sc o d e b e ca u se P I N N u m b e r s a r e e a s i l y t o d e t e rm i n e d
e s p e c i a l l y t o t h e h a c ke r s wh o u s e s a m e t h o d t o a cc e s s
i l l e g a l l y.

1 . 4 . 2 S P E C I F I C O B J E C TI V E S

 T h e m o b i le a p p wi l l d e ve lo p a s a s t a t i c p a s s wo r d b u t
the uniqueness is good for security of their mobile
d e vi c e . S i n ce , T h e u s e r s p re f e r s t a t i c p a s s wo r d f o r
t h e i r m o b i l e d e vi c e s a n d t h e y d o n o t n e e d t o u se t wo -
f a c t o r a u t h e n t i c a t io n b e c a u se i t i s h u s s l e f o r t h e m .

Page | 5
ICCT COLLEGES FOUNDATION INCORPORATED

h t t p s : / / ww w. p c wo r l d . co m / a rt i c l e / 2 0 1 0 2 7 8 / 1 0 - c o m m o n -m o b i l e -
s e c u r it y - p r o b le m s -t o - a t t a c k . h t m l
h t t p s : / / ww w. s e c u re n vo y. c o m / t wo - f a ct o r - a u t h e n t i ca t io n / wh a t - i s -
2 f a . sh t m

h t t p s : / / ww w. we l i ve s e c u r i t y. co m / 2 0 1 5 / 1 1 / 0 6 / m o b i le - se c u r i t y -
i m p o rt a n t -e ve r /

Page | 6
ICCT COLLEGES FOUNDATION INCORPORATED

1.5 SIGNIFICANCE OF THE STUDY

 This study will help the user to have an insight on having a secured
privacy and vulnerability of exposing personal information. It will provide
them information on what are the risks of having an unsecured mobile.

 The results of the study will help make the user become aware of their
involvement in hacking and become more careful on their personal
information.

 To the users, it will serve as basis to help share with other users the
information about the risk of having an unsecured mobile. Also it will help
them to be more cautious on choosing their security app.

 To the readers, this study will help the readers to have the understanding
about having a unique way to secure user’s mobile.

 To the future researchers, the results of this study can serve as a baseline
data for developing topics as well as creating ideas about their topics and
this may serve as a basis for future research that they will conduct.

h t t p s : / / ww w. we l i ve s e c u r it y. c o m / 2 0 1 5 / 1 1 / 0 6 / m o b i le - s e cu r i t y -
i m p o r t a n t - e ve r /

h t t p s : / / b l o g . a p p k n o x. c o m / im p o r t a n ce - o f -m o b i le - a p p - se c u r i t y/

Page | 7
ICCT COLLEGES FOUNDATION INCORPORATED

1.6 Scope and Limitation

1.6.1 Scope

 Login form
- W he n t h e u se r a cc e s s o n a m o b i le a p p s , t h e r e ’ s
a l o g i n f o r m wh e r e t h e u se r s n e e d t o s i g n i n .
The p u rp o se of this login f o rm to co n n e ct
automatically on h i s/ h e r gm a i l account for
i n t r u d e r n o t if ic a t io n .

 S e t t i n g u p a pa s s w or d
- T h e u s e r n e e d s t o a r r a n g e h i s / h e r o wn p a t t e r n i n
s l i d e p u zzl e o r swi t c h p u zzl e a n d t h e re a r e st e p s
t h a t t h e u s e r c a n g o wi t h t h e o p t i o n s h e n e e d s t o
s e l e ct b e f o re se t u p t h e p a s s wo r d .

 C h o o s e yo u r P a s s w o r d S e t - u p
- T h i s i s a f i r st s t e p f o r se t t i n g u p a p a s s wo r d . T h e
u s e r n e e d t o ch o o s e wh a t k in d o f p a s s wo r d s e t - u p
h e wa n t s . D e f a u l t o r F i l l im a g e s ? T h e De f a u lt wi l l
p r o vi d e of its o wn images for yo u r p a s s wo rd
a u t h e n t ic a t i o n a n d f i l l im a ge s if yo u wa n t to
p r o vi d e yo u r o wn im a g e s from yo u r g a l l e r y. .

Page | 8
ICCT COLLEGES FOUNDATION INCORPORATED

 C h o o s e yo u r G r i ds
- T h e se c o n d st e p f o r s e t t i n g u p a p a s s wo r d . T h e
u s e r s h a s a n o p t io n t o c h o o s e h o w m a n y g r i d s t h e
users wa n t s for their p a ss wo r d .

 C h o o s e t yp e o f p a s s w o r d
- T h e re a re t wo o p t io n s for choosing t yp e of
p a s s wo r d . Slide P u zzl e s and swi t c h p a t t e rn . .
S l i d e P u zzl e s t h i s i s n o t a t yp i c a l o f s l i d e p u zzl e
f ro m t h e o r d i n a r y. T h e u s e r s a re a b l e t o a r ra n g e
t h e i r o wn p a t t e rn f ro m o r i g i n a l f o rm t o s c r a m b l e
f o rm a n d s wi t c h p a t t e r n wa s in sp i r e d t o c a n d y
c r u s h , T h i s t yp e o f p a s s wo r d a r e a b le t o s wi t c h t he
i m a g e s t o co l o rs . .

 Ar r a n g e yo u r ow n p a t t e r n
- T h i s i s a m a in s t e p wh e r e t h e u se r s wi l l a r r a n g e
t h e i r p a t t e rn s f o r t h e i r p a s s wo r d s a n d n o l im i t a t io n
f o r a r r a n g i n g t h e i r p a s s wo r d s .

 At t e m p t s
- T h e m o b i le a p p s a r e n o t o n l y t o p r o t e c t t h e i r
m o b i l e d e vi c e b u t a l so t o p r o t e ct a g a i n st r o b b e r s .
T h e p u r p o s e o f t h is s t a g e wh e n so m e o n e a t t e m p t s
t o o p e n a n a n d r o id d e vi c e u n t i l i t r e a c h t o t h e
m a xi m u m a t t e m p t s t h e m o b i le d e vi c e wi l l

Page | 9
ICCT COLLEGES FOUNDATION INCORPORATED

a u t o m a t i c a l l y a c t i v a t e t h e G P S a n d wi l l s e n t a n
i m a g e o f in t r u d e r t o gm a i l.

1 . 6 . 1 Li m i ta t i on

 Login form
- Only Phone number is only needed to login to the mobile app
and no password needed in case the user is in the public place

 S e t t i n g u p a pa s s w or d
- T h e re a r e 6 s t e p s f o r s e t t in g u p a p a s s wo r d a n d
e a ch st e p s h a s a o p t io n s b e f o r e s e t t i n g u p a
p a s s wo r d i s co m p le t e . .
 C h o o s i n g G ri d s
- T h e re are only t h re e o p t io n s for g r i d s i ze .
3 x3 , 4 x4 a n d 5 x4 .

 C h o o s e i ma g e s
- I t d e p e n d s t o t h e u s e r in t e rf e r e n c e s. F o r C h o o s in g
a n im a g e s , e a ch gr i d s h a s a l im it a t io n h o w m a n y
i m a g e s t o u p lo a d .
- F o r 3 x3 o n l y 5 im a g e s t o u p lo a d ,
- 4 x4 o n l y 7 im a ge s
- 5 x4 o n l y 9 i m a g e s t o u p lo a d f o r t h e ir s l i d e p u zzl e s
a n d s wi t c h p a t t e r n p a s s wo r d .

Page | 10
ICCT COLLEGES FOUNDATION INCORPORATED

 At t e m p t s
- There are only 3 options to choose how many times to try open

the mobile app until it reaches the fixed number of opening on

the phone depending on the user's choice.

Page | 11
ICCT COLLEGES FOUNDATION INCORPORATED

CHAPTER 2
REVIEW OF RELATED LITERATURE

2.1 FOREIGN LITERATURE AND STUDIES


 W o rd - b a s e d p a s swo r d s i n t ro d u ce d in t h e e a r l y ye a r s a r e
s u b je c t e d t o va r i o u s a t t a c k s a s m e n t i o n e d i n t h e f o r m e r
s e c t io n . B e s id e s t h i s , m a n y g r a p h i ca l a u t h e n t i ca t io n
s c h e m e s h a ve b e e n e vo l ve d b a se d o n t h e r e q u i re m e n t s a n d
t h e p it f a l l s a s so c ia t e d wi t h t h e p r i o r e xi s t i n g a u t h e n t ica t i o n
m e t h o d s . L e t we h a ve a b r i e f d e sc r i p t i o n o n t h e va r i o u s
p r e va i l i n g & p ro p o s e d g r a p h i c a l a u t h e n t ic a t i o n m e t h o d s .

R e f e re n c e : I n t e r n a t i o n a l Re s e a r ch Jo u r n a l o f E n g i n e e r in g
a n d T e c h n o lo g y ( I R J E T ) , “A u t h e n t i ca t i o n S ch e m e s f o r
S e s s io n P a s s wo r d s u s in g C o lo r a n d I m a g e s “ V o l u m e : 0 4
I s s u e : 0 5 , Ma y , 2 0 1 7

 B l o n d e r s t a t e o n g r a p h ic a l p a s s wo r d t e ch n i q u e , i n wh i c h
t h e p a s s wo r d i s ge n e r a t e d b y a l l o wi n g t h e u se r t o c l i ck o n
d if f e r e n t p o s i t io n s o n a n im a g e . D u r in g a u t h e n t i ca t i o n , t h e
u s e r h a s t o c l i c k o n t h e e st im a t e d a r e a s o f t h o s e lo ca t io n s.
L a t e r , t h i s id e a wa s p r o lo n g e d b y ‘ p a s s - p o in t s ys t e m ‘ wh e r e
t h e p re d e f in e d b o u n d a r ie s a r e e xc l u d e d a n d a r b i t ra r y
i m a g e s a r e su p p o rt e d . E ve r yt i m e , f o r c o n s t ru c t in g
p a s s wo r d , t h e u s e r c a n c l i c k o ve r a n y r e g i o n o n t h e im a g e .
A t o l e ra n ce a r o u n d e a ch ch o s e n p i xe l i s e va l u a t e d . T o b e
a u t h e n t ic a t e d , t h e u se r h a s t o c l i c k wi t h i n t h e t o le r a n ce
l e ve l o f t h e p i xe l s c h o se n .

Page | 12
ICCT COLLEGES FOUNDATION INCORPORATED

R e f e re n c e : G . E . B l o n d e r . G r a p h i ca l p a s s wo r d s . U n i t e d
States Patent 5559961, 2014.

 S yu k r i g e n e r a t e a s c h e m e in wh i c h a u t h e n t i ca t i o n is ca r r i e d
o u t b y s ke t ch i n g o u t t h e u s e r s i g n a t u r e . T h i s s ch e m e
i n vo l ve s t wo l e ve ls , r e g i s t ra t io n a n d ve r i f i ca t io n . W h i le
r e g i s t e r i n g , t h e u se r d ra ws h i s s i g n a t u r e u s in g m o u s e , t h e n
s ys t e m e xt r a ct s t h e s i g n a t u r e a r e a . D u r i n g t h e ve r if i c a t i o n
l e ve l , i t a c q u i re s t h e u s e r s i g n a t u r e a s in p u t , p e rf o r m s
n o rm a l i za t io n a n d f in a l l y e xt r a c t s t h e p a ra m e t e r s o f t h e
s i g n a t u r e . B u t t h i s s c h e m e i s a s s o c ia t e d wi t h s e ve r a l
d i s a d va n t a g e s s u ch a s f o r g e r y o f s i g n a t u r e s , in co n ve n ie n ce
wh i l e d r a wi n g wi t h m o u se , d if f i cu l t y in s ke t ch i n g t h e
s i g n a t u r e in t h e sa m e p e r im e t e r s a t t h e t im e o f r e g i s t ra t i o n .
T h e re i s a n o t h e r , a n e w g r a p h i ca l a u t h e n t i ca t i o n m e t h o d
h a s b e e n d e s i g n e d b y Dh a m i j a a n d P e r r i g . T h i s m e t h o d ,
wh i l e c r e a t i n g t h e p a s s wo r d a l lo ws t h e u se r t o se l e c t
c e r t a in n u m b e r o f p i c t u r e s f r o m a s e t o f r a n d o m im a g e s .
T h e n , d u r i n g l o g i n , t h e u se r h a s t o re c o g n i ze t h e
p r e se l e ct e d p o rt r a i t s f ro m t h e s e t o f i m a g e s . B u t t h i s
m e t h o d i s l ia b le t o s h o u ld e r - su rf i n g .

R e f e re n c e : A . F . S yu k r i , E . O k a m o t o , a n d M. M a m b o , " A
U s e r I d e n t if i c a t i o n S ys t e m U s in g S i gn a t u r e W r it t e n wi t h
M o u se , " in T h i r d A u s t r a la s ia n C o n f e r e n ce o n I n f o r m a t io n
S e cu r i t y a n d P r i va c y ( A C I S P ): S p r i n g e r - V e r la g L e c t u re
N o t e s i n C o m p u t e r S c i e n ce (1 4 3 8 ) , 2 0 1 5 , p p . 4 0 3 - 4 4 1 .

Page | 13
ICCT COLLEGES FOUNDATION INCORPORATED

 P a s sf a ce i s a n a p p r o a c h p ro p o s e d b y t h e Re a l U s e r
C o r p o ra t io n i n wh i c h t h e u s e r is a l lo we d t o c h o o s e f o u r
i m a g e s o f h u m a n f a c e s f ro m t h e f a c e d a t a b a s e a s t h e i r
p a s s wo r d . W h i le in ve r if i c a t i o n p h a se , t h e u s e r i s p r o vi d e d
wi t h a g r i d o f n in e f a ce s, o n e a l re a d y c h o se n d u r i n g t h e
r e g i s t r a t io n a n d e ig h t d e co y f a ce s . T h e u se r i d e n t if ie s t h e
s e l e ct e d f a ce a n d c l i c k s a n ywh e r e o ve r i t . Fo u r t im e s t h i s
c o u r se o f a ct i o n wi l l r e p e a t , a n d t h e u s e r is a s c e rt a in e d a s
g e n u in e if h e r e co g n i ze s a l l f a ce s a cc u r a t e l y.
R e f e re n c e : Re a l U s e r C o rp o ra t io n : P a s sf a ce s.
w w w. p a s sf a c e s. co m

 A n e w i n n o va t i ve a u t h e n t ic a t i o n s ch e m e i s p ro p o se d b y
J a n se n f o r m o b i l e d e vi c e s . W h i le c re a t i n g t h e p a ss wo r d ,
t h e u s e r c h o o se s a t h e m e o f s n a p sh o t s in t h u m b n a i l s ize
a n d t h e se q u e n c e o f t h o s e sn a p s h o t s i s f i xe d a s p a s swo r d .
A s e a ch t h u m b n a i l i s a s s o c ia t e d wi t h n u m e r i c a l va l u e , t h e
s e q u e n ce o f im a g e s f o rm n u m e r i c a l p a s s wo r d . T h e o n ly
d r a wb a c k wi t h t h i s m e t h o d i s t h a t t h e p a s s wo r d s p a ce i s n o t
l a r g e , a s n o o f im a g e s i s l i m it e d t o 3 0 .

R e f e re n c e : W . Ja n s e n , " A u t h e n t i c a t i n g U s e r s o n H a n d h e ld
D e vi c e s “ i n P r o c e e d in g s o f C a n a d ia n I n f o r m a t io n
T e c h n o lo g y S e cu r it y S ym p o s i u m , 2 0 0 3 .

Page | 14
ICCT COLLEGES FOUNDATION INCORPORATED

 T o o ve r c o m e s h o u l d e r - s u rf i n g ch a l le n g e , m a n y m e t h o d s
h a ve b e e n p ro p o se d . O n e o f su c h t e c h n i q u e i s d e s i g n e d b y
M a n , e t a l I n t h i s s ys t e m , t h e u s e r se l e ct s m a n y p o r t r a i t s a s
t h e p a s s o b j e ct s . E a ch p a ss o b j e c t is a l lo t t e d a n in im i t a b le
c o d e . D u r i n g t h e ve r if i c a t i o n p r o ce s s, t h e u se r h a s t o in p u t
t h o s e u n i q u e c o d e s o f t h e p a s s o b j e c t s in t h e l o g i n
i n t e rf a ce s p r e s e n t e d b y t h e s ys t e m . T h r o u g h t h e s ch e m e
r e s i s t s t h e u n vi s i b l e ca m e r a , t h e u s e r h a s t o m e m o r i ze a l l
p a s s o b j e c t co d e s. I n t h i s wa y, m a n y o t h e r g r a p h i c a l
a u t h e n t ic a t i o n s ch e m e s a n d t h e i r d ra wb a c k s a r e p re se n t e d
i n a l a t e st su r ve y p a p e r .

R e f e re n c e : S . Ma n , D . H o n g , a n d M . M a t h e ws , " A
s h o u l d e r su rf in g r e s i s t a n t g r a p h i ca l p a s s wo r d s ch e m e , " in
P r o ce e d i n g s o f I n t e r n a t i o n a l c o n f e r e n c e o n se cu r i t y a n d
m a n a ge m e n t . L a s V e g a s, N V , 2 0 0 3

Page | 15
ICCT COLLEGES FOUNDATION INCORPORATED

2.2 LOCAL LITERATURE


 U t i l i zi n g E B S C O a n d P r o Q u e s t , a se a r c h o f s ch o la r l y
p u b l i c a t i o n s ( jo u rn a l a rt i c l e s a n d d i ss e r t a t i o n s ) t h a t c o n t a in
“ m o b i l e s e c u r i t y” in i t s t it l e re t u r n s 2 3 1 re su l t s , a
s u r p r i s in g l y l o w n u m b e r. 3 3 % o f t h e s e ( 7 6 a r t i c le s ) we r e
wr i t t e n i n t h e l a st ye a r , wh i c h s u g g e s t s a s i g n if ic a n t r is e in
t h e r e se a r c h o f m o b i le se c u r it y. E ve n m o re su r p r i s in g , a
s e a r ch o f s c h o l a r ly p u b l i ca t io n s c o n t a i n in g “ A n d ro i d
S e cu r i t y” i n t h e t it le r e su l t s i n a 1 5 4 % i n c re a se o f a r t ic l e s ,
wi t h 3 5 6 a r t i c le s re t u rn e d , a n d 8 7 % ( 3 1 0 a rt i c l e s ) b e i n g
wr i t t e n i n t h e l a st ye a r . I n t r i g u in g l y, I n t e r n a t io n a l Jo u rn a l o f
C o m p u t e r A p p l i ca t i o n s ( 0 9 7 5 – 8 8 8 7 ) V o lu m e 9 7 – N o . 8 ,
J u l y 2 0 1 4 1 0 n o t o n e o f t h e se a r t i c le s s e a r c h e d c l a im a n y
s e c u r it y b e n e f i t s t o A n d ro i d s e c u r i t y, r a t h e r a l l a r t ic l e s
d i s c u s s vu l n e r a b i l it i e s . T h e id e a o f in f o rm a t io n a t o u r
f in g e r t ip s a n yt im e a n d a n ywh e r e ca n b e h i g h l y a p p e a l in g .
D u e t o t h e n a t u r e o f a p p s b e h a vi n g i n s wa r m s ( i . e . ch e c k i n g
i n r e g u la r l y) m o s t a p p s b e h a ve in t h e sa m e wa y a s a b o t
wo u l d o n a co m p u t e r . T h e r e f o r e d e t e c t io n m e ch a n i sm s u se d
t o d e t e ct b o t s o n co m p u t e r s a re i r r e le va n t t o m o b i l e
p h o n e s . I n t o d a y’ s d a y a n d a g e , wh e r e 2 3 0 , 0 0 0 o p e n
s o u r ce S o u r c e o r ge m o b i l e s o f t wa r e d e ve l o p m e n t p ro j e c t s
h a ve b e e n u se d s in c e 2 0 0 9 , i t se e m s a s t h o u g h we d o n ’ t
a s k t h e q u e s t io n “A t wh a t co s t ? ” .

h t t p s : / / p d f s . se m a n t i c s c h o l a r. o r g / 0 9 d 0 / 3 a e 6 f 8 e d c5 f 0 c 1 2 3 f 5 0
7 7 0 0 9 3 f 2 2 c d 2 8 1 cb 1 . p d f

 I n t h e se co n d p a r t o f t h e d i s se r t a t io n we i n ve st i g a t e o n l i n e
a u t h e n t ic a t i o n s ch e m e s f r e q u e n t l y u t i l i ze d b y m o b i l e u se r s ,
s u c h a s t h e m o st c o m m o n we b a u t h e n t ic a t i o n b a se d u p o n
t h e u s e r ’ s p a s s wo r d s a n d t h e r e ce n t l y wi d e s p re a d m o b i l e 2 -
f a c t o r a u t h e n t i c a t io n (2 F A ) wh i c h e xt e n d s t h e p a s s wo r d -
b a se d a p p ro a ch wi t h a se co n d a r y a u t h e n t ic a t o r se n t t o a

Page | 16
ICCT COLLEGES FOUNDATION INCORPORATED

u se r ’ s m o b i l e d e vi c e o r g e n e r a t e d o n i t ( e . g , a O n e - t im e
P a s s wo r d ( O T P ) o r T ra n sa ct i o n A u t h e n t ic a t i o n N u m b e r
( T A N ) ) . I n t h i s c o n t e xt we d e m o n s t ra t e va r i o u s we a k n e s s e s
o f m o b i le 2 F A s c h e m e s d e p lo ye d f o r l o g i n ve r if i ca t io n b y
g l o b a l I n t e rn e t se rvi c e p r o vi d e r s ( s u c h a s G o o g l e , D ro p b o x,
T wi t t e r, a n d Fa c e b o o k ) a n d b y a p o p u l a r G o o g l e
A u t h e n t ic a t o r a p p . T h e s e we a k n e s se s a l lo w a n a t t a c ke r t o
i m p e r s o n a t e l e g i t im a t e u se r s e ve n if t h e i r m o b i l e d e vi c e
wi t h t h e se c o n d a ry a u t h e n t i ca t o r i s n o t co m p r o m i se d . W e
t h e n g o o n e s t e p f u r t h e r a n d d e ve l o p a g e n e r a l a t t a c k
m e t h o d f o r b yp a s si n g m o b i le 2 F A s ch e m e s . O u r m e t h o d
r e l i e s o n a c r o s s - p l a t f o rm i n f e ct i o n (m o b i l e -t o -P C o r P C - t o -
m o b i l e ) a s a f i r s t s t e p in o rd e r t o co m p ro m i s e t h e P e r so n a l
C o m p u t e r ( P C ) a n d a m o b i l e d e vi c e o f t h e sa m e u se r . W e
d e ve l o p p r o o f -o f - co n ce p t p r o t o t yp e s f o r a c ro s s - p la t f o rm
i n f e c t i o n a n d s h o w h o w a n a t t a c ke r ca n b yp a ss va r i o u s
i n s t a n t i a t io n s o f m o b i le 2 F A s c h e m e s o n c e b o t h d e vi c e s ,
P C a n d t h e m o b i l e p l a t f o r m , a r e i n f e c t e d . W e t h e n d e l i ve r
p r o o f - o f - c o n c e p t a t t a ck im p le m e n t a t io n s t h a t b yp a s s o n l i n e
b a n k i n g so l u t i o n s b a se d o n S M S - b a s e d T A N s a n d vi s u a l
c r yp t o g r a m s , a s we l l a s l o g i n ve r if i ca t i o n s c h e m e s d e p l o ye d
b y va r i o u s I n t e r n e t s e r vi c e p r o vi d e r s. F i n a l l y, we p ro p o s e a
wa l l e t - b a se d se c u r e s o lu t io n f o r p a ss wo r d - b a se d
a u t h e n t ic a t i o n wh i c h r e qu i r e s n o se co n d a r y a u t h e n t i ca t o r ,
a n d ye t p r o vi d e s b e t t e r se cu r i t y g u a ra n t ie s t h a n , e . g . ,
m o b i l e 2 FA sc h e m e s .

h t t p : / / t u p r i n t s . u lb . t u - d a rm s t a d t . d e / 4 6 1 1 / 3

Page | 17
ICCT COLLEGES FOUNDATION INCORPORATED

 There have been related works done before, like doing survey and finding
the users habit of password management. Survey seems to be the best
way to find the way users manage their passwords.

Survey was done by Morris and Thompson over 3289 passwords, in which
they found 89% of the passwords where weak. Weak passwords are
created due to the lack of knowledge about the policy.

h t t p s : / / ww w. d u o . u io . n o / b i t st r e a m / h a n d l e / 1 0 8 5 2 / 3 4 7 3 5 / sh a zi
a r a h m a n -m a s t e r s . p d f ? se q u e n ce = 2

Page | 18
ICCT COLLEGES FOUNDATION INCORPORATED

2.3 SYNTHESIS OF THE STUDY

R e s e a r c h in d i ca t e s t h a t t h e re a r e p r o b l e m s e n c o u n t e r e d i n
p a s s wo r d m a n a ge m e n t . O n e s u r ve y ( M o r r i s a n d T h o m p so n )
f o u n d t h a t m o s t p a s s wo r d s a re we a k . A n id e a s o o n f o l l o we d ,
r e s u l t in g in a study report of p ro p o s i n g a g r a p h i ca l
a u t h e n t ic a t i o n m e t h o d s i n wh i ch t h e p a s s wo r d i s ge n e ra t e d b y
a l l o wi n g t h e u s e r t o c l i c k o n d if f e re n t p o s it i o n s o n a n im a g e
( B l o n d e r ). A l l o f t h e st u d y yi e l d e d va l i d r e s u l t s , t h u s d u e t o
t h e ra p id g r o wt h o f in f o r m a t io n a g e , i t i s i m p o rt a n t t o in n o va t e
p a s s wo r d a u t h e n t ic a t io n s.

Page | 19
ICCT COLLEGES FOUNDATION INCORPORATED

CHAPTER 3
CONCEPTUAL FRAM EWORK AND THEORETICAL
FRAM EWORK

3.1 CONCEPTUAL FR AM EWORK

Enter
phone
number

-View the set up password,


feedback update

-the user could set up their - t h e u se r


password in a first option
f in a l l y
-The user could update their a c t i va t e s
mobile apps and also they
their lock
can change their password,
set the password and activate screen
the lock screen and app lock

Page | 20
ICCT COLLEGES FOUNDATION INCORPORATED

3.2 THEORETICAL FR AM EWORK


T h e o re t i c a l F ra me w o rk

S e cu r i n g mobile d e vi c e s h a s become i n c re a s in g l y
i m p o r t a n t i n re c e n t ye a r s a s t h e n u m b e r s o f t h e d e vi c e s in
o p e r a t io n a n d t h e u s e s t o wh i c h t h e y a r e p u t h a ve e xp a n d e d
d r a m a t i c a l l y. T h e p r o b le m i s co m p o u n d e d wi t h i n t h e e n t e rp r i s e
a s t h e o n go i n g t r e n d t o wa r d I T co n su m e r i za t i o n i s r e su l t i n g in
m o re a n d m o r e e m p l o ye e - o wn e d d e vi c e s co n n e ct i n g t o t h e
c o r p o r a t e n e t wo r k .

T o e n su r e o n e ’ s m o b i l e ’ s se cu r i t y we d e ve l o p a a p p t h a t
c a n h e lp s e cu r e u s e r ’ s p h o n e . I n o r d e r f o r t h e a p p t o wo r k
f i r st , e n t e r yo u r p h o n e n u m b e r , t h e n vi e w t h e s e t u p p a s s w o r d ,
f e e d b a c k, and update. N e xt the user co u ld set up their
p a s s wo r d in a f i r st o p t i o n . L a s t l y t h e u se r c o u l d u p d a t e t h e i r
m o b i l e a p p s a n d a l s o t h e y c a n ch a n g e t h e i r p a s s wo r d , se t t h e
p a s s wo r d a n d a c t iva t e t h e l o c k sc r e e n a n d a p p l o c k . T h e u se r
f in a l l y a c t i va t e s t h e i r l o ck .

Page | 21
ICCT COLLEGES FOUNDATION INCORPORATED

3 . 4 P RO J E C T W O R K B R E AK D O W N AN AL Y S I S
Duration May 30 -31 JUNE 1-17 JUNE 18-22 June 25 - 29
Task Name
W TH M T W TH F SAT M T W TH F SAT M T W TH F SAT
1 Planning for the title
2 Planing for the System
Prepare the first
3 progress report
4 Analyzing the system

5 Designing the System


6 Coding the System

7 Document the System

8 Debugging the system

Duration JULY 2-6 JULY 9-14 June 16 -21


Task Name
M T W TH F SAT M T W TH F SAT M T W TH F SAT

5 Designing the System


6 Coding the System

7 Document the System

8 Debugging the system

Duration JULY 23 - 28 JULY 30 - AUG 4 Aug 5-6


Task Name
M T W TH F SAT M T W TH F SAT SUN M
9 Conduct a Survey
10 Compute a survey
11 Document the system

Page | 22
ICCT COLLEGES FOUNDATION INCORPORATED

3 . 4 O RG AN I Z AT I O N AL F L O W C H AR T

S u r ve y Programmer S u r ve y

J o h n L e st e r C h a d r i ch
B r yl e B a u t i st a
Ramos A lf o r q u e

Researcher Re s e a r ch e r Researcher

J o e n e l yn A p a r i c e A l i c ia R a n i d o R o se l l e M a la r d e

Researcher

J e s s i c a A ra n i l la

Page | 23
ICCT COLLEGES FOUNDATION INCORPORATED

CHAPTER 4
RESE ARCH METHODOLOGY

4.1 METHODS OF RESE ARCH


T h i s st u d y u t i li ze s t h e d e s c r ip t ive m e t h o d a n d qu a n t i t a t i ve
m e t h o d s o f r e se a rc h . U s in g d e s c r i p t i ve , t h e u se o f o b se r va t i o n , i t
h a s b e e n c o n c l u d e d t h a t a p o p u l a t io n o f p a ss wo r d u s e r s t e n d t o
b e ca r e le s s i n se t t i n g u p t h e i r p a s swo r d s a n d t h i s m a y c a u s e a
p r o b le m t o t h e i r se c u r i t y in i n f o rm a t i o n . T h i s re a s o n h a s in s p i re d
t h e re s e a r c h e r s t o c r e a t e F o r q P a s swo r d a s a m e a n o f i n n o va t in g
a n d i n c re a s i n g t h e p a s s wo r d se cu r i t y o f t h e u se r . I n a d d i t i o n , b y
u s i n g q u a n t i t a t i ve , t h e r e s e a r c h e r s wi l l c o n d u c t a su r ve y a n d t h e
g a t h e r e d i n f o rm a t i o n a b o u t t h e u se r e xp e r ie n ce i n u s i n g F o r q
p a s s wo r d sh a l l g i ve t h e r e se a r ch e rs a b e t t e r in s i g h t a b o u t t h is
s t u d y.

Page | 24
ICCT COLLEGES FOUNDATION INCORPORATED

4.2 SOURCES OF DAT A

Source of Data

Primary Data Secondary


Sources Data Sources

 Books
 Survey
Published
 Questionaire
 Articles and
 Internet

Page | 25
ICCT COLLEGES FOUNDATION INCORPORATED

4.3 DESCRIPTION OF RESPONDENTS

T h e st u d y wi l l h a ve 1 0 0 m o b i l e p h o n e u se r s t o b e u s e d
a s s u b j e c t s. A l l o f t h e se p a r t i c i p a n t s we r e r a n d o m l y c h o se n
t h r o u g h r a n d o m sa m p l i n g . T h e p a r t ic i p a n t s wi l l b e s p li t a n d b e
c a t e g o r i ze d a s 5 0 t e e n a g e r s a n d 5 0 a d u l t s , in wh i c h it wi l l b e
d e t e rm i n e d b y a ge . W h e re t e e n a g e r s a r e r a n g i n g f ro m 1 6 - 2 0
a g e s a n d a d u l t s a r e e q u i va l e n t t o 2 1 - 4 0 a g e s. S i n c e t h e a ge
o f t h e r e sp o n d e n t s a re vi e we d b y t h e re s e a r c h e r s t o b e a n
i m p o r t a n t c h a r a ct e r i s t i c i n u n d e r st a n d i n g t h e i r vi e ws a b o u t
m o b i l e s e cu r i t y. C o n s id e r in g t h e a g e i n d i c a t e s t h e l e ve l o f
m a t u r it y o f t h e su b j e ct s .

An d r o i d u s e r s N u m b e r o f R e s p on d e n t s

Adult (21 – 40) 50

Teenager (16 – 20) 50

Total: 1 0 0 Re s p o n d e n t s

Page | 26
ICCT COLLEGES FOUNDATION INCORPORATED

4.4 DAT A G ATHERING INSTRUMENT

D a t a G a t he r i n g I ns t r u me n t s

T h e r e se a r ch e r u se d t h e f o l lo wi n g i n s t r u m e n t s i n t h e s t u d y:

F o r t h i s s t u d y, su r ve y - q u e s t i o n n a i r e wa s u se d t o g a t h e r
r a w a n d r e l i a b l e r e s p o n se s d i r e ct ly f r o m t h e su b je c t s . T h e
r e s e a r c h e r s d e ve lo p e d t h e i n st r u m e n t t h a t wa s s t ru c t u r e d o n a
4 - p o i n t s ca l e r a n g i n g f ro m “ S t ro n g l y A g r e e ” ( S A ) , “ A g r e e ”
( A ) , “ D i sa g r e e ” ( D) t o “ S t r o n g l y D i s a g r e e ” ( S D ) , t o ga t h e r t h e
r e q u i r e d i n f o rm a t io n . T h e q u e st i o n n a i r e i s p e r t a in i n g t o t h e
e f f e c t i ve n e s s o f g ra p h i c a l i m a g e s p a s s wo r d f o r m o b i l e d e vi c e s
a n d i t i s d i vi d e d a s 3 q u e st i o n s c a t e g o r i za t i o n k n o wn t o b e a s
l a yo u t s a t i sf a c t io n , f u n ct i o n sa t i sf a c t i o n , a n d u s e r s a t i sf a c t io n .
This in vo l ve s d is t r i b u t i n g paper q u e st i o n n a i r e s for the
s u b j e c t s t o a n s we r j u s t a s t h e re s e a r c h e r s l e t s t h e m t r y o u t
t h e u se o f g r a p h ic a l p a s s wo r d a u t h e n t i ca t io n . T h e g a t h e r ed
i n f o rm a t io n wi l l b e u s e d t o t a l l y t h e r e su l t s a n d t h i s i s k n o wn
t o b e va l u a b le , a s t h e r e su l t s yi e l d a p r o p e r in s i g h t .

Q u e s t i o n na i re – T h e q u e s t io n n a ir e wa s d e s i g n e d t o
o b t a in in f o r m a t io n a b o u t t h e re s p o n d e n t s a s t o t h e co u r se o f
I n f o rm a t io n T e c h n o l o g y a s we l l a s t o g a t h e r t h e o p in i o n s o f
r e s p o n d e n t s r e ga r d i n g st u d e n t ’ s f o r wh a t i s h e r / sh e o p in i o n
a b o u t o u r s ys t e m . Q u e s t i o n n a i r e is a s e t o f q u e s t io n s h a s
b e e n p r e p a r e d t o a s k a n u m b e r o f q u e s t io n s a n d c o l l e c t

Page | 27
ICCT COLLEGES FOUNDATION INCORPORATED

a n s we r s f ro m re sp o n d e n t s re l a t i n g t o t h e r e se a r ch t o p ic . A
number of questions u su a l l y in printed form are to be
a n s we r e d b y t h e i n d i vi d u a l s. T h e f o r m s o f t e n h a ve b l a n k
s p a ce s in wh i c h t h e a n s we r s c a n b e wr i t t e n . S e t s o f su c h
f o rm s a re d i st r i b u t e d t o g r o u p s a n d t h e a n s we r s a r e co l l e ct e d
r e l a t in g t o re s e a rc h t o p i c . A q u e s t i o n n a i r e i s a se r i e s o f
q u e s t io n s a s k e d t o i n d i vi d u a l s t o o b t a in st a t i s t i ca l ly u s e f u l
i n f o rm a t io n a b o u t a g i ve n t o p i c .

Page | 28
ICCT COLLEGES FOUNDATION INCORPORATED

4.5 STATISTICAL TRE ATM ENT OF DAT A


F o r t h e p ro b le m s b e i n g a s k e d o n t h e q u e s t io n n a i re s ,
h e r e i s t h e e q u a t i o n we u s e d t o co m p u t e t h e p e r ce n t a ge ,
f re q u e n c y a n d we ig h t e d m e a n o f t h e a n s we r s t h a t we g a t h e r e d
o n t h e su r ve y.

T o f in d p e r c e n t a g e a n d f r e q u e n c y w h o a g r e e d a n d d isa g r e e
o n a c e r t a i n q u e s t io n . W e u se d t h i s e q u a t io n :

Formula:

No. of respondents
X 100% = To t a l
T o t a l n u m b e r o f re s p o n d e n t s
F r e q ue n c y/
P e rc e n ta g e

F o r we i g h t e d m e a n , W e u se d t h i s e q u a t io n t o c o m p u t e t h e
we i g h t e d m e a n o f e a c h q u e st i o n s . .

Formula:

N o . o f r e s p o n d e n t s x we i g h t e d ca t e go r y = Total weighted
mean

Page | 29
ICCT COLLEGES FOUNDATION INCORPORATED

4.6 ETHICAL CONSIDERATIONS

While the researchers conducting a survey, It is not difficult to us to approach

those random people to conduct a survey. They are not ashamed to entertain us

since we told them we would like introduce our mobile application and then,

We started to gather a data from them. Some of other respondent when we

introduce our mobile apps, They are having difficulty on a fourth part of session

password authentication since the mobile apps provided different complexity of

password base on what user interferences but other remaining authentication

amazed them in a different way of using it because the uniqueness of mobile

apps. The fourth part of mobile apps is really difficult one for the users desire.

While the respondents answering their questionaires, Our researchers ask

for them some taking photo from them for integrated systems training part in a

research paper but the respondents told to the researchers, they felt so

uncomfortable when the researchers taking a photo of them. So, the researchers

told them that it was okay to take a picture behind them.

Page | 30
ICCT COLLEGES FOUNDATION INCORPORATED

CHAPTER 5
PRESENTATION, AN ALYSIS AND INTERPRETATION
OF DAT A

I n t h i s c h a p t e r wi l l s h o w yo u t h e c o m p o n e n t s , d a t a f lo w ,
s ys t e m f lo w c h a r t t o b u i ld o u r m o b i l e a p p a n d a l so t h e s u r ve y
result.

5.1 COMPONENTS OF THE SYSTEM

5 . 1 . 2 S O F TW AR E C O M P O N E NT S

 Laptop
- T o s h ib a S a t e l l i t e C 6 5 5 / W in d o ws 7 / 6 4 b i t s / 4 g b
R A M / I n t e l C o re – i3 - 2 3 1 0 @ 2 . 1 0 G H z 2 . 1 0 G H z

 Compiler
- X a ma r i n V i s ua l S t u d i o 2 0 1 7

H a r dw a re
 GHz or faster processor. Dual-core or better recommended
 2 GB of RAM; 4 GB of RAM recommended (2.5 GB minimum if
running on a virtual machine)
 Hard disk space: up to 130 GB of available space, depending on
features installed; typical installations require 20-50 GB of free
space.
 Hard disk speed: to improve performance, install Windows and
Visual Studio on a solid state drive (SSD).
 Video card that supports a minimum display resolution of 720p
(1280 by 720); Visual Studio will work best at a resolution of
WXGA (1366 by 768) or higher.

Page | 31
ICCT COLLEGES FOUNDATION INCORPORATED

 P r o g ra m mi n g La ng u a g e
- C#

 N u g e t P a c k a g e s / An d r o i d L i b ra r y S u p p o r t
- X a m a r in A n d r o id S u p p o r t v4
- X a m a r in A n d r o id S u p p o r t v7 A p p C o m p a t
- X a m a r in A n d r o id S u p p o r t v7 Ca r d V ie w
- X a m a r in A n d r o id S u p p o r t v7 Re c yc l e r V i e w
- X a m a r in A n d r o id S u p p o r t V e ct o r D r a wa b l e
- X a m a r in A n d r o id S u p p o r t De s i g n
- X a m a r in A n d r o id S u p p o r t A n im a t e d V e ct o r D ra wa b l e
- R e f r a ct o re d C o n t ro l s C i r c l e I m a g e V ie w

Page | 32
ICCT COLLEGES FOUNDATION INCORPORATED

5.2 DAT A FLOW

Page | 33
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 34
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 35
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 36
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 37
ICCT COLLEGES FOUNDATION INCORPORATED

5.3 SYSTEM FLOW CHART

Page | 38
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 39
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 40
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 41
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 42
ICCT COLLEGES FOUNDATION INCORPORATED

5.4 INTEGRATE D SYSTEMS TRAINING

Page | 43
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 44
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 45
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 46
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 47
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 48
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 49
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 50
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 51
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 52
ICCT COLLEGES FOUNDATION INCORPORATED

5.5 SURVEY RESULTS

Q u e s t io n n o . 1

G r a p h i ca l p a s s wo rd a re e a s y t o re m e m b e r

T e e n a g e r:

Variable Frequency Percentage W eighted Mean

Strongly Agree 12 23.53 % 48

Agree 38 74.51 % 114

Disagree 1 1.96% 2

Strongly Disagree 0 0% 0

Total: 51 100% 164

Adult:

Variable Frequency Percentage W eighted Mean

Strongly Agree 13 26.53 % 52

Agree 33 67.35 % 99

Disagree 2 4.08 % 4

Strongly Disagree 1 2.04 % 1

Total: 49 100% 156

Page | 53
ICCT COLLEGES FOUNDATION INCORPORATED

80 74.51

70 67.35

60

50

40

30 26.53
23.53
20

10
4.08
2.04 1.96
0
0
ADULT TEENAGER

Strongly Agree Agree Disagree Strongly Disagree

T h i s t a b l e t h a t 2 3 . 5 3 % o f t e e n a g e r a n d 2 6 . 5 3 o f a d u lt S t r o n g l y
A g r e e a b o u t re m e m b e r i n g im a g e s p a s s wo r d t h a n t o t e xt u a l
p a s s wo r d . 7 4 . 5 1 % o f t e e n a g e r a n d 6 7 . 3 5 o f a d u lt A g r e e a b o u t
r e m e m b e r i n g im a ge s p a ss wo r d t h a n t o t e xt u a l p a ss wo r d .
1.96% of teenager and 4.08 of adult Disagree about
r e m e m b e r i n g im a ge s p a ss wo r d t h a n t o t e xt u a l p a ss wo r d . 0 %
o f t e e n a g e r a n d 2 . 0 4 o f a d u lt D i s a g re e a b o u t re m e m b e r i n g
i m a g e s p a s s wo r d r t h a n t o t e xt u a l p a s s wo r d .

T h e i n t e r p re t a t io n o f d a t a o f q u e s t io n n u m b e r 1 sh o ws t h a t
m o s t o f t h e t e e n a ge r a re a g r e e o n r e m e m b e r in g g r a p h ic a l
p a s s wo r d s.

Page | 54
ICCT COLLEGES FOUNDATION INCORPORATED

Q u e s t io n n o . 2

I m a g e s u se d in t h e p a ss wo r d a re sa t i sf yi n g

T e e n a g e r:

Variable Frequency Percentage W eighted Mean

Strongly Agree 27 52.94 % 108

Agree 23 45.10% 69

Disagree 0 0 % 0

Strongly Disagree 1 1.96% 1

Total: 51 100% 178

Adult:

Variable Frequency Percentage W eighted Mean

Strongly Agree 20 40.82 % 80

Agree 17 34.69 % 51

Disagree 11 22.45 % 22

Strongly Disagree 1 2.04 % 1

Total: 49 100% 154

Page | 55
ICCT COLLEGES FOUNDATION INCORPORATED

60
52.94

50
45.1
40.82
40
34.69

30
22.45
20

10
2.04 1.96
0
0
ADULT TEENAGER

Strongly Agree Agree Disagree Strongly Disagree

T h i s t a b l e s h o ws t h a t 5 2 . 9 4 % o f t e e n a g e r a n d 4 0 . 8 2 % o f
A d u l t s a r e S t r o n g l y a g r e e a b o u t t o t h e im a g e s u se d p ro vi d e d i n
m o b i l e a p p s a s a p a s s wo r d . 4 5 . 1 0 % o f t e e n a ge r a n d 3 4 . 6 9 % o f
A d u l t s a r e A g r e e a b o u t t o t h e i m a g e s u se d p ro vi d e d i n m o b i l e
a p p s a s a p a ss wo r d . 0 % o f t e e n a g e r a n d 2 2 . 4 5 % o f A d u l t s a r e
D i s a g r e e a b o u t t o t h e im a g e s u s e d p r o vi d e d i n m o b i le a p p s a s a
p a s s wo r d . 1 . 9 6 % o f t e e n a g e r a n d 2 . 0 4 % o f A d u l t s a r e S t r o n g l y
D i s a g r e e a b o u t t o t h e im a g e s u s e d p r o vi d e d i n m o b i le a p p s a s a
p a s s wo r d .

T h e I n t e r p r e t a t io n o f t h e d a t a m o st o f t h e t e e n a ge r S t r o n g l y
A g r e e a b o u t t o t h e i m a g e s u se d p r o vi d e d i n m o b i l e a p p s a s a
p a s s wo r d .

Page | 56
ICCT COLLEGES FOUNDATION INCORPORATED

Question n o . 3

Text Font is readable

Teenager:

Variable Frequency Percentage W eighted Mean

Strongly Agree 37 72.53 % 148

Agree 9 17.65 % 27

Disagree 4 7.84 % 8

Strongly Disagree 1 1.96 % 1

Total: 51 99.99% 184

Adult:
Variable Frequency Percentage W eighted Mean

Strongly Agree 21 42.86 % 84

Agree 23 46.94 % 69

Disagree 3 6.12 % 6

Strongly Disagree 2 4.08 % 2

Total: 49 100 % 161

Page | 57
ICCT COLLEGES FOUNDATION INCORPORATED

80
72.53
70

60

50 46.94
42.86
40

30

20 17.65

10 6.12 7.84
4.08
1.96
0
ADULT TEENAGER

Strongly Agree Agree Disagree Strongly Disagree

T h i s t a b l e s h o ws t h a t 7 2 . 5 3 % o f t e e n a g e r a n d 4 2 . 8 6 % o f a d u l t
a r e S t ro n g l y A g r e e t o t h e la n g u a g e t h a t u s e d t o m o b i le
apps.17.65% of teenager and 46.94% of adult are Agree to the
l a n g u a g e t h a t u se d t o m o b i le a p p s . 7 . 8 4 % o f t e e n a g e r a n d 6 . 1 2 %
o f a d u l t a re D i sa g r e e t o t h e l a n g u a ge t h a t u s e d t o m o b i l e a p p s .
1 . 9 6 % o f t e e n a g e r a n d 4 . 0 8 % o f a d u l t a re S t r o n g l y D i s a g r e e t o
t h e l a n g u a g e t h a t u s e d t o m o b i le a p p s .

T h e i n t e rp r e t a t io n o f t h e d a t a m o s t o f t h e t e e n a g e r a r e
S t r o n g l y A g r e e t o t h e l a n g u a g e t h a t u s e d t o m o b i le a p p s .

Page | 58
ICCT COLLEGES FOUNDATION INCORPORATED

Question n o . 4

Text Font is readable

Teenager:

Variable Frequency Percentage W eighted Mean

Strongly Agree 25 49.02 % 100

Agree 24 47.06 % 72

Disagree 2 3.92 % 6

Strongly Disagree 0 0 % 0

Total: 51 100 % 178

Adult:
Variable Frequency Percentage W eighted Mean

Strongly Agree 25 51.02 % 100

Agree 21 42.86 % 63

Disagree 1 2.04 % 2

Strongly Disagree 2 4.08 % 2

Total: 49 100 % 167

Page | 59
ICCT COLLEGES FOUNDATION INCORPORATED

80
72.53
70

60

50 46.94
42.86
40

30

20 17.65

10 6.12 7.84
4.08
1.96
0
ADULT TEENAGER

Strongly Agree Agree Disagree Strongly Disagree

T h i s t a b l e s h o ws t h a t 7 2 . 5 3 % o f t e e n a g e r a n d 4 2 . 8 6 % o f a d u lt
a r e S t ro n g l y A g r e e wi t h re a d a b i l i t y o f t h e t e xt f o n t . 1 7 . 6 5 % o f
t e e n a g e r a n d 4 6 . 9 4 % o f a d u l t a re A g r e e wi t h r e a d a b i l i t y o f t h e
t e xt f o n t . 7 . 8 4 % o f t e e n a g e r a n d 6 . 1 2 % o f a d u l t a re D is a g r e e
wi t h r e a d a b i l i t y o f t h e t e xt f o n t . 1 . 9 6 % o f t e e n a ge r a n d 4 . 0 8 % o f
a d u l t a r e S t r o n g l y D i s a g r e e wi t h r e a d a b i l i t y o f t h e t e xt f o n t .

T h e i n t e rp r e t a t io n o f t h e d a t a m o s t o f t h e t e e n a g e r a r e
S t r o n g l y A g r e e wi t h r e a d a b i l i t y o f t h e t e xt .

Page | 60
ICCT COLLEGES FOUNDATION INCORPORATED

Question n o . 5

Graphica l passwords are easy to use

Teenager:

Variable Frequency Percentage W eighted Mean

Strongly Agree 16 31.37 % 64

Agree 32 62.75 % 96

Disagree 2 3.92 % 4

Strongly Disagree 1 1.96 % 1

Total: 51 100 % 165

Adult:
Variable Frequency Percentage W eighted Mean

Strongly Agree 17 34.69 % 68

Agree 21 42.86 % 63

Disagree 10 20.41 % 20

Strongly Disagree 1 2.04 % 1

Total: 49 100 % 167

Page | 61
ICCT COLLEGES FOUNDATION INCORPORATED

70
62.75
60

50
42.86
40
34.69
31.37
30
20.41
20

10
3.92
2.04 1.96
0
ADULT TEENAGER

Strongly Agree Agree Disagree Strongly Disagree

T h i s t a b le sh o ws t h a t 3 1 . 3 7 % o f t e e n a g e r a n d 3 4 . 6 9 % a r e
S t r o n g l y A g r e e a b o u t u s a b i l i t y o f m o b i l e a p p s. 6 2 . 7 5 % o f
teenager and 42.86% of adult Agree about the usability of mobile
a p p s . 3 . 9 2 % o f t e e n a g e r a n d 2 0 . 4 1 % o f a d u l t D i sa g r e e a b o u t t h e
u s a b i l i t y o f m o b i l e a p p s. 1 . 9 6 % o f t e e n a g e r a n d 2 . 0 4 % o f a d u lt
S t r o n g l y D i s a g r e e a b o u t t h e u s a b i l i t y o f m o b i l e a p p s.

T h e i n t e r p re t a t io n o f d a t a m o st o f t h e t e e n a ge r A g r e e a b o u t t h e
u s a b i l i t y o f m o b i l e a p p s.

Page | 62
ICCT COLLEGES FOUNDATION INCORPORATED

Question n o . 6

Color theme of the layout is satisfying

Teenager:

Variable Frequency Percentage W eighted Mean

Strongly Agree 28 54.90 % 112

Agree 21 41.18 % 63

Disagree 2 3.92 % 6

Strongly Disagree 0 0 % 0

Total: 51 100 % 181

Adult:
Variable Frequency Percentage W eighted Mean

Strongly Agree 25 51.02 % 100

Agree 18 36.73 % 54

Disagree 6 12.24 % 12

Strongly Disagree 0 0 % 0

Total: 49 99.99 % 166

Page | 63
ICCT COLLEGES FOUNDATION INCORPORATED

60
54.9
51.02
50

41.18
40 36.73

30

20
12.24
10
3.92
2.04
0
0
ADULT TEENAGER

Strongly Agree Agree Disagree Strongly Disagree

T h i s t a b le sh o ws t h a t 5 4 . 9 0 % o f t e e n a g e r a n d 5 1 . 0 2 % o f a d u l t
a r e S t ro n g l y A g r e e a b o u t t h e C o lo r t h e m e o f t h e la yo u t .
4 1 . 1 8 % o f t e e n a ge r a n d 3 6 . 7 3 % o f a d u l t a r e A g r e e a b o u t t h e
C o l o r t h e m e o f t h e l a yo u t . 3 . 9 2 % o f t e e n a g e r a n d 1 2 . 2 4 % o f
a d u l t a r e D i s a g r e e a b o u t t h e Co l o r t h e m e o f t h e la yo u t . 0 % o f
t e e n a g e r a n d 0 % o f a d u l t a re S t r o n g l y D i s g r e e a b o u t t h e C o lo r
t h e m e o f t h e la yo u t .

T h i s in t e r p r e t a t i o n o f d a t a m o s t o f t h e t e e n a ge r a re S t ro n g l y
A g r e e a b o u t t h e Co l o r t h e m e o f t h e la yo u t .

Page | 64
ICCT COLLEGES FOUNDATION INCORPORATED

Question n o . 7

It provides a better security to my mobile phone

Teenager:

Variable Frequency Percentage W eighted Mean

Strongly Agree 35 68.63 % 140

Agree 15 29.41 % 45

Disagree 1 1.96 % 2

Strongly Disagree 0 0 % 0

Total: 51 100 % 187

Adult:
Variable Frequency Percentage W eighted Mean

Strongly Agree 23 46.99 % 92

Agree 17 34.69 % 51

Disagree 8 16.33 % 16

Strongly Disagree 1 2.04 % 1

Total: 49 100 % 160

Page | 65
ICCT COLLEGES FOUNDATION INCORPORATED

80
68.63
70

60

50 46.94

40 34.69
29.41
30

20 16.33

10
2.04 1.96
0
0
ADULT TEENAGER

Strongly Agree Agree Disagree Strongly Disagree

T h i s t a b l e s h o ws t h a t 6 8 . 6 3 % o f t e e n a g e r a n d 4 6 . 9 9 % o f a d u lt
a r e S t ro n g l y A g r e e a b o u t t h e s e c u r it y o f t h e i r m o b i l e d e vi c e s .
2 9 . 4 1 % o f t e e n a ge r a n d 3 4 . 6 9 % o f a d u l t a r e A g r e e a b o u t t h e
s e c u r it y o f t h e i r m o b i le d e vi c e s . 1 . 9 6 % o f t e e n a g e r a n d 1 6 . 3 3 %
o f a d u l t a re d i s a g re e a b o u t t h e se cu ri t y o f t h e i r m o b i l e d e vi c e s .
0 % o f t e e n a g e r a n d 2 . 0 4 % o f a d u l t a r e s t ro n g l y d i s a g r e e a b o u t
t h e se c u r i t y o f t h e i r m o b i le d e vi c e s .

T h e i n t e r p r e t a t io n o f d a t a m o st t e e n a g e r a r e S t r o n g l y A g r e e
a b o u t t h e se c u r i t y o f t h e i r m o b i l e d e vi c e s .

Page | 66
ICCT COLLEGES FOUNDATION INCORPORATED

Question n o . 8

“Forq Password” will run on android devices

Teenager:

Variable Frequency Percentage W eighted Mean

Strongly Agree 21 41.18 % 84

Agree 28 54.90 % 84

Disagree 2 3.92 % 4

Strongly Disagree 0 0 % 0

Total: 51 100 % 172

Adult:
Variable Frequency Percentage W eighted Mean

Strongly Agree 21 42.86 % 84

Agree 24 48.98 % 72

Disagree 4 8.16 % 8

Strongly Disagree 0 0 % 0

Total: 49 100 % 16

Page | 67
ICCT COLLEGES FOUNDATION INCORPORATED

60
54.9

48.86
50
42.86
41.18
40

30

20

10 8.16
3.92
0 0
0
ADULT TEENAGER

Strongly Agree Agree Disagree Strongly Disagree

T h i s t a b le sh o w t h a t 4 1 . 1 8 % o f t e e n a g e r a n d 4 2 . 8 6 % a re
S t r o n g l y A g r e e a b o u t r u n n in g o f a p p s o n m o b i l e d e vi c e s . 5 4 . 9 0 %
o f t e e n a g e r a n d 4 8 . 9 8 % a re A g r e e a b o u t ru n n i n g o f a p p s o n
m o b i l e d e vi c e s . 3 . 9 2 % o f t e e n a g e r a n d 8 . 1 6 % a r e D i sa g r e e a b o u t
r u n n in g o f a p p s o n m o b i l e d e vi c e s . 0 % o f t e e n a g e r a n d 0 % a r e
S t r o n g l y D i s a g r e e a b o u t r u n n in g o f a p p s o n m o b i l e d e vi c e s .

T h e i n t e rp r e t a t io n o f d a t a m o s t o f t h e t e e n a g e r a r e A g r e e
A g r e e a b o u t ru n n in g o f a p p s o n m o b i l e d e vi c e s .

Page | 68
ICCT COLLEGES FOUNDATION INCORPORATED

Question n o . 9

“Forq Password” app functions well

Teenager:

Variable Frequency Percentage W eighted Mean

Strongly Agree 19 37.25 % 84

Agree 31 68.78 % 84

Disagree 1 1.96 % 4

Strongly Disagree 0 0 % 0

Total: 51 99.99 % 172

Adult:
Variable Frequency Percentage W eighted Mean

Strongly Agree 18 36.73 % 72

Agree 28 57.14 % 84

Disagree 3 6.12 % 6

Strongly Disagree 0 0 % 0

Total: 49 99.99 % 164

Page | 69
ICCT COLLEGES FOUNDATION INCORPORATED

80
68.78
70

60 57.14

50

40 37.25 37.25

30

20

10 6.12 6.12
0 0
0
ADULT TEENAGER

Strongly Agree Agree Disagree Strongly Disagree

T h i s t a b l e s h o w t h a t 3 7 . 2 5 % o f t e e n a g e r a n d 3 6 . 7 3 % o f a d u l t a re
S t r o n g l y A g r e e a b o u t t h e f u n ct i o n a l it y o f m o b i le a p p s . 6 8 . 7 8 % o f
t e e n a g e r a n d 5 7 . 1 4 % o f a d u l t a re A g r e e a b o u t t h e f u n ct i o n a l i t y o f
m o b i l e a p p s . 1 . 9 6 % o f t e e n a ge r a n d 6 . 1 2 % o f a d u l t a re D i sa g r e e
a b o u t t h e f u n ct i o n a l i t y o f m o b i l e a p p s . 0 % o f t e e n a g e r a n d 0 % o f
adult are Strongly Disagree about the functionality of mobile
apps.

T h e in t e r p re t a t i o n o f d a t a m o s t t e e n a g e r a re A g r e e a b o u t t h e
f u n c t io n a l i t y o f m o b i l e a p p s.

Page | 70
ICCT COLLEGES FOUNDATION INCORPORATED

Question n o . 10

Users want to use this mobile apps.

Teenager:

Variable Frequency Percentage W eighted Mean

Strongly Agree 32 62.75 % 128

Agree 17 33.33 % 51

Disagree 2 3.92 % 4

Strongly Disagree 0 0 % 0

Total: 51 100 % 183

Adult:
Variable Frequency Percentage W eighted Mean

Strongly Agree 18 36.73 % 72

Agree 20 40.82 % 60

Disagree 10 20.41 % 20

Strongly Disagree 1 2.04 % 1

Total: 49 100 % 153

Page | 71
ICCT COLLEGES FOUNDATION INCORPORATED

70
62.75
60

50
40.82
40 36.73
33.33
30
20.41
20

10
3.92
2.04
0
0
ADULT TEENAGER

Strongly Agree Agree Disagree Strongly Disagree

This table show that 62.75% of Teenager and 36.73% of Adult


a r e S t ro n g A g r e e a b o u t sa t i sf a ct i o n o f u s in g t h i s m o b i le a p p .
33.33% of Teenager and 40.82% of Adult are Agree about
s a t i sf a ct i o n o f u s in g t h is m o b i l e a p p . 3 . 9 2 % o f T e e n a ge r a n d
2 0 . 4 1 % o f A d u l t a re D i sa g r e e a b o u t s a t i s f a ct i o n o f u s in g t h is
m o b i l e a p p . 6 2 . 7 5 % o f T e e n a g e r a n d 3 6 . 7 3 % o f A d u l t a r e S t ro n g
A g r e e a b o u t sa t i sf a c t io n o f u s i n g t h is m o b i le a p p . 0 % o f
T e e n a g e r a n d 2 . 0 4 % o f A d u l t a re S t r o n g D i s a g r e e a b o u t
s a t i sf a ct i o n o f u s in g t h is m o b i l e a p p .

T h e i n t e r p re t a t io n o f d a t a m o st t e e n a g e r a r e S t r o n g l y A g r e e
a b o u t sa t i sf a ct i o n o f u s in g t h i s m o b i le a p p .

Page | 72
ICCT COLLEGES FOUNDATION INCORPORATED

Question n o . 11

Users will recommend the mobile apps to the


others

Teenager:

Variable Frequency Percentage W eighted Mean

Strongly Agree 27 52.94 % 108

Agree 21 41.18 % 63

Disagree 2 3.92 % 4

Strongly Disagree 1 1.96 % 1

Total: 51 100 % 176

Adult:
Variable Frequency Percentage W eighted Mean

Strongly Agree 19 38.78 % 76

Agree 22 44.90 % 66

Disagree 8 16.33 % 16

Strongly Disagree 0 0 % 0

Total: 49 100 % 158

Page | 73
ICCT COLLEGES FOUNDATION INCORPORATED

60
52.94

50
44.9
41.18
38.78
40

30

20 16.33

10
3.92
2.04 1.96
0
0
ADULT TEENAGER

Strongly Agree Agree Disagree Strongly Disagree

T h i s t a b l e s h o w t h a t 5 2 . 9 4 % o f t e e n a g e r a n d 3 8 . 7 8 % o f a d u l t a re
S t r o n g l y A g r e e a b o u t sa t i sf a ct i o n o f r e c o m m e n d in g t h e m o b i le
a p p s t o t h e o t h e r u s e r s. 4 1 . 1 8 % o f t e e n a g e r a n d 4 4 . 9 0 % o f a d u l t
a r e A g r e e a b o u t sa t i sf a ct i o n o f re c o m m e n d in g t h e m o b i l e a p p s t o
t h e o t h e r u s e r s. 3 . 9 2 % o f t e e n a g e r a n d 1 6 . 3 3 % o f a d u lt a re
d i s a g r e e a b o u t sa t i s f a ct i o n o f re c o m m e n d in g t h e m o b i le a p p s t o
t h e o t h e r u s e r s. 1 , 9 6 % o f t e e n a g e r a n d 0 % o f a d u l t a r e d i sa g r e e
a b o u t sa t i sf a ct i o n o f re c o m m e n d i n g t h e m o b i le a p p s t o t h e o t h e r
u s e r s.

T h e i n t e r p re t a t io n o f d a t a m o st t e e n a g e r a r e S t r o n g l y a g r e e
a b o u t sa t i sf a ct i o n o f re c o m m e n d i n g t h e m o b i le a p p s t o t h e o t h e r
u s e r s.

Page | 74
ICCT COLLEGES FOUNDATION INCORPORATED

CHAPTER 6
SUMM ARY , CONCLUSION AND RECOMMENDATION

6.1 SUMM ARY


T h e “ F o r q P a s s wo r d ” a p p s p ro vi d e s t o t h e u se r a n i n n o va t e d
p a s s wo r d a u t h e n t ic a t io n f o r t h e i r lo ck s c r e e n a n d a p p lo c k s u s in g
g r a p h i ca l p a s s wo rd a u t h e n t ic a t io n i n s t e a d o f t e xt u a l p a s s wo r d
a u t h e n t ic a t i o n . T h e p u r p o se o f t h e m o b i l e a p p s t o p r o vi d e h i g h e r
s e c u r it y t o t h e m o b i l e d e vi c e s t o p r o t e c t t h e m se l ve s a g a i n s t t o
t h e h a c ke r s a n d t o t h e t h ie ve s . Fo r I n s t a n ce , I f t h e re so m e o n e
a t t e m p t s t o o p e n t h e i r sm a r t p h o n e o r t h e sm a r t p h o n e wa s s t o le n ,

T h e G P S a n d i n t r u d e r se lf ie wi l l a c t i va t e a u t o m a t i ca l l y a n d it
wo u l d se n d t h e l o ca t i o n a n d p i c t u r e t o t h e u se r ’ s gm a i l a c c o u n t .
T h e y c o u l d o p e n t h e i r gm a i l a c co u n t o n co m p u t e r e ve n t h e i r
s m a r t p h o n e wa s st o l e n . T h e in f o r m a t i o n t h a t se n d t o t h e u se r
wo u l d se r ve a s a e vi d e n ce t o t r a c k a n d a r r e s t t h e c r im i n a l s . I n
t e rm s o f m o b i le se c u r i t y, T h e h a c k e rs c o u l d n o t e a s i l y a c c e s s t o
t h e u s e r ’ s m o b i le d e vi c e s . S i n c e , T h e r e se a r c h e s im p le m e n t e d
t h e g r a p h i ca l p a s swo r d a s a n i n n o va t e d p a s s wo r d ,
C yb e r c r i m i n a l s c o u l d n ’ t d o t h e i r n e f a r i o u s a c t i vi t y f o r t h e i r
vi c t i m s .

Page | 75
ICCT COLLEGES FOUNDATION INCORPORATED

6.2 CONCLUSION
A password is a string of characters used to verify the identity of a user
during the authentication process. User’s passwords are typically used in
conjuncture with a username; they are designed to be known only to the user
and allow that user to gain access to a device, application or website. User’s
passwords are hacked in a variety of ways and for a variety of reasons.
Sometimes the hacker is someone you know. It could be a “frenemy” who wants
to access your information. If a hacker is unknown to you, a brute force attack is
the most common strategy for cracking your password. In this method, a program
systematically tries every password combination until it gains access. That is why
the simpler the user’s password is, the easier it is for someone to gain access.
Since it has not yet been shown to all and not already to introduce widely.

After the studies and survey interpretation, we conclude that our new
developed app is the new best way to secure user’s mobile. Phone users are
new to this kind of password. The color / images password authentication will be
made on mobile devices. The color/images pattern password authentication were
inspired to the slide puzzle game and candy crush games where the user are
able to create their own pattern of images and arrange their own images and
colors when the user are setting up a password before it can would activated.
The password authentication color /images pattern can be used on screen lock
and app lock.

Page | 76
ICCT COLLEGES FOUNDATION INCORPORATED

6.3 RECOMMENDATION

T o t he m ob i l e de ve l o p e rs

We highly recommend this mobile apps to the Mobile developers is to continue


building other important features that we did not create. We have a lot of plans
for our mobile apps and we've made a flow chart for our first mobile apps that we
want to build. But, unfortunately we have not resumed other features that we
want to build due to the lack of time, resources and due to the low specification of
laptop that cause of slow progress in coding to build these mobile apps.

The main function of mobile application is already functionable and there are
some of features we did not implement and we highly recommended this mobile
application to the Mobile developers to continue what we start and add more
amazing features to make our Mobile Users are highly secured against to the
hackers.

Here are the following features that we have not finished completing but this type
of mobile apps need to build and implement for the security of mobile users
around the world.

- Change Password
- Forgot Password
- Intruder Notification
- Help
- Feedback
- LockScreen and Applock Activation
- Attempts activation
- Automated GPS to activate when someone tried to open their
mobile device.
- Slide Puzzle and Color/Images pattern that would serve as a
recommended password authentication. (but we have already
session password authentication for the user’s choice)
- Phone number that would serve as a login and connected to the
user’s gmail account.
- SMS for forgot password verification .

Page | 77
ICCT COLLEGES FOUNDATION INCORPORATED

APPENDIX

An d r o i d M a n i f e s t . x m l

<?xml version="1.0" encoding="utf-8"?>


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.uulm.graphicalpasswords"
android:versionCode="3"
android:versionName="0.3" >

<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="15" />

<uses-permission android:name="android.permission.VIBRATE" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="de.uulm.graphicalpasswords.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />


</intent-filter>
</activity>
<activity

Page | 78
ICCT COLLEGES FOUNDATION INCORPORATED

android:name="de.uulm.graphicalpasswords.openmiba.MIBAActivity"
android:label="@string/title_activity_miba" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.MainActivity" />
</activity>
<activity

android:name="de.uulm.graphicalpasswords.openmiba.MIBACreatePasswordActivity"
android:label="@string/title_activity_miba_create_password" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.openmiba.MIBAActivity"
/>
</activity>
<activity

android:name="de.uulm.graphicalpasswords.openmiba.MIBASettingsActivity"
android:label="@string/title_activity_miba_settings" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.openmiba.MIBAActivity"
/>
</activity>
<activity
android:name="de.uulm.graphicalpasswords.openmiba.MIBALoginActivity"
android:label="@string/title_activity_miba_login" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.openmiba.MIBAActivity"
/>
</activity>
<activity
android:name="de.uulm.graphicalpasswords.openpassgo.PassGoActivity"
android:label="@string/title_activity_pass_go" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.MainActivity" />
</activity>
<activity

android:name="de.uulm.graphicalpasswords.openpassgo.PassGoCreatePasswordActivity"
android:label="@string/title_activity_pass_go_create_password" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"

android:value="de.uulm.graphicalpasswords.openpassgo.PassGoActivity" />
</activity>
<activity

android:name="de.uulm.graphicalpasswords.openpassgo.PassGoSettingsActivity"
android:label="@string/title_activity_pass_go_settings" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"

Page | 79
ICCT COLLEGES FOUNDATION INCORPORATED

android:value="de.uulm.graphicalpasswords.openpassgo.PassGoActivity" />
</activity>
<activity

android:name="de.uulm.graphicalpasswords.openpassgo.PassGoLoginActivity"
android:label="@string/title_activity_pass_go_login" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"

android:value="de.uulm.graphicalpasswords.openpassgo.PassGoActivity" />
</activity>
<activity
android:name="de.uulm.graphicalpasswords.opentapi.TAPIActivity"
android:label="@string/title_activity_tapi" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.MainActivity" />
</activity>
<activity

android:name="de.uulm.graphicalpasswords.opentapi.TAPICreatePasswordActivity"
android:label="@string/title_activity_tapi_create_password" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.opentapi.TAPIActivity"
/>
</activity>
<activity
android:name="de.uulm.graphicalpasswords.opentapi.TAPILoginActivity"
android:label="@string/title_activity_tapi_login" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.opentapi.TAPIActivity"
/>
</activity>
<activity
android:name="de.uulm.graphicalpasswords.opentapi.TAPISettingsActivity" >
android:label="@string/title_activity_tapi_settings" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.opentapi.TAPIActivity"
/>
</activity>
<activity
android:name="de.uulm.graphicalpasswords.openuyi.UYIActivity"
android:label="@string/title_activity_uyi" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.MainActivity" />
</activity>
<activity

android:name="de.uulm.graphicalpasswords.openuyi.UYICreatePasswordActivity"
android:label="@string/title_activity_uyicreate_password" >

Page | 80
ICCT COLLEGES FOUNDATION INCORPORATED

<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.openuyi.UYIActivity" />
</activity>
<activity
android:name="de.uulm.graphicalpasswords.openuyi.UYILoginActivity"
android:label="@string/title_activity_uyilogin" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.openuyi.UYIActivity" />
</activity>
<activity
android:name="de.uulm.graphicalpasswords.openuyi.UYISettingsActivity"
android:label="@string/title_activity_uyi_settings" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.uulm.graphicalpasswords.openuyi.UYIActivity" />
</activity>
</application>

</manifest>

Check this location :


C:\Users\Chad\Downloads\FORQPassword\Source\src\de\uulm\graphica
lpasswords

T h e s e a re pa s s w o r d a u t he n t i c a ti on f e a t ur e s . O p e n t h e f i r s t
one.

Page | 81
ICCT COLLEGES FOUNDATION INCORPORATED

G e s t ur e . c s
package de.uulm.graphicalpasswords.openmiba;

import android.os.Parcel;
import android.os.Parcelable;

public class Gesture implements Parcelable {


private int picID;
private boolean[] gesture = new boolean[MIBACreatePasswordActivity.INPUTLENGTH];

/*
* This field is needed for Android to be able to create new objects,
* individually or as arrays.
*/
@SuppressWarnings("rawtypes")
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
public Gesture createFromParcel(Parcel in) {
return new Gesture(in);
}

public Gesture[] newArray(int size) {


return new Gesture[size];
}
};

public Gesture(int picID, boolean[] gesture) {


this.picID = picID;
this.gesture = gesture;
}

public Gesture(Parcel in) {


this.picID = in.readInt();
in.readBooleanArray(gesture);
}

@Override
public void writeToParcel(Parcel parcel, int arg1) {
parcel.writeInt(picID);
parcel.writeBooleanArray(gesture);
}

@Override

Page | 82
ICCT COLLEGES FOUNDATION INCORPORATED

public int describeContents() {


return 0;
}

public int getPicID() {


return picID;
}

public boolean[] getGesture() {


return gesture;
}

@Override
public String toString() {
String res = "(" + picID + ":";
for (int i = 0; i < gesture.length; i++) {
if (gesture[i]) {
res += 1;
} else {
res += 0;
}
}
res += ")";
return res;
}
}

ImageIndexTable.cs

package de.uulm.graphicalpasswords.openmiba;

import java.util.ArrayList;
import java.util.List;

public class ImageIndexTable {

public final static int NEEDEDPICTURES = 512; // 2^9 (9 = INPUTLENGTH)


public final static int PICTURELIMIT = 30;

public static int m = 521; // mit 9 bit sind 512 bilder notwendig
boolean[] isused;

Page | 83
ICCT COLLEGES FOUNDATION INCORPORATED

List<Integer> indexedpos = new ArrayList<Integer>();

public ImageIndexTable() {
this.isused = new boolean[m];
}

/**
* Returns an index of a image that wasn't used already. If we have more
* rounds than pictures than increase the offset, which means that all
* pictures are unused again
*
* @param pos
* @return
*/
public int getIndex(int pos) {

int offset = indexedpos.size() / PICTURELIMIT;

pos = (pos % PICTURELIMIT) + (offset * PICTURELIMIT);

if (pos > m - 1) {
return 0;
}

if (isused[pos] == false) {

isused[pos] = true;
indexedpos.add(pos);
return pos % PICTURELIMIT;
} else
return getIndex(pos, 1);
}

void initArray(boolean[] a, boolean init) {

for (int i = 0; i < a.length; i++) {


a[i] = false;
}
}

protected int getIndex(final int pos, int i) {

int offset = indexedpos.size() / PICTURELIMIT;

int temp = ((pos + i) % PICTURELIMIT) + (offset * PICTURELIMIT);

Page | 84
ICCT COLLEGES FOUNDATION INCORPORATED

if (isused[temp] == false) {
isused[temp] = true;
indexedpos.add(temp);
return temp % PICTURELIMIT;
} else {
i++;
return getIndex(pos, i);
}

public void removeLastIndex() {


int end = 0;
if (indexedpos.size() == 1)
end = 1;
else if (indexedpos.size() == 0)
end = 0;
else
end = 2;

for (int i = 0; i < end; i++) {


int pos = indexedpos.get(indexedpos.size() - 1);
isused[pos] = false;
indexedpos.remove(indexedpos.size() - 1);
}

MIBAActivity.cs
package de.uulm.graphicalpasswords.openmiba;

import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.support.v4.app.NavUtils;
import android.annotation.TargetApi;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.preference.PreferenceManager;

Page | 85
ICCT COLLEGES FOUNDATION INCORPORATED

public class MIBAActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_miba);
// Show the Up button in the action bar.
setupActionBar();
}

@Override
protected void onResume() {
super.onResume();
Button login = (Button) findViewById(R.id.btn_login);
SharedPreferences sharedPref = PreferenceManager
.getDefaultSharedPreferences(this);
if (sharedPref.getString("miba_pw", "").equals(""))
login.setEnabled(false);
else
login.setEnabled(true);
}

/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.miba, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//

Page | 86
ICCT COLLEGES FOUNDATION INCORPORATED

NavUtils.navigateUpFromSameTask(this);
return true;
case R.id.action_settings:
Intent intent = new Intent(
this,

de.uulm.graphicalpasswords.openmiba.MIBASettingsActivity.class);
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}

public void startCreatePassword(View view) {


Intent intent = new Intent(
this,

de.uulm.graphicalpasswords.openmiba.MIBACreatePasswordActivity.class);
startActivity(intent);
}

public void startEnterPassword(View view) {


Intent intent = new Intent(this,

de.uulm.graphicalpasswords.openmiba.MIBALoginActivity.class);
startActivity(intent);
}
}

MIBACreatePasswordActivity.cs

package de.uulm.graphicalpasswords.openmiba;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Vibrator;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;

Page | 87
ICCT COLLEGES FOUNDATION INCORPORATED

import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TextView;
import android.support.v4.app.NavUtils;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.preference.PreferenceManager;

public class MIBACreatePasswordActivity extends Activity {

private ArrayList<Integer> seenPictureIds = new ArrayList<Integer>();

// amount of booleans of one entry


// one for each rectangle and one for shift
public final static int INPUTLENGTH = 9;

Page | 88
ICCT COLLEGES FOUNDATION INCORPORATED

private TableLayout tblLayout;


private LinearLayout linlGrid[][];
private Button btnDone;
private Button btnBack;
private TextView tvRound;

private static String LOG_TAG = "MIBALoginActivity";


private int width;
private int height;
private TouchListener touchlistener;

int[][] colors_off = { { 0x3C000000, 0x3C000000, 0x3C000000, 0x3C000000 },


{ 0x3C000000, 0x3C000000, 0x3C000000, 0x3C000000 } };

public int min_rounds = 1;


public int current_round = 1;
public int rounds_to_do = 2;

private boolean longpress = false;

private ArrayList<Boolean> input = new ArrayList<Boolean>();


private ImageIndexTable imgidxtable = new ImageIndexTable();

private Handler handler = new MIBACreatePasswordHandler(


new WeakReference<MIBACreatePasswordActivity>(this));

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

// requestWindowFeature(Window.FEATURE_NO_TITLE);
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
// WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_miba_create_password);

SharedPreferences sharedPref = PreferenceManager


.getDefaultSharedPreferences(this);
rounds_to_do = Integer.parseInt(sharedPref
.getString("miba_length", "1"));
min_rounds = rounds_to_do;

Bundle bundle = new Bundle();


bundle.putInt("length", rounds_to_do);
DialogFragment intro = new IntroDialogFragment();

Page | 89
ICCT COLLEGES FOUNDATION INCORPORATED

intro.setArguments(bundle);
intro.show(getFragmentManager(), "intro");

// Show the Up button in the action bar.


setupActionBar();

setViews();
seenPictureIds.add(R.drawable.ccp000);
}

public static class IntroDialogFragment extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
String message = getString(R.string.msg_dialog_miba_createpw,
getArguments().getInt("length"));
builder.setTitle(R.string.title_dialog_miba_createpw)
.setMessage(message)
.setNeutralButton(R.string.btn_ok, new
OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int which) {
dialog.dismiss();
}
});
return builder.create();
}
}

public static class RememberPasswordDialogFragment extends DialogFragment {


@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
MIBACreatePasswordActivity activity =
(MIBACreatePasswordActivity) getActivity();

LayoutInflater layoutInflater = (LayoutInflater) getActivity()


.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = layoutInflater.inflate(
R.layout.miba_rememberpw_dialog, (Gallery)
getActivity()

.findViewById(R.id.miba_rememberpw_gallery));

activity.unbindDrawables(activity.findViewById(R.id.tableLayout));
System.gc();
Gallery g = (Gallery) layout
.findViewById(R.id.miba_rememberpw_gallery);
g.setAdapter(new ImageAdapter(activity.getBaseContext(),
activity

Page | 90
ICCT COLLEGES FOUNDATION INCORPORATED

.getSeenPictureIDs(), activity.getInput()));

AlertDialog.Builder builder = new


AlertDialog.Builder(getActivity());
builder.setView(layout)
.setTitle(
getResources().getString(

R.string.title_dialog_miba_rememberpw))
.setPositiveButton(

getResources().getString(R.string.btn_done),
new
DialogInterface.OnClickListener() {
public void
onClick(DialogInterface dialog,
int which) {

SharedPreferences
sharedPref = PreferenceManager

.getDefaultSharedPreferences(getActivity());

SharedPreferences.Editor edit = sharedPref

.edit();
edit.putString(

"miba_pw",

((MIBACreatePasswordActivity) getActivity())

.buildPasswordString());
edit.commit();
dialog.dismiss();

getActivity().finish();
}
});
return builder.create();
}

private class ImageAdapter extends BaseAdapter {


private int galleryItemBackground;
private Context mContext;

private ArrayList<Integer> pictureIDs;


private ArrayList<Boolean> password;

public ImageAdapter(Context c, ArrayList<Integer>


seenPictureIds,
ArrayList<Boolean> eingabe) {
mContext = c;
pictureIDs = seenPictureIds;
this.password = eingabe;

Page | 91
ICCT COLLEGES FOUNDATION INCORPORATED

TypedArray attr = mContext

.obtainStyledAttributes(R.styleable.UYIGallery);
galleryItemBackground = attr
.getResourceId(

R.styleable.UYIGallery_android_galleryItemBackground,
0);
attr.recycle();
}

@Override
public int getCount() {
return pictureIDs.size() - 1;
}

@Override
public Object getItem(int position) {
return position;
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup
parent) {
ImageView i = new ImageView(mContext);
i.setScaleType(ImageView.ScaleType.FIT_XY);
i.setBackgroundResource(galleryItemBackground);

Bitmap b = BitmapFactory.decodeResource(getResources(),
pictureIDs.get(position));
Bitmap mutableBitmap = b.copy(Bitmap.Config.ARGB_8888,
true);
Canvas c = new Canvas(mutableBitmap);
Paint p = new Paint();
p.setColor(Color.RED);
p.setStyle(Style.FILL);
p.setAlpha(75);
p.setAntiAlias(true);
Paint p2 = new Paint();
p2.setColor(Color.WHITE);
p2.setStyle(Style.STROKE);
p2.setStrokeWidth(5);
p2.setAntiAlias(true);

float imageWidth = mutableBitmap.getWidth() / 2;


float imageHeight = mutableBitmap.getHeight() / 4;

List<Boolean> tmp = new ArrayList<Boolean>();

Page | 92
ICCT COLLEGES FOUNDATION INCORPORATED

tmp = password.subList(position * INPUTLENGTH, position


* INPUTLENGTH + 8);
for (int j = 0; j < tmp.size(); j++) {
switch (j) {
case 0:
if (tmp.get(j))
c.drawRect(5, 5, imageWidth - 5,
imageHeight - 5, p);
c.drawRect(5, 5, imageWidth - 5,
imageHeight - 5, p2);
break;
case 1:
if (tmp.get(j))
c.drawRect(imageWidth + 5, 5, 2 *
imageWidth - 5,
imageHeight - 5, p);
c.drawRect(imageWidth + 5, 5, 2 *
imageWidth - 5,
imageHeight - 5, p2);
break;
case 2:
if (tmp.get(j))
c.drawRect(5, imageHeight + 5,
imageWidth - 5,
2 * imageHeight - 5,
p);
c.drawRect(5, imageHeight + 5, imageWidth -
5,
2 * imageHeight - 5, p2);
break;
case 3:
if (tmp.get(j))
c.drawRect(imageWidth + 5,
imageHeight + 5,
2 * imageWidth - 5, 2
* imageHeight - 5, p);
c.drawRect(imageWidth + 5, imageHeight + 5,
2 * imageWidth - 5, 2 *
imageHeight - 5, p2);
break;
case 4:
if (tmp.get(j))
c.drawRect(5, 2 * imageHeight + 5,
imageWidth - 5,
3 * imageHeight - 5,
p);
c.drawRect(5, 2 * imageHeight + 5,
imageWidth - 5,
3 * imageHeight - 5, p2);
break;
case 5:
if (tmp.get(j))
c.drawRect(imageWidth + 5, 2 *
imageHeight + 5,
2 * imageWidth - 5, 3
* imageHeight - 5, p);
c.drawRect(imageWidth + 5, 2 * imageHeight
+ 5,

Page | 93
ICCT COLLEGES FOUNDATION INCORPORATED

2 * imageWidth - 5, 3 *
imageHeight - 5, p2);
break;
case 6:
if (tmp.get(j))
c.drawRect(5, 3 * imageHeight + 5,
imageWidth - 5,
4 * imageHeight - 5,
p);
c.drawRect(5, 3 * imageHeight + 5,
imageWidth - 5,
4 * imageHeight - 5, p2);
break;
case 7:
if (tmp.get(j))
c.drawRect(imageWidth + 5, 3 *
imageHeight + 5,
2 * imageWidth - 5, 4
* imageHeight - 5, p);
c.drawRect(imageWidth + 5, 3 * imageHeight
+ 5,
2 * imageWidth - 5, 4 *
imageHeight - 5, p2);
break;
}
}

i.setImageBitmap(mutableBitmap);

return i;
}

}
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}

/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}

Page | 94
ICCT COLLEGES FOUNDATION INCORPORATED

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.miba_create_password, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of this
// activity, the Up button is shown. Use NavUtils to allow users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
// http://developer.android.com/design/patterns/navigation.html#up-
vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

/**
* Transforms the user input to a passwordstring. This string may contain
* unprintable ASCII Codes.
*
* @return
*/
public String buildPasswordString() {
String res = "";

for (int i = 0; i < input.size(); i++) {


if (input.get(i)) {
res += "1";
} else {
res += "0";
}

}
return res;
}

Page | 95
ICCT COLLEGES FOUNDATION INCORPORATED

public int boolToInt(boolean b) {


if (b)
return 1;
return 0;
}

/**
* Returns the index of the next background image depending on the previous
* user input
*
* @return
*/
public int getImageIndex() {
if (input.size() < INPUTLENGTH)
return -1;

int res = 0;

for (int i = 0; i < INPUTLENGTH; i++) {


boolean a = input.get(input.size() - INPUTLENGTH + i); // least

// significant

// bit

// zuerst
res = res << 1;
res = res + boolToInt(a);
}
res = imgidxtable.getIndex(res);
Log.i(LOG_TAG, "this entry lead to imageindex " + res);
return res;
}

private void setViews() {


tblLayout = (TableLayout) findViewById(R.id.tableLayout);
btnBack = (Button) findViewById(R.id.miba_btnBack);
btnBack.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
back();
}
});
btnDone = (Button) findViewById(R.id.miba_btnCreateMasterKey);

Page | 96
ICCT COLLEGES FOUNDATION INCORPORATED

tvRound = (TextView) this.findViewById(R.id.tvRound);


tvRound.setText(getString(R.string.label_round)+" 1");

linlGrid = new LinearLayout[2][4];


linlGrid[0][0] = (LinearLayout) this.findViewById(R.id.square1);
linlGrid[1][0] = (LinearLayout) this.findViewById(R.id.square2);
linlGrid[0][1] = (LinearLayout) this.findViewById(R.id.square3);
linlGrid[1][1] = (LinearLayout) this.findViewById(R.id.square4);
linlGrid[0][2] = (LinearLayout) this.findViewById(R.id.square5);
linlGrid[1][2] = (LinearLayout) this.findViewById(R.id.square6);
linlGrid[0][3] = (LinearLayout) this.findViewById(R.id.square7);
linlGrid[1][3] = (LinearLayout) this.findViewById(R.id.square8);

for (int y = 0; y < 4; y++) {


for (int x = 0; x < 2; x++) {
linlGrid[x][y].setBackgroundColor(colors_off[x][y]);
}

// get width and height from mainpanel


// can not use display width/height because of notification bar
ViewTreeObserver vto = tblLayout.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {

// get values of portrait mode

Display display = getWindowManager().getDefaultDisplay();

if (display.getRotation() == Surface.ROTATION_0) {
width = tblLayout.getWidth();
height = tblLayout.getHeight();
} else {
height = tblLayout.getWidth();
width = tblLayout.getHeight();
}

Bitmap bmp = BitmapFactory.decodeResource(getResources(),


R.drawable.ccp000);
bmp = Bitmap.createScaledBitmap(bmp, width, height, true);
Drawable d = new BitmapDrawable(getResources(), bmp);
tblLayout.setBackgroundDrawable(d);

Page | 97
ICCT COLLEGES FOUNDATION INCORPORATED

touchlistener = new TouchListener(linlGrid, width, height,


handler);
tblLayout.setOnTouchListener(touchlistener);
// remove listener again otherwise it gets called twice

tblLayout.getViewTreeObserver().removeGlobalOnLayoutListener(
this);
}
});

btnDone.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
DialogFragment dialog = new
RememberPasswordDialogFragment();
dialog.show(getFragmentManager(), "remember");
}
});
btnDone.setVisibility(View.VISIBLE);
}

private void back() {

setFinishable(false);

// last state
boolean isshift = touchlistener.getLastState();

// not two long presses in sequence


// remove last state and return the state of the last but one state
boolean lastbutoneisshift = touchlistener.reset();

// adapt round count


if (!isshift) { // normal click
if (current_round > 1)
current_round--;
if (lastbutoneisshift) { // back to shift screen
tvRound.setText(getString(R.string.label_round) + " "
+ current_round + " -Shift-");
} else { // decrease round
tvRound.setText(getString(R.string.label_round) + " "
+ current_round);
}

} else { // shift -> do not decrease round, show current round

Page | 98
ICCT COLLEGES FOUNDATION INCORPORATED

tvRound.setText(getString(R.string.label_round) + " "


+ current_round);
}

if (input.size() >= INPUTLENGTH)


// input: 8 rectangles + 1 shift enabled flag
for (int i = 0; i < INPUTLENGTH; i++) {
input.remove(input.size() - 1);
}

// enable last index


// if user inserts the same gesture -> show same picture again
imgidxtable.removeLastIndex();

// remove seen Pictures ...


seenPictureIds.remove(seenPictureIds.size() - 1);
seenPictureIds.remove(seenPictureIds.size() - 1);

// ... and show previous background image


int idx = getImageIndex();
changeBackground(idx);
}

public void changeBackground(int imageindex) {


int img = 0;
if (imageindex == -1) {
img = R.drawable.ccp000;
} else
img = R.drawable.ccp001 + imageindex;

seenPictureIds.add(img);

Bitmap bmp = BitmapFactory.decodeResource(getResources(), img);


bmp = Bitmap.createScaledBitmap(bmp, width, height, true);

Drawable d = new BitmapDrawable(getResources(), bmp);


bmp = null; // prevent outofmemory
tblLayout.setBackgroundDrawable(d);

public ArrayList<Gesture> getPasswordPictures() {


ArrayList<Gesture> res = new ArrayList<Gesture>();
int length = input.size() / INPUTLENGTH;
for (int i = 0; i < length; i++) {

Page | 99
ICCT COLLEGES FOUNDATION INCORPORATED

boolean[] list = new boolean[INPUTLENGTH];


for (int j = 0; j < list.length; j++) {
list[j] = input.get(i * INPUTLENGTH + j);
}
res.add(new Gesture(seenPictureIds.get(i), list));
}
return res;
}

private void checkIfFinished() {


if (current_round == rounds_to_do + 1) {
setFinishable(true);
}
}

private void setFinishable(boolean finish) {


btnDone.setEnabled(finish);
btnDone.setClickable(finish);
if (finish)
tblLayout.setOnTouchListener(null);
else
tblLayout.setOnTouchListener(touchlistener);
}

@Override
protected void onDestroy() {
super.onDestroy();
unbindDrawables(findViewById(R.id.tableLayout));
System.gc();
}

protected void unbindDrawables(View view) {


if (view.getBackground() != null) {
view.getBackground().setCallback(null);
}
if (view instanceof ViewGroup) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
unbindDrawables(((ViewGroup) view).getChildAt(i));
}
((ViewGroup) view).removeAllViews();
}
}

protected ArrayList<Integer> getSeenPictureIDs() {


return seenPictureIds;

Page | 100
ICCT COLLEGES FOUNDATION INCORPORATED

protected ArrayList<Boolean> getInput() {


return input;
}

private static class MIBACreatePasswordHandler extends Handler {


MIBACreatePasswordActivity activity;

private
MIBACreatePasswordHandler(WeakReference<MIBACreatePasswordActivity> instance) {
activity = instance.get();
}

@Override
public void handleMessage(Message msg) {

switch (msg.what) {
case TouchListener.MSG_ROUND_FINISHED: {
activity.longpress = false;

boolean[][] active = (boolean[][]) msg.obj;


for (int y1 = 0; y1 < 4; y1++) {
for (int x1 = 0; x1 < 2; x1++) {
if (active[x1][y1] == true) {
Log.i(LOG_TAG, "Rec x" + x1 + " y" + y1
+ " is activated");
}
activity.input.add(active[x1][y1]);
}
}
activity.input.add(false); // not shifted

activity.current_round++;
activity.tvRound.setText(activity
.getString(R.string.label_round)
+""
+ activity.current_round);

// show next image


int idx = activity.getImageIndex();
activity.changeBackground(idx);
break;
}
case TouchListener.MSG_SHIFT_ROUND_FINISHED: {

Page | 101
ICCT COLLEGES FOUNDATION INCORPORATED

Vibrator v = (Vibrator) activity

.getSystemService(Context.VIBRATOR_SERVICE);

// 1. Vibrate for 300 milliseconds


long milliseconds = 300;
v.vibrate(milliseconds);

activity.tvRound.setText(activity
.getString(R.string.label_round)
+""
+ activity.current_round + " -Shift-");
activity.longpress = true;

boolean[][] shifted = (boolean[][]) msg.obj;

for (int y1 = 0; y1 < 4; y1++) {


for (int x1 = 0; x1 < 2; x1++) {
if (shifted[x1][y1] == true) {
Log.i(LOG_TAG, "Rec x" + x1 + " y" + y1
+ " was shifted");

}
activity.input.add(shifted[x1][y1]);
}
}
activity.input.add(true); // shifted true

// show next image


int idx = activity.getImageIndex();
activity.changeBackground(idx);

break;
}
}
activity.checkIfFinished();
}

}
}

M I B AS e t t i n g s Ac t i vi t y. c s
package de.uulm.graphicalpasswords.openmiba;

import android.annotation.TargetApi;

Page | 102
ICCT COLLEGES FOUNDATION INCORPORATED

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.view.MenuItem;
import android.support.v4.app.NavUtils;

import java.util.List;

import de.uulm.graphicalpasswords.R;
import de.uulm.graphicalpasswords.opentapi.TAPIActivity;

/**
* A {@link PreferenceActivity} that presents a set of application settings. On
* handset devices, settings are presented as a single list. On tablets,
* settings are split by category, with category headers shown to the left of
* the list of settings.
* <p>
* See <a href="http://developer.android.com/design/patterns/settings.html">
* Android Design: Settings</a> for design guidelines and the <a
* href="http://developer.android.com/guide/topics/ui/settings.html">Settings
* API Guide</a> for more information on developing a Settings UI.
*/
public class MIBASettingsActivity extends PreferenceActivity implements
OnSharedPreferenceChangeListener {
/**
* Determines whether to always show the simplified settings UI, where
* settings are presented in a single list. When false, settings are shown
* as a master/detail two-pane view on tablets. When true, a single pane is
* shown on tablets.
*/
private static final boolean ALWAYS_SIMPLE_PREFS = true;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupActionBar();
}

/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}

Page | 103
ICCT COLLEGES FOUNDATION INCORPORATED

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
// TODO: If Settings has multiple levels, Up should navigate
up
// that hierarchy.
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);

setupSimplePreferencesScreen();
}

/**
* Shows the simplified settings UI if the device configuration if the
* device configuration dictates that a simplified, single-pane UI should
be
* shown.
*/
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}

// In the simplified UI, fragments are not used at all and we


instead
// use the older PreferenceActivity APIs.

// Add preferences.
addPreferencesFromResource(R.xml.pref_miba);

// Bind the summaries of EditText/List/Dialog/Ringtone preferences


to
// their values. When their values change, their summaries are
updated
// to reflect the new value, per the Android Design guidelines.

Page | 104
ICCT COLLEGES FOUNDATION INCORPORATED

bindPreferenceSummaryToValue(findPreference("miba_length"));
}

/** {@inheritDoc} */
@Override
public boolean onIsMultiPane() {
return isXLargeTablet(this) && !isSimplePreferences(this);
}

/**
* Helper method to determine if the device has an extra-large screen. For
* example, 10" tablets are extra-large.
*/
private static boolean isXLargeTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}

/**
* Determines whether the simplified settings UI should be shown. This is
* true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device
* doesn't have newer APIs like {@link PreferenceFragment}, or the device
* doesn't have an extra-large screen. In these cases, a single-pane
* "simplified" settings UI should be shown.
*/
private static boolean isSimplePreferences(Context context) {
return ALWAYS_SIMPLE_PREFS
|| Build.VERSION.SDK_INT <
Build.VERSION_CODES.HONEYCOMB
|| !isXLargeTablet(context);
}

/** {@inheritDoc} */
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onBuildHeaders(List<Header> target) {
if (!isSimplePreferences(this)) {
loadHeadersFromResource(R.xml.pref_headers, target);
}
}

/**
* A preference value change listener that updates the preference's summary
* to reflect its new value.
*/
private static Preference.OnPreferenceChangeListener
sBindPreferenceSummaryToValueListener = new
Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object
value) {
String stringValue = value.toString();

if (preference instanceof ListPreference) {

Page | 105
ICCT COLLEGES FOUNDATION INCORPORATED

// For list preferences, look up the correct display


value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference)
preference;
int index =
listPreference.findIndexOfValue(stringValue);

// Set the summary to reflect the new value.


preference
.setSummary(index >= 0 ?
listPreference.getEntries()[index]
: null);
} else {
// For all other preferences, set the summary to the
value's
// simple string representation.
preference.setSummary(stringValue);
}
return true;
}
};

/**
* Binds a preference's summary to its value. More specifically, when the
* preference's value is changed, its summary (line of text below the
* preference title) is updated to reflect the value. The summary is also
* immediately updated upon calling this method. The exact display format
is
* dependent on the type of preference.
*
* @see #sBindPreferenceSummaryToValueListener
*/
private static void bindPreferenceSummaryToValue(Preference preference) {
// Set the listener to watch for value changes.
preference

.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);

// Trigger the listener immediately with the preference's


// current value.
sBindPreferenceSummaryToValueListener.onPreferenceChange(
preference,
PreferenceManager.getDefaultSharedPreferences(

preference.getContext()).getString(preference.getKey(),
""));
}

@Override
protected void onResume() {
super.onResume();
PreferenceManager.getDefaultSharedPreferences(this)
.registerOnSharedPreferenceChangeListener(this);
}

Page | 106
ICCT COLLEGES FOUNDATION INCORPORATED

@Override
protected void onPause() {
super.onPause();
PreferenceManager.getDefaultSharedPreferences(this)
.unregisterOnSharedPreferenceChangeListener(this);

@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if (key.equals("miba_length")) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.remove("miba_pw");
editor.commit();
}
}
}

TouchListener.cs
package de.uulm.graphicalpasswords.openmiba;

import java.util.ArrayList;
import java.util.List;

import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.LinearLayout;

public class TouchListener implements OnTouchListener {

public static final int MSG_ROUND_FINISHED = 1;


public static final int MSG_SHIFT_ROUND_FINISHED = 2;
public static final int MSG_START_ROUND = 3;

private static Handler handler;


private boolean secclick = false;

boolean isArrayEqual(boolean[][] a, boolean[][] b) {


boolean equal = true;
for (int y1 = 0; y1 < 4; y1++) {
for (int x1 = 0; x1 < 2; x1++) {
if (a[x1][y1] != b[x1][y1]) {
equal = false;
}
}
}
return equal;
}

Page | 107
ICCT COLLEGES FOUNDATION INCORPORATED

void initArray(boolean[][] a, boolean init) {

for (int y1 = 0; y1 < 4; y1++) {


for (int x1 = 0; x1 < 2; x1++) {
a[x1][y1] = init;
}
}

void initArray(int[][] a, int init) {

for (int y1 = 0; y1 < 4; y1++) {


for (int x1 = 0; x1 < 2; x1++) {
a[x1][y1] = init;
}
}

boolean[][] copyArray(boolean[][] a) {

boolean[][] res = new boolean[2][4];

for (int y1 = 0; y1 < 4; y1++) {


for (int x1 = 0; x1 < 2; x1++) {
res[x1][y1] = a[x1][y1];
}
}
return res;

private Thread shiftchecker;

class ShiftCheckerThread extends Thread {

private boolean[][] laststate = new boolean[2][4];

@Override
public void run() {

while (!cancel_shift) {
Log.i(LOG_TAG, "i m thread checker " + getName());
if (isArrayEqual(laststate, active_recs) &&
!cancel_shift) {
Log.i(LOG_TAG, "thread: arrays are equal " +
getName());
Message msg = Message.obtain();
msg.what = MSG_SHIFT_ROUND_FINISHED;
msg.obj = copyArray(active_recs);
handler.sendMessage(msg);
longpress = true;
return;

Page | 108
ICCT COLLEGES FOUNDATION INCORPORATED

} else {
if (cancel_shift)
return;

laststate = copyArray(active_recs);

try {
Thread.sleep(750);
} catch (InterruptedException e) {
Log.i(LOG_TAG, "i got interupted from
sleep "
+ getName());
}

}
Log.i(LOG_TAG, "thread stopped " + getName());

private static String LOG_TAG = "TouchListener";


private final LinearLayout[][] linlGrid;
private final int width;
private final int height;

// active rectangles
boolean[][] active_recs = { { false, false, false, false },
{ false, false, false, false } };

boolean[][] up_recs = { { false, false, false, false },


{ false, false, false, false } };
boolean[][] secdown_recs = { { false, false, false, false },
{ false, false, false, false } };

int[][] activatedbypointerid = { { -1, -1, -1, -1 }, { -1, -1, -1, -1 } };

private List<Boolean> isshifted = new ArrayList<Boolean>();

private boolean longpress = false;


private boolean cancel_shift = false;

public TouchListener(LinearLayout[][] linlGrid, int width, int heigth,


Handler hndl) {
this.linlGrid = linlGrid;
this.width = width;
this.height = heigth;
handler = hndl;
}

private int[] getRectangle(float x, float y) {


int[] coords = new int[2];

Page | 109
ICCT COLLEGES FOUNDATION INCORPORATED

coords[0] = (int) x / (width / 2);


coords[1] = (int) y / (height / 4);
return coords;
}

void printSamples(MotionEvent ev) {


final int historySize = ev.getHistorySize();
final int pointerCount = ev.getPointerCount();
for (int h = 0; h < historySize; h++) {
System.out.printf("At time %d:",
ev.getHistoricalEventTime(h));
for (int p = 0; p < pointerCount; p++) {
System.out.printf(" pointer %d: (%f,%f)",
ev.getPointerId(p),
ev.getHistoricalX(p, h),
ev.getHistoricalY(p, h));
}
}
System.out.printf("At time %d:", ev.getEventTime());
for (int p = 0; p < pointerCount; p++) {
System.out.printf(" pointer %d: (%f,%f)", ev.getPointerId(p),
ev.getX(p), ev.getY(p));
}
}

/**
* If user hits the back button in LoginActivity, make sure longpress is
* available again or not. It's not allowed that two shifts are coming
* directly in a row long long short is not allowed
*
* @return true if second last was shifted
*/
public boolean reset() {
// erst ein element in der liste
if (isshifted.size() <= 1) {
secclick = false;
isshifted.clear();
return false;
}

boolean vorletzter = isshifted.get(isshifted.size() - 2);


boolean letzter = isshifted.get(isshifted.size() - 1);

// vorletzter klick war ein shift


if (vorletzter) {
secclick = true; // kein weiteren shift erlauben
}
// wenn der letzte klick ein shift war
if (letzter) {
secclick = false; // erlaube wieder ein shift
}

// letzten l�schen
isshifted.remove(isshifted.size() - 1);

Page | 110
ICCT COLLEGES FOUNDATION INCORPORATED

return vorletzter;
}

public boolean getLastState() {


if (isshifted.size() == 0)
return false;
boolean shift = isshifted.get(isshifted.size() - 1);
for (int i = 0; i < isshifted.size(); i++) {
Log.d(LOG_TAG, "" + isshifted.get(i));
}
if (shift) {
return true;
}
return false;
}

@Override
public boolean onTouch(View v, MotionEvent event) {
// if (event.getAction() == MotionEvent.ACTION_MOVE) return true;
int action = event.getAction() & MotionEvent.ACTION_MASK;

int ptrIdx = event.getActionIndex();


int ptrId = event.getPointerId(ptrIdx);

if (action == MotionEvent.ACTION_DOWN) { // primary pointer has gone

// down
// Log.i(LOG_TAG, "First Down: PtrId: "+ ptrId + " PtrIdx: " +
// ptrIdx);

setRectangleStateMoving(event.getX(0), event.getY(0), true, 0,


false);

longpress = false;
cancel_shift = false;
Log.i(LOG_TAG, "frist pointer down: shift enabled");

Message msg = Message.obtain();


msg.what = MSG_START_ROUND;
handler.sendMessage(msg);

// start thread only after first click


if (!secclick) {

// thread is no longer alive. it got interrupted by


last finger
// up and thus terminated
if (shiftchecker != null && shiftchecker.isAlive()) {

} else {
// thus always is created a new checker thread
shiftchecker = new ShiftCheckerThread();
shiftchecker.start();
}

Page | 111
ICCT COLLEGES FOUNDATION INCORPORATED

} else {

// doubleClick(event, 0);

} else if (action == MotionEvent.ACTION_UP) { // primary pointer has

// gone up

// Log.i(LOG_TAG, "Last UP PtrId: "+ ptrId + " PtrIdx: " +


ptrIdx +
// " " + event.getPointerCount());// describeEvent(event));

setRectangleStateMoving(event.getX(0), event.getY(0), false,


ptrId,
false);

// normal click
if (!longpress || secclick) {
Log.i(LOG_TAG, "last pointer up: shift canceled");
cancel_shift = true;

// wake up thread from sleeping => now it reaches the


cancel
// condition
shiftchecker.interrupt();

Message msg = Message.obtain();


msg.what = MSG_ROUND_FINISHED;
msg.obj = copyArray(active_recs);
handler.sendMessage(msg);
secclick = false;
isshifted.add(false);
}
// long click
else if (longpress) {
secclick = true; // do not allow a subsequent long
click
isshifted.add(true);
}

initArray(active_recs, false);

} else if (action == MotionEvent.ACTION_MOVE) { // none primary


pointer

// goes down

/*
* ptrIdx = (event.getAction() &
* MotionEvent.ACTION_POINTER_INDEX_MASK) >>
* MotionEvent.ACTION_POINTER_INDEX_SHIFT;
*/
// ptrId = event.getPointerId(ptrIdx);

Page | 112
ICCT COLLEGES FOUNDATION INCORPORATED

// int ptrIdx = event.getActionIndex();


// int ptrId = event.getAction() >>
// MotionEvent.ACTION_POINTER_ID_SHIFT;
/*
* int ptrId = (event.getAction() &
* MotionEvent.ACTION_POINTER_INDEX_MASK) >>>
* MotionEvent.ACTION_POINTER_ID_SHIFT;
*/

final int pointerCount = event.getPointerCount();


for (ptrIdx = 0; ptrIdx < pointerCount; ptrIdx++) {
ptrId = event.getPointerId(ptrIdx);
// Log.i(LOG_TAG, "Move PtrId: "+ ptrId + " PtrIdx: " +
ptrIdx);

setRectangleStateMoving(event.getX(ptrIdx),
event.getY(ptrIdx),
true, ptrId, true);

}
} else if (action == MotionEvent.ACTION_POINTER_DOWN) { // none
primary

// pointer goes

// down

// Log.i(LOG_TAG, "Further Down PtrId: "+ ptrId + " PtrIdx: "


+
// ptrIdx);// describeEvent(event));
setRectangleStateMoving(event.getX(ptrIdx),
event.getY(ptrIdx),
true, ptrId, false);

// doubleClick(event, ptrIdx);
} else if (action == MotionEvent.ACTION_POINTER_UP) { // none
primary

// pointer goes

// down
// Log.i(LOG_TAG, "Further UP PtrId: "+ ptrId + " PtrIdx: " +
// ptrIdx);// describeEvent(event));
// switchOffOldActivation(ptrId);
setRectangleStateMoving(event.getX(ptrIdx),
event.getY(ptrIdx),
false, ptrId, false);
}

return true;
}

private void setRectangleStateMoving(float x, float y, boolean active,


int ptrID, boolean moving) {
Log.d("coords", "" + x + " " + y);

Page | 113
ICCT COLLEGES FOUNDATION INCORPORATED

int[] coords = getRectangle(x, y);


// Log.i(LOG_TAG, coords[0] + " " + coords[1]);

Log.d("coords", "" + coords[0] + " " + coords[1]);


// pointer within same rectangle => do nothing
if (activatedbypointerid[coords[0]][coords[1]] == ptrID && moving) {
return;
}

// deactivate or it is a moving event that points at a new rect


// => deactivate old one
if ((activatedbypointerid[coords[0]][coords[1]] != ptrID && moving)
|| active == false) {
// Log.i(LOG_TAG, "Moved to new Rectangle");
// search old field
for (int y1 = 0; y1 < 4; y1++) {
for (int x1 = 0; x1 < 2; x1++) {
if (activatedbypointerid[x1][y1] == ptrID) {
// deactivate old rectangle

linlGrid[x1][y1].setVisibility(View.VISIBLE);
if (moving) {
activatedbypointerid[x1][y1] = -1;
active_recs[x1][y1] = false;
}

}
}
}
}

if (active) {
/*
* //make it darker float[] hsv = new float[3];
* Color.colorToHSV(color, hsv); hsv[2] *= 0.8f; color =
* Color.WHITE; //Color.HSVToColor(hsv);
*/
// Log.v(LOG_TAG, "Rectangle x" + coords[0] + " y" +
coords[1]);

active_recs[coords[0]][coords[1]] = true;
activatedbypointerid[coords[0]][coords[1]] = ptrID;
linlGrid[coords[0]][coords[1]].setVisibility(View.INVISIBLE);

}
}

public String describeEvent(MotionEvent event) {


StringBuilder result = new StringBuilder(500);
result.append("Action: ").append(event.getAction()).append("\n");
int numPointers = event.getPointerCount();
result.append("Number of pointer:
").append(numPointers).append("\n");
int ptrIdx = 0;
while (ptrIdx < numPointers) {

Page | 114
ICCT COLLEGES FOUNDATION INCORPORATED

int ptrId = event.getPointerId(ptrIdx);


result.append("Pointer Index: ").append(ptrIdx);
result.append(", Pointer Id: ").append(ptrId).append("\n");
result.append(" Location:
").append("x").append(event.getX(ptrIdx));
result.append("y").append(event.getY(ptrIdx)).append("\n");
ptrIdx++;
}
result.append("Downtime:
").append(event.getDownTime()).append("ms\n");
result.append("Event time:
").append(event.getEventTime()).append("ms");
result.append(" Elapsed: ").append(
event.getEventTime() - event.getDownTime());
result.append("ms\n");
Log.i(LOG_TAG, result.toString());
return result.toString();
}

MIBALoginActivity.cs
package de.uulm.graphicalpasswords.openmiba;

import java.lang.ref.WeakReference;
import java.util.ArrayList;

import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.DialogInterface.OnClickListener;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.Display;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Surface;
import android.view.View;
import android.view.ViewTreeObserver;

Page | 115
ICCT COLLEGES FOUNDATION INCORPORATED

import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TextView;
import android.support.v4.app.NavUtils;

public class MIBALoginActivity extends Activity {

private String password;

// amount of booleans of one entry


// one for each rectangle and one for shift
public final static int INPUTLENGTH = 9;

private TableLayout tableLayout;


// private LinearLayout linlBottom;
private LinearLayout linlGrid[][];
private Button btnBack;
private TextView tvRound;

private static String LOG_TAG = "LoginActivity";


private int width;
private int height;
private TouchListener touchlistener;

int[][] colors_off = { { 0x3C000000, 0x3C000000, 0x3C000000, 0x3C000000 },


{ 0x3C000000, 0x3C000000, 0x3C000000, 0x3C000000 } };

boolean firsttime = false;


public int min_rounds = 2;
public int current_round = 1;
public int rounds_to_do = 2;

private boolean longpress = false;

private ArrayList<Boolean> input = new ArrayList<Boolean>();


private ImageIndexTable imgidxtable = new ImageIndexTable();

private Handler handler = new MIBALoginHandler(


new WeakReference<MIBALoginActivity>(this));

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

// requestWindowFeature(Window.FEATURE_NO_TITLE);
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
// WindowManager.LayoutParams.FLAG_FULLSCREEN);

setContentView(R.layout.activity_miba_login);

// Show the Up button in the action bar.


setupActionBar();

Page | 116
ICCT COLLEGES FOUNDATION INCORPORATED

SharedPreferences sharedPref = PreferenceManager


.getDefaultSharedPreferences(this);
rounds_to_do = Integer.parseInt(sharedPref
.getString("miba_length", "1"));
min_rounds = rounds_to_do;
password = sharedPref.getString("miba_pw", "");

setViews();
}

/**
* Set up the {@link android.app.ActionBar}.
*/
private void setupActionBar() {

getActionBar().setDisplayHomeAsUpEnabled(true);

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.miba_login, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

private void setViews() {


tableLayout = (TableLayout) findViewById(R.id.tableLayout);
btnBack = (Button) findViewById(R.id.miba_btnBack);
btnBack.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
back();
}

Page | 117
ICCT COLLEGES FOUNDATION INCORPORATED

});

tvRound = (TextView) this.findViewById(R.id.tvRound);


tvRound.setText(getString(R.string.label_round) + " 1");

linlGrid = new LinearLayout[2][4];


linlGrid[0][0] = (LinearLayout) this.findViewById(R.id.square1);
linlGrid[1][0] = (LinearLayout) this.findViewById(R.id.square2);
linlGrid[0][1] = (LinearLayout) this.findViewById(R.id.square3);
linlGrid[1][1] = (LinearLayout) this.findViewById(R.id.square4);
linlGrid[0][2] = (LinearLayout) this.findViewById(R.id.square5);
linlGrid[1][2] = (LinearLayout) this.findViewById(R.id.square6);
linlGrid[0][3] = (LinearLayout) this.findViewById(R.id.square7);
linlGrid[1][3] = (LinearLayout) this.findViewById(R.id.square8);

for (int y = 0; y < 4; y++) {


for (int x = 0; x < 2; x++) {
linlGrid[x][y].setBackgroundColor(colors_off[x][y]);
}

// get width and height from mainpanel


// can not use display width/height because of notification bar
ViewTreeObserver vto = tableLayout.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {

// get values of portrait mode

Display display =
getWindowManager().getDefaultDisplay();

if (display.getRotation() == Surface.ROTATION_0) {
width = tableLayout.getWidth();
height = tableLayout.getHeight();
} else {
height = tableLayout.getWidth();
width = tableLayout.getHeight();
}

Bitmap bmp =
BitmapFactory.decodeResource(getResources(),
R.drawable.ccp000);
bmp = Bitmap.createScaledBitmap(bmp, width, height,
true);
Drawable d = new BitmapDrawable(getResources(), bmp);
bmp = null; // prevent outofmemor
tableLayout.setBackgroundDrawable(d);

touchlistener = new TouchListener(linlGrid, width,


height,
handler);
tableLayout.setOnTouchListener(touchlistener);

Page | 118
ICCT COLLEGES FOUNDATION INCORPORATED

// remove listener again otherwise it gets called twice

tableLayout.getViewTreeObserver().removeGlobalOnLayoutListener(
this);
}
});
}

private void back() {


// last state
boolean isshift = touchlistener.getLastState();

// not two long presses in sequence


// remove last state and return the state of the last but one state
boolean vorletztzerisshift = touchlistener.reset();

// adapt round count


if (!isshift) { // normal click
if (current_round > 1)
current_round--;
if (vorletztzerisshift) { // back to shift screen
tvRound.setText(getString(R.string.label_round) + " "
+ current_round + " -Shift-");
} else { // decrease round
tvRound.setText(getString(R.string.label_round) + " "
+ current_round);
}

} else { // shift -> do not decrease round, show current round


tvRound.setText(getString(R.string.label_round) + " "
+ current_round);
}

if (input.size() >= INPUTLENGTH)


// input: 8 rectangles + 1 shift enabled flag
for (int i = 0; i < INPUTLENGTH; i++) {
input.remove(input.size() - 1);
}

// enable last index


// if user inserts the same gesture -> show same picture again
imgidxtable.removeLastIndex();

// ... and show previous background image


int idx = getImageIndex();
changeBackground(idx);
}

/**
* Returns the index of the next background image depending on the previous
* user input
*
* @return
*/
public int getImageIndex() {

Page | 119
ICCT COLLEGES FOUNDATION INCORPORATED

if (input.size() < INPUTLENGTH)


return -1;

int res = 0;

for (int i = 0; i < INPUTLENGTH; i++) {


boolean a = input.get(input.size() - INPUTLENGTH + i); //
least

// significant

// bit

// first
res = res << 1;
res = res + boolToInt(a);
}
res = imgidxtable.getIndex(res);
Log.i(LOG_TAG, "this entry lead to imageindex " + res);
return res;
}

public void changeBackground(int imageindex) {


int img = 0;
if (imageindex == -1) {
img = R.drawable.ccp000;
} else
img = R.drawable.ccp001 + imageindex;

Bitmap bmp = BitmapFactory.decodeResource(getResources(), img);


bmp = Bitmap.createScaledBitmap(bmp, width, height, true);

Drawable d = new BitmapDrawable(getResources(), bmp);


bmp = null; // prevent outofmemory
tableLayout.setBackgroundDrawable(d);

public int boolToInt(boolean b) {


if (b)
return 1;
return 0;
}

public void checkIfFinished() {


if (current_round == min_rounds + 1) {
tableLayout.setOnClickListener(null);

DialogFragment dialog;
if (buildPasswordString().equals(password)) {
dialog = new ResultOKDialog();
} else {
dialog = new WrongResultDialog();
}
dialog.show(getFragmentManager(), "result");

Page | 120
ICCT COLLEGES FOUNDATION INCORPORATED

}
}

/**
* Transforms the user input to a passwordstring. This string may contain
* unprintable ASCII Codes.
*
* @return
*/
public String buildPasswordString() {
String res = "";

for (int i = 0; i < input.size(); i++) {


if (input.get(i)) {
res += "1";
} else {
res += "0";
}

}
return res;
}

public static class ResultOKDialog extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
builder.setMessage(R.string.msg_pw_correct).setNeutralButton(
R.string.btn_ok, new OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int id) {
dialog.dismiss();
getActivity().finish();
}
});
return builder.create();
}
}

public static class WrongResultDialog extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
builder.setMessage(R.string.msg_pw_wrong).setNeutralButton(
R.string.btn_ok, new OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int id) {

Page | 121
ICCT COLLEGES FOUNDATION INCORPORATED

dialog.dismiss();
getActivity().finish();
}
});
return builder.create();
}
}

private static class MIBALoginHandler extends Handler {


MIBALoginActivity activity;

private MIBALoginHandler(WeakReference<MIBALoginActivity> instance)


{
activity = instance.get();
}

@Override
public void handleMessage(Message msg) {

switch (msg.what) {
case TouchListener.MSG_ROUND_FINISHED: {
activity.longpress = false;

boolean[][] active = (boolean[][]) msg.obj;


for (int y1 = 0; y1 < 4; y1++) {
for (int x1 = 0; x1 < 2; x1++) {
if (active[x1][y1] == true) {
Log.i(LOG_TAG, "Rec x" + x1 + " y"
+ y1
+ " is activated");
}
activity.input.add(active[x1][y1]);
}
}
activity.input.add(false); // not shifted

activity.current_round++;
activity.tvRound.setText(activity
.getString(R.string.label_round)
+ " "
+ activity.current_round);

// show next image


int idx = activity.getImageIndex();
activity.changeBackground(idx);

activity.checkIfFinished();
break;
}
case TouchListener.MSG_SHIFT_ROUND_FINISHED: {
Vibrator v = (Vibrator) activity

.getSystemService(Context.VIBRATOR_SERVICE);

// 1. Vibrate for 300 milliseconds

Page | 122
ICCT COLLEGES FOUNDATION INCORPORATED

long milliseconds = 300;


v.vibrate(milliseconds);

activity.tvRound.setText(activity
.getString(R.string.label_round)
+ " "
+ activity.current_round + " -Shift-");
activity.longpress = true;

boolean[][] shifted = (boolean[][]) msg.obj;

for (int y1 = 0; y1 < 4; y1++) {


for (int x1 = 0; x1 < 2; x1++) {
if (shifted[x1][y1] == true) {
Log.i(LOG_TAG, "Rec x" + x1 + " y"
+ y1
+ " was shifted");

}
activity.input.add(shifted[x1][y1]);
}
}
activity.input.add(true); // shifted true

// show next image


int idx = activity.getImageIndex();
activity.changeBackground(idx);
activity.checkIfFinished();
break;
}
}

}
}
}

Check this location:


C:\Users\Chad\Downloads\FORQPassword\Source\src\de\uulm\graphicalpa
sswords\openpassgo

Coordinates.cs

Page | 123
ICCT COLLEGES FOUNDATION INCORPORATED

package de.uulm.graphicalpasswords.openpassgo;

import android.os.Parcel;
import android.os.Parcelable;

public class Coordinates implements Parcelable {


private int x;
private int y;

/*
* This field is needed for Android to be able to create new objects,
* individually or as arrays.
*/
@SuppressWarnings("rawtypes")
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
public Coordinates createFromParcel(Parcel in) {
return new Coordinates(in);
}

public Coordinates[] newArray(int size) {


return new Coordinates[size];
}
};

public Coordinates(int x, int y) {


this.x = x;
this.y = y;
}

public Coordinates(Parcel in) {


this.x = in.readInt();
this.y = in.readInt();
}

@Override
public void writeToParcel(Parcel parcel, int arg1) {
parcel.writeInt(x);
parcel.writeInt(y);
}

@Override
public int describeContents() {
return 0;
}

public int getX() {


return x;
}

public int getY() {


return y;
}

@Override
public String toString() {

Page | 124
ICCT COLLEGES FOUNDATION INCORPORATED

return "("+x+"|"+y+")";
}

@Override
public boolean equals(Object o) {
if(o.getClass().equals(Coordinates.class)){
return ((Coordinates) o).getX() == x && ((Coordinates)
o).getY() == y;
}
return false;
}
}

DialogPatternView.cs
package de.uulm.graphicalpasswords.openpassgo;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Paint.Cap;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;

public class DialogPatternView extends View {

Paint paint = new Paint();


Rect rect = new Rect();

private final int COUNT_CELLS = 4;

private Path fixedPath = new Path();


private Path tmpPath = new Path();
private Path dotPath = new Path();
private Path tmpDotPath = new Path();

private float d;
private int offset;

private int originalWidth = 0;


private int originalHeight = 0;
private boolean resized = false;

public DialogPatternView(Context context, AttributeSet attrs, int defStyle)


{
super(context, attrs, defStyle);
}

public DialogPatternView(Context context, AttributeSet attrs) {

Page | 125
ICCT COLLEGES FOUNDATION INCORPORATED

super(context, attrs);
}

public DialogPatternView(Context context) {


super(context);
}

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);

// white background
canvas.getClipBounds(rect);
offset = rect.height() - rect.width();
offset = offset / 2;

paint.setColor(Color.WHITE);
paint.setStyle(Style.FILL);
canvas.drawRect(rect.left, rect.top + offset, rect.right,
rect.bottom
- offset, paint);

// column width
d = rect.width() * 1f / COUNT_CELLS;

// areas
paint.setColor(Color.LTGRAY);
paint.setStyle(Style.FILL);

for (int i = 0; i < COUNT_CELLS; i++) {


if (i == 2 || i == 5) {
canvas.drawRect(rect.left + 1 * d, rect.top + offset +
i * d,
rect.left + 3 * d, rect.top + offset + (i
+ 1) * d,
paint);

} else {
canvas.drawRect(rect.left, rect.top + offset + i * d,
rect.left
+ 1 * d, rect.top + offset + (i + 1) * d,
paint);
canvas.drawRect(rect.left + 3 * d, rect.top + offset +
i * d,
rect.left + 4 * d, rect.top + offset + (i
+ 1) * d,
paint);
}
}

// Black grid
paint.setColor(Color.BLACK);
paint.setStyle(Style.STROKE);

for (int i = 0; i < COUNT_CELLS + 1; i++) {

Page | 126
ICCT COLLEGES FOUNDATION INCORPORATED

canvas.drawLine(rect.left, rect.top + offset + i * d,


rect.right,
rect.top + offset + i * d, paint);
canvas.drawLine(rect.left + i * d, rect.top + offset,
rect.left + i
* d, rect.bottom - offset, paint);
}

// Stars
paint.setStyle(Style.FILL);
int starsize = 4;
canvas.drawRect(rect.left + 2 * d - starsize, rect.top + offset + 2
* d
- starsize, rect.left + 2 * d + starsize, rect.top +
offset + 2
* d + starsize, paint);
canvas.drawRect(rect.left + 6 * d - starsize, rect.top + offset + 2
* d
- starsize, rect.left + 6 * d + starsize, rect.top +
offset + 2
* d + starsize, paint);
canvas.drawRect(rect.left + 2 * d - starsize, rect.top + offset + 6
* d
- starsize, rect.left + 2 * d + starsize, rect.top +
offset + 6
* d + starsize, paint);
canvas.drawRect(rect.left + 6 * d - starsize, rect.top + offset + 6
* d
- starsize, rect.left + 6 * d + starsize, rect.top +
offset + 6
* d + starsize, paint);
canvas.drawRect(rect.left + 4 * d - starsize, rect.top + offset + 4
* d
- starsize, rect.left + 4 * d + starsize, rect.top +
offset + 4
* d + starsize, paint);

// Scale Path
if (originalWidth > 0 && originalHeight > 0 && !resized) {
float faktor = (COUNT_CELLS * d) / originalWidth;
float topoffset = (originalHeight * faktor - rect.height()) /
2;

Matrix matrix = new Matrix();


matrix.setScale(faktor, faktor);
matrix.postTranslate(0, topoffset * -1f);
fixedPath.transform(matrix);
dotPath.transform(matrix);

resized = true;
}

// fixedPath
paint.setColor(Color.RED);
paint.setStyle(Style.STROKE);

Page | 127
ICCT COLLEGES FOUNDATION INCORPORATED

paint.setStrokeCap(Cap.ROUND);
paint.setStrokeWidth(3);
canvas.drawPath(fixedPath, paint);

// tmpPath
canvas.drawPath(tmpPath, paint);

// DotPath
paint.setStyle(Style.FILL);
canvas.drawPath(dotPath, paint);

// tmpDotPath
canvas.drawPath(tmpDotPath, paint);

public void setFixedPath(Path fixedPath) {


this.fixedPath = fixedPath;
}

public void setDotPath(Path dotPath) {


this.dotPath = dotPath;
}

public void setOriginalDimensions(int width, int height) {


originalWidth = width;
originalHeight = height;
}
}

PassGo.cs
package de.uulm.graphicalpasswords.openpassgo;

public interface PassGo {


public void setReady(boolean ready);
}

PassGoActivity.cs
package de.uulm.graphicalpasswords.openpassgo;

import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.support.v4.app.NavUtils;
import android.annotation.TargetApi;

Page | 128
ICCT COLLEGES FOUNDATION INCORPORATED

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.preference.PreferenceManager;

public class PassGoActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pass_go);
// Show the Up button in the action bar.
setupActionBar();
}

@Override
protected void onResume() {
super.onResume();
Button login = (Button) findViewById(R.id.btn_login);
SharedPreferences sharedPref = PreferenceManager
.getDefaultSharedPreferences(this);
if (sharedPref.getString("passgo_pw", "").equals(""))
login.setEnabled(false);
else
login.setEnabled(true);
}

/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.pass_go, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:

Page | 129
ICCT COLLEGES FOUNDATION INCORPORATED

//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
case R.id.action_settings:
Intent intent = new Intent(
this,

de.uulm.graphicalpasswords.openpassgo.PassGoSettingsActivity.class);
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}

public void startCreatePassword(View view) {


Intent intent = new Intent(
this,

de.uulm.graphicalpasswords.openpassgo.PassGoCreatePasswordActivity.class);
startActivity(intent);
}

public void startEnterPassword(View view) {


Intent intent = new Intent(this,

de.uulm.graphicalpasswords.openpassgo.PassGoLoginActivity.class);
startActivity(intent);
}
}
PassGoCreatePasswordActivity.cs
package de.uulm.graphicalpasswords.openpassgo;

import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.support.v4.app.NavUtils;
import android.annotation.TargetApi;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.SharedPreferences;
import android.os.Build;
import android.preference.PreferenceManager;

Page | 130
ICCT COLLEGES FOUNDATION INCORPORATED

public class PassGoCreatePasswordActivity extends Activity implements PassGo {

private PatternView patternView;


private Button save;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pass_go_create_password);

SharedPreferences sharedPref = PreferenceManager


.getDefaultSharedPreferences(this);
int length = Integer.parseInt(sharedPref
.getString("passgo_length", "6"));

patternView = (PatternView) findViewById(R.id.passgo_patternview);


patternView.setActivity((PassGo) this);
patternView.setLength(length);

save = (Button) findViewById(R.id.passgo_save);


setReady(false);

Bundle bundle = new Bundle();


bundle.putInt("length", length);
DialogFragment intro = new IntroDialogFragment();
intro.setArguments(bundle);
intro.show(getFragmentManager(), "intro");

// Show the Up button in the action bar.


setupActionBar();
}

/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.pass_go_create_password, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:

Page | 131
ICCT COLLEGES FOUNDATION INCORPORATED

// This ID represents the Home or Up button. In the case of


this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

public void clearAll(View view) {


DialogFragment dialog = new DeletePatternDialogFragment();
dialog.show(getFragmentManager(), "delete");
}

public void clearAll() {


patternView.clear();
}

public void submit(View view) {


SharedPreferences sharedPref = PreferenceManager
.getDefaultSharedPreferences(this);
SharedPreferences.Editor edit = sharedPref.edit();
edit.putString("passgo_pw", patternView.getInput().toString());
edit.commit();

DialogFragment dialog = new RememberPasswordDialogFragment();


dialog.show(getFragmentManager(), "remember");
}

public static class IntroDialogFragment extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
String message = getString(
R.string.msg_dialog_pass_go_createpw,
getArguments().getInt("length"));
builder.setTitle(R.string.title_dialog_pass_go_createpw)
.setMessage(message)
.setNeutralButton(R.string.btn_ok, new
OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int which) {
dialog.dismiss();
}

Page | 132
ICCT COLLEGES FOUNDATION INCORPORATED

});
return builder.create();
}
}

public static class DeletePatternDialogFragment extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
builder.setMessage(
R.string.msg_dialog_pass_go_deletepattern)
.setCancelable(false)
.setPositiveButton(R.string.btn_yes, new
OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int id) {
((PassGoCreatePasswordActivity)
getActivity())
.clearAll();
}
})
.setNegativeButton(R.string.btn_no, new
OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int which) {
dialog.dismiss();
}
});
return builder.create();
}
}

public static class RememberPasswordDialogFragment extends DialogFragment {


@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater layoutInflater = (LayoutInflater) getActivity()
.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = layoutInflater.inflate(
R.layout.passgo_rememberpw_dialog,
(ViewGroup) getActivity().findViewById(
R.id.passgo_rememberpw_layout));

PatternView patternView = ((PassGoCreatePasswordActivity)


getActivity()).patternView;

DialogPatternView patternViewDialog = (DialogPatternView)


layout

.findViewById(R.id.passgo_rememberpw_patternView);

Page | 133
ICCT COLLEGES FOUNDATION INCORPORATED

patternViewDialog.setFixedPath(patternView.getFixedPath());
patternViewDialog.setDotPath(patternView.getDotPath());

patternViewDialog.setOriginalDimensions(patternView.getWidth(),
patternView.getHeight());

AlertDialog.Builder builder = new


AlertDialog.Builder(getActivity());
builder.setView(layout)

.setTitle(R.string.title_dialog_pass_go_rememberpw)
.setPositiveButton(R.string.btn_done,
new OnClickListener() {

@Override
public void
onClick(DialogInterface dialog,
int which) {
dialog.dismiss();

getActivity().finish();
}
});
return builder.create();
}
}

public void setReady(boolean ready) {


save.setClickable(ready);
save.setEnabled(ready);
}

PassGoLoginActivity.cs
package de.uulm.graphicalpasswords.openpassgo;

import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.DialogInterface.OnClickListener;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.support.v4.app.NavUtils;

public class PassGoLoginActivity extends Activity implements PassGo {

Page | 134
ICCT COLLEGES FOUNDATION INCORPORATED

private PatternView patternView;

private String password;


private int length;

private Button save;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pass_go_login);
// Show the Up button in the action bar.
setupActionBar();

SharedPreferences sharedPref = PreferenceManager


.getDefaultSharedPreferences(this);
length = Integer.parseInt(sharedPref.getString("passgo_length",
"6"));
password = sharedPref.getString("passgo_pw", "");

patternView = (PatternView) findViewById(R.id.passgo_patternview);


patternView.setActivity(this);
patternView.setLength(length);

save = (Button) findViewById(R.id.passgo_save);


setReady(false);
}

/**
* Set up the {@link android.app.ActionBar}.
*/
private void setupActionBar() {

getActionBar().setDisplayHomeAsUpEnabled(true);

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.pass_go_login, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:

Page | 135
ICCT COLLEGES FOUNDATION INCORPORATED

//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

public void clearAll(View view) {


patternView.clear();
}

public void submit(View view) {


DialogFragment dialog;
if (password.equals(patternView.getInput().toString())) {
dialog = new ResultOKDialog();
} else {
dialog = new WrongResultDialog();
}
dialog.show(getFragmentManager(), "result");
}

public static class ResultOKDialog extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
builder.setMessage(R.string.msg_pw_correct).setNeutralButton(
R.string.btn_ok, new OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int id) {
dialog.dismiss();
getActivity().finish();
}
});
return builder.create();
}
}

public static class WrongResultDialog extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
builder.setMessage(R.string.msg_pw_wrong).setNeutralButton(
R.string.btn_ok, new OnClickListener() {

@Override

Page | 136
ICCT COLLEGES FOUNDATION INCORPORATED

public void onClick(DialogInterface


dialog, int id) {
dialog.dismiss();
getActivity().finish();
}
});
return builder.create();
}
}

public void setReady(boolean ready) {


save.setClickable(ready);
save.setEnabled(ready);
}
}

PassGoSettingActivity.cs
package de.uulm.graphicalpasswords.openpassgo;

import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.view.MenuItem;
import android.support.v4.app.NavUtils;

import java.util.List;

import de.uulm.graphicalpasswords.R;
import de.uulm.graphicalpasswords.opentapi.TAPIActivity;

/**
* A {@link PreferenceActivity} that presents a set of application settings. On
* handset devices, settings are presented as a single list. On tablets,
* settings are split by category, with category headers shown to the left of
* the list of settings.
* <p>
* See <a href="http://developer.android.com/design/patterns/settings.html">
* Android Design: Settings</a> for design guidelines and the <a
* href="http://developer.android.com/guide/topics/ui/settings.html">Settings
* API Guide</a> for more information on developing a Settings UI.
*/
public class PassGoSettingsActivity extends PreferenceActivity implements
OnSharedPreferenceChangeListener {
/**

Page | 137
ICCT COLLEGES FOUNDATION INCORPORATED

* Determines whether to always show the simplified settings UI, where


* settings are presented in a single list. When false, settings are shown
* as a master/detail two-pane view on tablets. When true, a single pane is
* shown on tablets.
*/
private static final boolean ALWAYS_SIMPLE_PREFS = true;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupActionBar();
}

/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
// TODO: If Settings has multiple levels, Up should navigate
up
// that hierarchy.
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);

setupSimplePreferencesScreen();
}

/**

Page | 138
ICCT COLLEGES FOUNDATION INCORPORATED

* Shows the simplified settings UI if the device configuration if the


* device configuration dictates that a simplified, single-pane UI should
be
* shown.
*/
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}

// In the simplified UI, fragments are not used at all and we


instead
// use the older PreferenceActivity APIs.

// Add preferences.
addPreferencesFromResource(R.xml.pref_passgo);

// Bind the summaries of EditText/List/Dialog/Ringtone preferences


to
// their values. When their values change, their summaries are
updated
// to reflect the new value, per the Android Design guidelines.
bindPreferenceSummaryToValue(findPreference("passgo_length"));
}

/** {@inheritDoc} */
@Override
public boolean onIsMultiPane() {
return isXLargeTablet(this) && !isSimplePreferences(this);
}

/**
* Helper method to determine if the device has an extra-large screen. For
* example, 10" tablets are extra-large.
*/
private static boolean isXLargeTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}

/**
* Determines whether the simplified settings UI should be shown. This is
* true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device
* doesn't have newer APIs like {@link PreferenceFragment}, or the device
* doesn't have an extra-large screen. In these cases, a single-pane
* "simplified" settings UI should be shown.
*/
private static boolean isSimplePreferences(Context context) {
return ALWAYS_SIMPLE_PREFS
|| Build.VERSION.SDK_INT <
Build.VERSION_CODES.HONEYCOMB
|| !isXLargeTablet(context);
}

/** {@inheritDoc} */

Page | 139
ICCT COLLEGES FOUNDATION INCORPORATED

@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onBuildHeaders(List<Header> target) {
if (!isSimplePreferences(this)) {
loadHeadersFromResource(R.xml.pref_headers, target);
}
}

/**
* A preference value change listener that updates the preference's summary
* to reflect its new value.
*/
private static Preference.OnPreferenceChangeListener
sBindPreferenceSummaryToValueListener = new
Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object
value) {
String stringValue = value.toString();

if (preference instanceof ListPreference) {


// For list preferences, look up the correct display
value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference)
preference;
int index =
listPreference.findIndexOfValue(stringValue);

// Set the summary to reflect the new value.


preference
.setSummary(index >= 0 ?
listPreference.getEntries()[index]
: null);
} else {
// For all other preferences, set the summary to the
value's
// simple string representation.
preference.setSummary(stringValue);
}
return true;
}
};

/**
* Binds a preference's summary to its value. More specifically, when the
* preference's value is changed, its summary (line of text below the
* preference title) is updated to reflect the value. The summary is also
* immediately updated upon calling this method. The exact display format
is
* dependent on the type of preference.
*
* @see #sBindPreferenceSummaryToValueListener
*/
private static void bindPreferenceSummaryToValue(Preference preference) {

Page | 140
ICCT COLLEGES FOUNDATION INCORPORATED

// Set the listener to watch for value changes.


preference

.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);

// Trigger the listener immediately with the preference's


// current value.
sBindPreferenceSummaryToValueListener.onPreferenceChange(
preference,
PreferenceManager.getDefaultSharedPreferences(

preference.getContext()).getString(preference.getKey(),
""));
}

@Override
protected void onResume() {
super.onResume();
PreferenceManager.getDefaultSharedPreferences(this)
.registerOnSharedPreferenceChangeListener(this);
}

@Override
protected void onPause() {
super.onPause();
PreferenceManager.getDefaultSharedPreferences(this)
.unregisterOnSharedPreferenceChangeListener(this);

@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if (key.equals("passgo_length")) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.remove("passgo_pw");
editor.commit();
}
}
}

PatternView.cs
package de.uulm.graphicalpasswords.openpassgo;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Cap;
import android.graphics.Paint.Style;

Page | 141
ICCT COLLEGES FOUNDATION INCORPORATED

import android.graphics.Path.Direction;
import android.graphics.Path;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

public class PatternView extends View implements View.OnTouchListener {

private Path fixedPath = new Path();


private Path tmpPath = new Path();
private Path dotPath = new Path();
private Path tmpDotPath = new Path();

private final int COUNT_CELLS = 4;

private float d;
private int offset;

private float lastXc;


private float lastYc;
private boolean validInput = false;
private boolean dot = false;

private ArrayList<Coordinates> input = new ArrayList<Coordinates>();

private PassGo activity;

private int currentlength = 0;


private int length;

private Rect rect = new Rect();


Paint paint = new Paint();

public PatternView(Context context, AttributeSet attrs, int defStyle) {


super(context, attrs, defStyle);
this.setOnTouchListener(this);
}

public PatternView(Context context, AttributeSet attrs) {


super(context, attrs);
this.setOnTouchListener(this);
}

public PatternView(Context context) {


super(context);
this.setOnTouchListener(this);
}

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);

// white canvas
canvas.getClipBounds(rect);

Page | 142
ICCT COLLEGES FOUNDATION INCORPORATED

offset = rect.height() - rect.width();


offset = offset / 2;

paint.setColor(Color.WHITE);
paint.setStyle(Style.FILL);
canvas.drawRect(rect.left, rect.top + offset, rect.right,
rect.bottom
- offset, paint);

// column width
d = rect.width() * 1f / COUNT_CELLS;

// areas
paint.setColor(Color.LTGRAY);
paint.setStyle(Style.FILL);

for (int i = 0; i < COUNT_CELLS; i++) {


if (i == 0 || i == 3) {

canvas.drawRect(rect.left + 1 * d, rect.top + offset +


i * d,
rect.left + 3 * d, rect.top + offset + (i
+ 1) * d,
paint);

} else {
canvas.drawRect(rect.left, rect.top + offset + i * d,
rect.left
+ 1 * d, rect.top + offset + (i + 1) * d,
paint);
canvas.drawRect(rect.left + 3 * d, rect.top + offset +
i * d,
rect.left + 4 * d, rect.top + offset + (i
+ 1) * d,
paint);
}
}

// black grid
paint.setColor(Color.BLACK);
paint.setStyle(Style.STROKE);

for (int i = 0; i < COUNT_CELLS + 1; i++) {


canvas.drawLine(rect.left, rect.top + offset + i * d,
rect.right,
rect.top + offset + i * d, paint);
canvas.drawLine(rect.left + i * d, rect.top + offset,
rect.left + i
* d, rect.bottom - offset, paint);
}

// Stars
paint.setStyle(Style.FILL);
int starsize = 4;

Page | 143
ICCT COLLEGES FOUNDATION INCORPORATED

canvas.drawRect(rect.left + 2 * d - starsize, rect.top + offset + 2


* d
- starsize, rect.left + 2 * d + starsize, rect.top +
offset + 2
* d + starsize, paint);
canvas.drawRect(rect.left + 6 * d - starsize, rect.top + offset + 2
* d
- starsize, rect.left + 6 * d + starsize, rect.top +
offset + 2
* d + starsize, paint);
canvas.drawRect(rect.left + 2 * d - starsize, rect.top + offset + 6
* d
- starsize, rect.left + 2 * d + starsize, rect.top +
offset + 6
* d + starsize, paint);
canvas.drawRect(rect.left + 6 * d - starsize, rect.top + offset + 6
* d
- starsize, rect.left + 6 * d + starsize, rect.top +
offset + 6
* d + starsize, paint);
canvas.drawRect(rect.left + 4 * d - starsize, rect.top + offset + 4
* d
- starsize, rect.left + 4 * d + starsize, rect.top +
offset + 4
* d + starsize, paint);

// fixedPath
paint.setColor(Color.RED);
paint.setStyle(Style.STROKE);
paint.setStrokeCap(Cap.ROUND);
paint.setStrokeWidth(3);
canvas.drawPath(fixedPath, paint);

// tmpPath
canvas.drawPath(tmpPath, paint);

// DotPath
paint.setStyle(Style.FILL);
canvas.drawPath(dotPath, paint);

// tmpDotPath
canvas.drawPath(tmpDotPath, paint);
}

@Override
public boolean onTouch(View v, MotionEvent event) {
// input coordinates
float x = event.getX();
float y = event.getY();

// nearest intersection
int gridX = Math.round(x * 1f / d);
int gridY = Math.round((y * 1f - offset) / d);

// coordinates of intersection

Page | 144
ICCT COLLEGES FOUNDATION INCORPORATED

float gridXc = gridX * d;


float gridYc = offset + gridY * d;

// input outside of the grid


if (y < offset - 3 / d || y > offset + 8 * d + 1) {
tmpPath.reset();
tmpDotPath.reset();
return true;
}

// reaching password length


if (currentlength == length) {
return true;
}

switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
if (Math.sqrt(Math.pow(x - gridXc, 2) + Math.pow(y - gridYc,
2)) <= d / 3) {
tmpDotPath.addCircle(gridXc, gridYc, 6, Direction.CW);
dot = true;
lastXc = gridXc;
lastYc = gridYc;
validInput = true;
this.invalidate();
input.add(new Coordinates(gridX, gridY));
}
break;
case MotionEvent.ACTION_MOVE:
tmpPath.reset();
if (validInput) {
if (Math.sqrt(Math.pow(x - gridXc, 2) + Math.pow(y -
gridYc, 2)) <= d / 3) {
fixedPath.moveTo(lastXc, lastYc);
fixedPath.lineTo(gridXc, gridYc);
lastXc = gridXc;
lastYc = gridYc;
tmpPath.reset();
tmpDotPath.reset();
Coordinates lastElement = input.get(input.size()
- 1);
if (!lastElement.equals(new Coordinates(gridX,
gridY))) {
input.add(new Coordinates(gridX, gridY));
dot = false;
currentlength++;
}
} else {
tmpPath.moveTo(lastXc, lastYc);
tmpPath.lineTo(x, y);
}
}
invalidate();
checkLength();
break;

Page | 145
ICCT COLLEGES FOUNDATION INCORPORATED

case MotionEvent.ACTION_UP:
if (validInput) {
if (dot) {
dotPath.addCircle(gridXc, gridYc, 6,
Direction.CW);
currentlength++;// rawData.add(new
//
RawData(event.getEventTime(),
// "ACTION_UP Circle
x:"+gridXc+"y:"+gridYc+" input x:"+x+" input y:"+y));
} else if (Math.sqrt(Math.pow(x - gridXc, 2)
+ Math.pow(y - gridYc, 2)) <= d / 3) {
fixedPath.moveTo(lastXc, lastYc);
fixedPath.lineTo(gridXc, gridYc);
}
input.add(new Coordinates(-1, -1));
}
tmpPath.reset();
tmpDotPath.reset();
validInput = false;
invalidate();
checkLength();
break;
}
return true;
}

private void checkLength() {


if (currentlength == length)
activity.setReady(true);
else
activity.setReady(false);
}

public void clear() {


fixedPath.reset();
tmpPath.reset();
dotPath.reset();
tmpDotPath.reset();
invalidate();
input = new ArrayList<Coordinates>();
currentlength = 0;
activity.setReady(false);
}

public ArrayList<Coordinates> getInput() {


return input;
}

public void setActivity(PassGo app) {


activity = app;
}

public Path getFixedPath() {


return fixedPath;

Page | 146
ICCT COLLEGES FOUNDATION INCORPORATED

public Path getDotPath() {


return dotPath;
}

public void setLength(int length) {


this.length = length;
}
}

Check this location:


C:\Users\Chad\Downloads\FORQPassword\Source\src\de\uulm\graphicalpa
sswords\opentapi

I m a ge Ad a p t e r . c s
package de.uulm.graphicalpasswords.opentapi;

import android.content.Context;
import android.content.res.TypedArray;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import de.uulm.graphicalpasswords.R;

public class ImageAdapter extends BaseAdapter {


private int galleryItemBackground;
private Context mContext;

private String[] pictureIDs;

public ImageAdapter(Context c, String[] pictures) {


mContext = c;
pictureIDs = pictures;

TypedArray attr = mContext


.obtainStyledAttributes(R.styleable.UYIGallery);
galleryItemBackground = attr.getResourceId(
R.styleable.UYIGallery_android_galleryItemBackground,
0);
attr.recycle();

Page | 147
ICCT COLLEGES FOUNDATION INCORPORATED

@Override
public int getCount() {
return pictureIDs.length;
}

@Override
public Object getItem(int position) {
return position;
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
String[] split = pictureIDs[position].split(":");
int resId = Integer.parseInt(split[0]);
int field = Integer.parseInt(split[1]);
RememberPassImageView i = new RememberPassImageView(mContext);
i.setHighlitedField(field);
i.setScaleType(ImageView.ScaleType.FIT_XY);
i.setBackgroundResource(galleryItemBackground);
i.setImageResource(resId);
i.setClickable(false);
return i;
}

P a s s I m a ge V i ew . c s
package de.uulm.graphicalpasswords.opentapi;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Rect;
import android.widget.ImageView;

public class PassImageView extends ImageView {


private int resourceID = 0;
Paint paintRed;
Rect rect = new Rect();

public PassImageView(Context context) {


super(context);

Page | 148
ICCT COLLEGES FOUNDATION INCORPORATED

paintRed = new Paint();


paintRed.setColor(Color.RED);
paintRed.setAlpha(150);
paintRed.setStyle(Style.FILL_AND_STROKE);
paintRed.setAntiAlias(true);
paintRed.setStrokeWidth(3);
}

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.getClipBounds(rect);
canvas.drawLine(rect.left, rect.top, rect.right, rect.bottom,
paintRed);
canvas.drawLine(rect.left, rect.bottom, rect.right, rect.top,
paintRed);
}

public int getResourceID() {


return resourceID;
}

@Override
public void setImageResource(int resId) {
super.setImageResource(resId);
this.resourceID = resId;
}

R e m e m b e rP a s s I ma g e . c s
package de.uulm.graphicalpasswords.opentapi;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Paint.Style;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;

public class RememberPassImageView extends ImageView {


private int field = 0;

public RememberPassImageView(Context context) {


super(context);

Page | 149
ICCT COLLEGES FOUNDATION INCORPORATED

public void setHighlitedField(int n) {


field = n;
}

@Override
public void setImageResource(int resId) {
super.setImageResource(resId);
Drawable drawable = getDrawable();
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);

Paint paint = new Paint();


paint.setColor(Color.RED);
paint.setAntiAlias(true);
Rect rect = canvas.getClipBounds();
paint.setAlpha(50);
paint.setStyle(Style.FILL);
Path path = new Path();
switch (field) {
case 1:
path.moveTo(rect.left, rect.top);
path.lineTo(rect.exactCenterX(), rect.exactCenterY());
path.lineTo(rect.right, rect.top);
break;
case 2:
path.moveTo(rect.right, rect.top);
path.lineTo(rect.exactCenterX(), rect.exactCenterY());
path.lineTo(rect.right, rect.bottom);
break;
case 3:
path.moveTo(rect.right, rect.bottom);
path.lineTo(rect.exactCenterX(), rect.exactCenterY());
path.lineTo(rect.left, rect.bottom);
break;
case 4:
path.moveTo(rect.left, rect.bottom);
path.lineTo(rect.exactCenterX(), rect.exactCenterY());
path.lineTo(rect.left, rect.top);
break;
default:
break;
}
path.close();
canvas.drawPath(path, paint);

paint.setAlpha(150);
paint.setStyle(Style.STROKE);
paint.setAntiAlias(true);
paint.setStrokeWidth(3);

canvas.drawLine(rect.left, rect.top, rect.right, rect.bottom,


paint);

Page | 150
ICCT COLLEGES FOUNDATION INCORPORATED

canvas.drawLine(rect.left, rect.bottom, rect.right, rect.top,


paint);

setImageBitmap(bitmap);
}

T AP I Ac t i vi t y. c s
package de.uulm.graphicalpasswords.opentapi;

import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.support.v4.app.NavUtils;

public class TAPIActivity extends Activity {

protected static final int[] IMAGES = { R.drawable.tapibasket,


R.drawable.tapiblume, R.drawable.tapiespresso,
R.drawable.tapieule,
R.drawable.tapiflipflops, R.drawable.tapichick,
R.drawable.tapikatze, R.drawable.tapikirschen,
R.drawable.tapimotorrad, R.drawable.tapimuell,
R.drawable.tapisnail, R.drawable.tapipilz,
R.drawable.tapipizza,
R.drawable.tapischinken, R.drawable.tapicube,
R.drawable.tapiwerkzeug };

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tapi);
// Show the Up button in the action bar.
setupActionBar();
}

@Override
protected void onResume() {
super.onResume();
Button login = (Button) findViewById(R.id.btn_login);
SharedPreferences sharedPref = PreferenceManager
.getDefaultSharedPreferences(this);
if (sharedPref.getString("tapi_pw", "").equals(""))

Page | 151
ICCT COLLEGES FOUNDATION INCORPORATED

login.setEnabled(false);
else
login.setEnabled(true);
}

/**
* Set up the {@link android.app.ActionBar}.
*/
private void setupActionBar() {

getActionBar().setDisplayHomeAsUpEnabled(true);

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.tapi, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
case R.id.action_settings:
Intent intent = new Intent(this,

de.uulm.graphicalpasswords.opentapi.TAPISettingsActivity.class);
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}

public void startCreatePassword(View view) {


Intent intent = new Intent(
this,

de.uulm.graphicalpasswords.opentapi.TAPICreatePasswordActivity.class);
startActivity(intent);
}

Page | 152
ICCT COLLEGES FOUNDATION INCORPORATED

public void startEnterPassword(View view) {


Intent intent = new Intent(this,

de.uulm.graphicalpasswords.opentapi.TAPILoginActivity.class);
startActivity(intent);
}

T AP I L o g i n Ac t i vi t y. c s
package de.uulm.graphicalpasswords.opentapi;

import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.DialogInterface.OnClickListener;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.ImageView.ScaleType;
import android.widget.TableRow.LayoutParams;
import android.support.v4.app.NavUtils;
import android.text.Editable;

public class TAPILoginActivity extends Activity implements TAPI {


private int[] images = new int[16];
private String[] input;
private String password;
private int length;
private Editable text;

private Button back;


private Button clear;
private Button save;

private PassImageView[] imageViews = new PassImageView[16];

private int currentIndex = 0;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tapi_login);

Page | 153
ICCT COLLEGES FOUNDATION INCORPORATED

// Show the Up button in the action bar.


setupActionBar();

SharedPreferences sharedPref = PreferenceManager


.getDefaultSharedPreferences(this);
length = Integer.parseInt(sharedPref.getString("tapi_length", "6"));
password = sharedPref.getString("tapi_pw", "");
input = new String[length];

for (int i = 0; i < images.length; i++) {


images[i] = sharedPref.getInt("image" + i, 0);
}

EditText editText = (EditText) findViewById(R.id.tapi_edittext);


text = editText.getText();
back = (Button) findViewById(R.id.tapi_back);
clear = (Button) findViewById(R.id.tapi_clear);
save = (Button) findViewById(R.id.tapi_save);

TableLayout table = (TableLayout)


findViewById(R.id.tapi_imagetable);

LayoutParams layoutParams = new


LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);

TableRow row = null;


for (int i = 0; i < imageViews.length; i++) {
if (i % 4 == 0) {
row = new TableRow(this);
}
imageViews[i] = new PassImageView(this);
imageViews[i].setLayoutParams(layoutParams);
imageViews[i].setAdjustViewBounds(true);
imageViews[i].setScaleType(ScaleType.CENTER_INSIDE);
imageViews[i].setPadding(5, 5, 5, 5);
imageViews[i].setImageResource(images[i]);
row.addView(imageViews[i]);
if (i % 4 == 3) {
table.addView(row);
}
imageViews[i].setOnTouchListener(new TAPIOnTouchListener(this,
imageViews[i]));
}
}

@Override
public void addInput(int resID, int field) {
text.append("*");
input[currentIndex] = "" + resID + ":" + field;
currentIndex++;
back.setClickable(true);
back.setEnabled(true);
clear.setClickable(true);
clear.setEnabled(true);

Page | 154
ICCT COLLEGES FOUNDATION INCORPORATED

if (currentIndex == input.length) {
save.setClickable(true);
save.setEnabled(true);
for (int i = 0; i < imageViews.length; i++) {
imageViews[i].setClickable(false);
imageViews[i].setEnabled(false);
}
}
}

public void unDo(View view) {


currentIndex--;
input[currentIndex] = "";
text.delete(currentIndex, currentIndex + 1);
if (currentIndex == 0) {
back.setClickable(false);
back.setEnabled(false);
clear.setClickable(false);
clear.setEnabled(false);
}
for (int i = 0; i < imageViews.length; i++) {
imageViews[i].setClickable(true);
imageViews[i].setEnabled(true);
}
save.setClickable(false);
save.setEnabled(false);
}

public void clearAll(View view) {


for (int i = 0; i < currentIndex; i++) {
input[i] = "";
}
currentIndex = 0;
text.clear();
back.setClickable(false);
back.setEnabled(false);
clear.setClickable(false);
clear.setEnabled(false);
save.setClickable(false);
save.setEnabled(false);
for (int i = 0; i < imageViews.length; i++) {
imageViews[i].setClickable(true);
imageViews[i].setEnabled(true);
}
}

public void submit(View view) {


DialogFragment dialog;
if
(password.equals(TAPICreatePasswordActivity.arrayToString(input))) {
dialog = new ResultOKDialog();
} else {
dialog = new WrongResultDialog();
}
dialog.show(getFragmentManager(), "result");

Page | 155
ICCT COLLEGES FOUNDATION INCORPORATED

public static class ResultOKDialog extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
builder.setMessage(R.string.msg_pw_correct).setNeutralButton(
R.string.btn_ok, new OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int id) {
dialog.dismiss();
getActivity().finish();
}
});
return builder.create();
}
}

public static class WrongResultDialog extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
builder.setMessage(R.string.msg_pw_wrong).setNeutralButton(
R.string.btn_ok, new OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int id) {
dialog.dismiss();
getActivity().finish();
}
});
return builder.create();
}
}

/**
* Set up the {@link android.app.ActionBar}.
*/
private void setupActionBar() {

getActionBar().setDisplayHomeAsUpEnabled(true);

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.

Page | 156
ICCT COLLEGES FOUNDATION INCORPORATED

getMenuInflater().inflate(R.menu.tapi_login, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

T AP I . c s
package de.uulm.graphicalpasswords.opentapi;

public interface TAPI {


public void addInput(int resID, int field);
}

T AP I O n T o u c h Li s te n e r. c s
package de.uulm.graphicalpasswords.opentapi;

import android.content.Context;
import android.os.Vibrator;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;

public class TAPIOnTouchListener implements OnTouchListener {

protected TAPI activity;


private Vibrator vibrator;
private PassImageView view;

Page | 157
ICCT COLLEGES FOUNDATION INCORPORATED

public TAPIOnTouchListener(TAPI activity, PassImageView view) {


super();
this.activity = activity;
this.view = view;
vibrator = (Vibrator) ((Context) activity)
.getSystemService(Context.VIBRATOR_SERVICE);
}

@Override
public boolean onTouch(View view, MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
vibrator.vibrate(25);

float x = event.getX();
float y = event.getY();

int field = 0;
if (y < f1(x)) {
if (y < f2(x)) {
field = 1;
} else {
field = 2;
}
} else {
if (y > f2(x)) {
field = 3;
} else {
field = 4;
}
}
activity.addInput(this.view.getResourceID(), field);

return true;
}
return false;
}

private float f1(float x) {


return x;
}

private float f2(float x) {


return view.getHeight() - x;
}

Page | 158
ICCT COLLEGES FOUNDATION INCORPORATED

T AP I C r e a te P a s s w o r d Ac t i vi t y. c s
package de.uulm.graphicalpasswords.opentapi;

import java.util.Arrays;
import java.util.Random;

import de.uulm.graphicalpasswords.opentapi.PassImageView;
import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.DialogInterface.OnClickListener;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Gallery;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.ImageView.ScaleType;
import android.widget.TableRow.LayoutParams;
import android.support.v4.app.NavUtils;
import android.text.Editable;

public class TAPICreatePasswordActivity extends Activity implements


de.uulm.graphicalpasswords.opentapi.TAPI {

private int[] images = new int[16];


private PassImageView[] imageViews = new PassImageView[16];
private Editable text;
private Button back;
private Button save;

private String[] input;


private int length;
private int currentIndex = 0;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tapi_create_password);

// Show the Up button in the action bar.


setupActionBar();

Page | 159
ICCT COLLEGES FOUNDATION INCORPORATED

SharedPreferences sharedPref = PreferenceManager


.getDefaultSharedPreferences(this);
length = Integer.parseInt(sharedPref.getString("tapi_length", "6"));
input = new String[length];

// Save Pictures in randomized order


SharedPreferences.Editor editor = sharedPref.edit();
Random random = new Random(System.currentTimeMillis());
boolean[] usedImages = new boolean[TAPIActivity.IMAGES.length];
Arrays.fill(usedImages, false);
for (int i = 0; i < TAPIActivity.IMAGES.length; i++) {
boolean pictureSet = false;
int index = random.nextInt(TAPIActivity.IMAGES.length);
do {
if (!usedImages[index]) {
editor.putInt("image" + i,
TAPIActivity.IMAGES[index]);
pictureSet = true;
usedImages[index] = true;
} else if (index == TAPIActivity.IMAGES.length - 1) {
index = 0;
} else {
index++;
}
} while (!pictureSet);
}
editor.commit();

for (int i = 0; i < images.length; i++) {


images[i] = sharedPref.getInt("image" + i, 0);
}

EditText editText = (EditText) findViewById(R.id.tapi_edittext);


text = editText.getText();
back = (Button) findViewById(R.id.tapi_back);
save = (Button) findViewById(R.id.tapi_save);

TableLayout table = (TableLayout)


findViewById(R.id.tapi_imagetable);

LayoutParams layoutParams = new


LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
TableRow row = null;
for (int i = 0; i < imageViews.length; i++) {
if (i % 4 == 0) {
row = new TableRow(this);
}
imageViews[i] = new PassImageView(this);
imageViews[i].setLayoutParams(layoutParams);
imageViews[i].setAdjustViewBounds(true);
imageViews[i].setScaleType(ScaleType.CENTER_INSIDE);
imageViews[i].setPadding(5, 5, 5, 5);
imageViews[i].setImageResource(images[i]);
row.addView(imageViews[i]);

Page | 160
ICCT COLLEGES FOUNDATION INCORPORATED

if (i % 4 == 3) {
table.addView(row);
}
imageViews[i].setOnTouchListener(new TAPIOnTouchListener(this,
imageViews[i]));
}

Bundle bundle = new Bundle();


bundle.putInt("length", length);
DialogFragment intro = new IntroDialogFragment();
intro.setArguments(bundle);
intro.show(getFragmentManager(), "intro");
}

/**
* Set up the {@link android.app.ActionBar}.
*/
private void setupActionBar() {

getActionBar().setDisplayHomeAsUpEnabled(true);

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.tapi_create_password, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

@Override
public void addInput(int resID, int field) {
text.append("*");
input[currentIndex] = "" + resID + ":" + field;

Page | 161
ICCT COLLEGES FOUNDATION INCORPORATED

currentIndex++;
back.setClickable(true);
back.setEnabled(true);
if (currentIndex == input.length) {
save.setClickable(true);
save.setEnabled(true);
for (int i = 0; i < imageViews.length; i++) {
imageViews[i].setClickable(false);
imageViews[i].setEnabled(false);
}
}
}

public void unDo(View view) {


currentIndex--;
input[currentIndex] = "";
text.delete(currentIndex, currentIndex + 1);
if (currentIndex == 0) {
back.setClickable(false);
back.setEnabled(false);
}
for (int i = 0; i < imageViews.length; i++) {
imageViews[i].setClickable(true);
imageViews[i].setEnabled(true);
}
save.setClickable(false);
save.setEnabled(false);
}

public void submit(View view) {


SharedPreferences sharedPref = PreferenceManager
.getDefaultSharedPreferences(this);
SharedPreferences.Editor edit = sharedPref.edit();
edit.putString("tapi_pw", arrayToString(input));
edit.commit();

Bundle bundle = new Bundle();


bundle.putStringArray("input", input);
DialogFragment dialog = new RememberPasswordDialogFragment();
dialog.setArguments(bundle);
dialog.show(getFragmentManager(), "remember");
}

protected static String arrayToString(String[] array) {


String result = "";
for (int i = 0; i < array.length; i++) {
result += "[" + array[i] + "]";
}
return result;
}

public static class IntroDialogFragment extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

Page | 162
ICCT COLLEGES FOUNDATION INCORPORATED

AlertDialog.Builder builder = new


AlertDialog.Builder(getActivity());
String message = getString(R.string.msg_dialog_tapi_createpw,
getArguments().getInt("length"));
builder.setTitle(R.string.title_dialog_tapi_createpw)
.setMessage(message)
.setNeutralButton(R.string.btn_ok, new
OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int which) {
dialog.dismiss();
}
});
return builder.create();
}
}

public static class RememberPasswordDialogFragment extends DialogFragment {


@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater layoutInflater = (LayoutInflater) getActivity()
.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = layoutInflater.inflate(
R.layout.tapi_rememberpw_dialog, (ViewGroup)
getActivity()

.findViewById(R.id.tapi_rememberpw_gallery));

AlertDialog.Builder builder = new


AlertDialog.Builder(getActivity());
builder.setView(layout)
.setTitle(R.string.title_dialog_tapi_rememberpw)
.setPositiveButton(R.string.btn_done,
new OnClickListener() {
public void
onClick(DialogInterface dialog,
int which) {
dialog.dismiss();

getActivity().finish();
}
});

Dialog dialog = builder.create();

Gallery g = (Gallery) layout


.findViewById(R.id.tapi_rememberpw_gallery);
g.setAdapter(new ImageAdapter(getActivity(), getArguments()
.getStringArray("input")));

return dialog;
}
}

Page | 163
ICCT COLLEGES FOUNDATION INCORPORATED

T AP I S e t t i n gs Ac t i vi t y. c s
package de.uulm.graphicalpasswords.opentapi;

import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.view.MenuItem;
import android.support.v4.app.NavUtils;

import java.util.List;

import de.uulm.graphicalpasswords.R;

/**
* A {@link PreferenceActivity} that presents a set of application settings. On
* handset devices, settings are presented as a single list. On tablets,
* settings are split by category, with category headers shown to the left of
* the list of settings.
* <p>
* See <a href="http://developer.android.com/design/patterns/settings.html">
* Android Design: Settings</a> for design guidelines and the <a
* href="http://developer.android.com/guide/topics/ui/settings.html">Settings
* API Guide</a> for more information on developing a Settings UI.
*/
public class TAPISettingsActivity extends PreferenceActivity implements
OnSharedPreferenceChangeListener {
/**
* Determines whether to always show the simplified settings UI, where
* settings are presented in a single list. When false, settings are shown
* as a master/detail two-pane view on tablets. When true, a single pane is
* shown on tablets.
*/
private static final boolean ALWAYS_SIMPLE_PREFS = true;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupActionBar();
}

/**
* Set up the {@link android.app.ActionBar}, if the API is available.

Page | 164
ICCT COLLEGES FOUNDATION INCORPORATED

*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
// TODO: If Settings has multiple levels, Up should navigate
up
// that hierarchy.
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);

setupSimplePreferencesScreen();
}

/**
* Shows the simplified settings UI if the device configuration if the
* device configuration dictates that a simplified, single-pane UI should
be
* shown.
*/
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}

// In the simplified UI, fragments are not used at all and we


instead
// use the older PreferenceActivity APIs.

// Add preferences.

Page | 165
ICCT COLLEGES FOUNDATION INCORPORATED

addPreferencesFromResource(R.xml.pref_tapi);

// Bind the summaries of EditText/List/Dialog/Ringtone preferences


to
// their values. When their values change, their summaries are
updated
// to reflect the new value, per the Android Design guidelines.
bindPreferenceSummaryToValue(findPreference("tapi_length"));
}

/** {@inheritDoc} */
@Override
public boolean onIsMultiPane() {
return isXLargeTablet(this) && !isSimplePreferences(this);
}

/**
* Helper method to determine if the device has an extra-large screen. For
* example, 10" tablets are extra-large.
*/
private static boolean isXLargeTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}

/**
* Determines whether the simplified settings UI should be shown. This is
* true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device
* doesn't have newer APIs like {@link PreferenceFragment}, or the device
* doesn't have an extra-large screen. In these cases, a single-pane
* "simplified" settings UI should be shown.
*/
private static boolean isSimplePreferences(Context context) {
return ALWAYS_SIMPLE_PREFS
|| Build.VERSION.SDK_INT <
Build.VERSION_CODES.HONEYCOMB
|| !isXLargeTablet(context);
}

/** {@inheritDoc} */
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onBuildHeaders(List<Header> target) {
if (!isSimplePreferences(this)) {
loadHeadersFromResource(R.xml.pref_headers, target);
}
}

/**
* A preference value change listener that updates the preference's summary
* to reflect its new value.
*/
private static Preference.OnPreferenceChangeListener
sBindPreferenceSummaryToValueListener = new
Preference.OnPreferenceChangeListener() {

Page | 166
ICCT COLLEGES FOUNDATION INCORPORATED

@Override
public boolean onPreferenceChange(Preference preference, Object
value) {
String stringValue = value.toString();

if (preference instanceof ListPreference) {


// For list preferences, look up the correct display
value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference)
preference;
int index =
listPreference.findIndexOfValue(stringValue);

// Set the summary to reflect the new value.


preference
.setSummary(index >= 0 ?
listPreference.getEntries()[index]
: null);
} else {
// For all other preferences, set the summary to the
value's
// simple string representation.
preference.setSummary(stringValue);
}
return true;
}
};

/**
* Binds a preference's summary to its value. More specifically, when the
* preference's value is changed, its summary (line of text below the
* preference title) is updated to reflect the value. The summary is also
* immediately updated upon calling this method. The exact display format
is
* dependent on the type of preference.
*
* @see #sBindPreferenceSummaryToValueListener
*/
private static void bindPreferenceSummaryToValue(Preference preference) {
// Set the listener to watch for value changes.
preference

.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);

// Trigger the listener immediately with the preference's


// current value.
sBindPreferenceSummaryToValueListener.onPreferenceChange(
preference,
PreferenceManager.getDefaultSharedPreferences(

preference.getContext()).getString(preference.getKey(),
""));
}

Page | 167
ICCT COLLEGES FOUNDATION INCORPORATED

@Override
protected void onResume() {
super.onResume();
PreferenceManager.getDefaultSharedPreferences(this)
.registerOnSharedPreferenceChangeListener(this);
}

@Override
protected void onPause() {
super.onPause();
PreferenceManager.getDefaultSharedPreferences(this)
.unregisterOnSharedPreferenceChangeListener(this);

@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if (key.equals("tapi_length")) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.remove("tapi_pw");
editor.commit();
}
}
}

Page | 168
ICCT COLLEGES FOUNDATION INCORPORATED

Check this location:


C : \ Us e rs \ C ha d \ Dow n l oa d s \ F O R Q P a s s w o r d \ S o ur c e \ s r c \ d e \ u
u l m \ g ra p h i c a l pa s s w o r ds \ o pe n u yi

U Y I L o g i n Ac t i vi t y. c s
package de.uulm.graphicalpasswords.openuyi;

import java.util.Arrays;

import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.support.v4.app.NavUtils;
import android.support.v4.view.ViewPager;

public class UYILoginActivity extends Activity implements OnClickListener {

private Vibrator vibrator;

private int password_length;


private String password;
private int[] clickedPictures;

private UYIPagerAdapter pageradapter;

private int countClicks;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Page | 169
ICCT COLLEGES FOUNDATION INCORPORATED

setContentView(R.layout.activity_uyi_login);
// Show the Up button in the action bar.
setupActionBar();

SharedPreferences sharedPref = PreferenceManager


.getDefaultSharedPreferences(this);
password_length =
Integer.parseInt(sharedPref.getString("uyi_length",
"10"));
password = sharedPref.getString("uyi_pw", "");
clickedPictures = new int[password_length];

vibrator = (Vibrator) this.getSystemService(VIBRATOR_SERVICE);


countClicks = 0;

pageradapter = new UYIPagerAdapter(this, this);


ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
viewPager.setAdapter(pageradapter);
viewPager.setCurrentItem(0);
}

@Override
public void onClick(View v) {
vibrator.vibrate(25);
clickedPictures[countClicks] = v.getId();
countClicks++;
if (countClicks == password_length) {
Arrays.sort(clickedPictures);
DialogFragment dialog;
if (password.equals(Arrays.toString(clickedPictures))) {
dialog = new ResultOKDialog();
} else {
dialog = new WrongResultDialog();
}
dialog.show(getFragmentManager(), "result");
}
}

/**
* Set up the {@link android.app.ActionBar}.
*/
private void setupActionBar() {

getActionBar().setDisplayHomeAsUpEnabled(true);

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.uyi_login, menu);
return true;
}

Page | 170
ICCT COLLEGES FOUNDATION INCORPORATED

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

public static class ResultOKDialog extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
builder.setMessage(R.string.msg_pw_correct).setNeutralButton(
R.string.btn_ok, new
DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int id) {
dialog.dismiss();
getActivity().finish();
}
});
return builder.create();
}
}

public static class WrongResultDialog extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
builder.setMessage(R.string.msg_pw_wrong).setNeutralButton(
R.string.btn_ok, new
DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int id) {
dialog.dismiss();

Page | 171
ICCT COLLEGES FOUNDATION INCORPORATED

getActivity().finish();
}
});
return builder.create();
}
}

P i c t ur e . c s
package de.uulm.graphicalpasswords.openuyi;

import java.util.Arrays;

public class Picture {

private int original;


private int distorted;

public Picture(int original, int distorted) {


this.original = original;
this.distorted = distorted;
}

public int getOriginal() {


return original;
}

public void setOriginal(int original) {


this.original = original;
}

public int getDistorted() {


return distorted;
}

public void setDistorted(int distorted) {


this.distorted = distorted;
}

public static String distortedToSortedString(Picture[] pics) {


int[] arr = distortedToIntArray(pics);
Arrays.sort(arr);
return Arrays.toString(arr);
}

public static String distortedToString(Picture[] pics) {


return Arrays.toString(distortedToIntArray(pics));
}

public static int[] distortedToIntArray(Picture[] pics) {

Page | 172
ICCT COLLEGES FOUNDATION INCORPORATED

int[] arr = new int[pics.length];


for (int i = 0; i < arr.length; i++) {
arr[i] = pics[i].getDistorted();
}
return arr;
}
}

I m a ge Ad a p t e r . c s
package de.uulm.graphicalpasswords.openuyi;

import android.content.Context;
import android.content.res.TypedArray;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import de.uulm.graphicalpasswords.R;

public class ImageAdapter extends BaseAdapter {


private int galleryItemBackground;
private Context mContext;

private int[] pics;

public ImageAdapter(Context c, int[] distortedViews) {


mContext = c;
pics = distortedViews;

TypedArray attr = mContext


.obtainStyledAttributes(R.styleable.UYIGallery);
galleryItemBackground = attr.getResourceId(
R.styleable.UYIGallery_android_galleryItemBackground,
0);
attr.recycle();
}

@Override
public int getCount() {
return pics.length;
}

@Override
public Object getItem(int position) {
return position;
}

@Override
public long getItemId(int position) {
return position;
}

Page | 173
ICCT COLLEGES FOUNDATION INCORPORATED

@Override
public View getView(int position, View convertView, ViewGroup parent) {
ImageView i = new ImageView(mContext);
i.setScaleType(ImageView.ScaleType.FIT_XY);
i.setBackgroundResource(galleryItemBackground);
i.setImageResource(pics[position]);
return i;
}

U Y I S e t t i n gs Ac t i vi t y. c s
package de.uulm.graphicalpasswords.openuyi;

import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Configuration;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.RingtonePreference;
import android.text.TextUtils;
import android.view.MenuItem;
import android.support.v4.app.NavUtils;

import java.util.List;

import de.uulm.graphicalpasswords.R;
import de.uulm.graphicalpasswords.R.string;
import de.uulm.graphicalpasswords.R.xml;

/**
* A {@link PreferenceActivity} that presents a set of application settings. On
* handset devices, settings are presented as a single list. On tablets,
* settings are split by category, with category headers shown to the left of
* the list of settings.
* <p>
* See <a href="http://developer.android.com/design/patterns/settings.html">
* Android Design: Settings</a> for design guidelines and the <a
* href="http://developer.android.com/guide/topics/ui/settings.html">Settings
* API Guide</a> for more information on developing a Settings UI.
*/

Page | 174
ICCT COLLEGES FOUNDATION INCORPORATED

public class UYISettingsActivity extends PreferenceActivity implements


OnSharedPreferenceChangeListener {
/**
* Determines whether to always show the simplified settings UI, where
* settings are presented in a single list. When false, settings are shown
* as a master/detail two-pane view on tablets. When true, a single pane is
* shown on tablets.
*/
private static final boolean ALWAYS_SIMPLE_PREFS = true;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupActionBar();
}

/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
// TODO: If Settings has multiple levels, Up should navigate
up
// that hierarchy.
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);

setupSimplePreferencesScreen();

Page | 175
ICCT COLLEGES FOUNDATION INCORPORATED

/**
* Shows the simplified settings UI if the device configuration if the
* device configuration dictates that a simplified, single-pane UI should
be
* shown.
*/
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}

// In the simplified UI, fragments are not used at all and we


instead
// use the older PreferenceActivity APIs.

// Add 'general' preferences.


addPreferencesFromResource(R.xml.pref_uyi);

// Bind the summaries of EditText/List/Dialog/Ringtone preferences


to
// their values. When their values change, their summaries are
updated
// to reflect the new value, per the Android Design guidelines.
bindPreferenceSummaryToValue(findPreference("uyi_length"));
}

/** {@inheritDoc} */
@Override
public boolean onIsMultiPane() {
return isXLargeTablet(this) && !isSimplePreferences(this);
}

/**
* Helper method to determine if the device has an extra-large screen. For
* example, 10" tablets are extra-large.
*/
private static boolean isXLargeTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}

/**
* Determines whether the simplified settings UI should be shown. This is
* true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device
* doesn't have newer APIs like {@link PreferenceFragment}, or the device
* doesn't have an extra-large screen. In these cases, a single-pane
* "simplified" settings UI should be shown.
*/
private static boolean isSimplePreferences(Context context) {
return ALWAYS_SIMPLE_PREFS
|| Build.VERSION.SDK_INT <
Build.VERSION_CODES.HONEYCOMB
|| !isXLargeTablet(context);

Page | 176
ICCT COLLEGES FOUNDATION INCORPORATED

/** {@inheritDoc} */
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onBuildHeaders(List<Header> target) {
if (!isSimplePreferences(this)) {
loadHeadersFromResource(R.xml.pref_headers, target);
}
}

/**
* A preference value change listener that updates the preference's summary
* to reflect its new value.
*/
private static Preference.OnPreferenceChangeListener
sBindPreferenceSummaryToValueListener = new
Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object
value) {
String stringValue = value.toString();

if (preference instanceof ListPreference) {


// For list preferences, look up the correct display
value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference)
preference;
int index =
listPreference.findIndexOfValue(stringValue);

// Set the summary to reflect the new value.


preference
.setSummary(index >= 0 ?
listPreference.getEntries()[index]
: null);

} else {
// For all other preferences, set the summary to the
value's
// simple string representation.
preference.setSummary(stringValue);
}
return true;
}
};

/**
* Binds a preference's summary to its value. More specifically, when the
* preference's value is changed, its summary (line of text below the
* preference title) is updated to reflect the value. The summary is also
* immediately updated upon calling this method. The exact display format
is
* dependent on the type of preference.

Page | 177
ICCT COLLEGES FOUNDATION INCORPORATED

*
* @see #sBindPreferenceSummaryToValueListener
*/
private static void bindPreferenceSummaryToValue(Preference preference) {
// Set the listener to watch for value changes.
preference

.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);

// Trigger the listener immediately with the preference's


// current value.
sBindPreferenceSummaryToValueListener.onPreferenceChange(
preference,
PreferenceManager.getDefaultSharedPreferences(

preference.getContext()).getString(preference.getKey(),
""));
}

@Override
protected void onResume() {
super.onResume();
PreferenceManager.getDefaultSharedPreferences(this)
.registerOnSharedPreferenceChangeListener(this);
}

@Override
protected void onPause() {
super.onPause();
PreferenceManager.getDefaultSharedPreferences(this)
.unregisterOnSharedPreferenceChangeListener(this);

@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if (key.equals("uyi_length")) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.remove("uyi_pw");
editor.commit();
}
}
}

Page | 178
ICCT COLLEGES FOUNDATION INCORPORATED

U Y I C r e a t e P a s s w or d Ac t i vi t y. c s
package de.uulm.graphicalpasswords.openuyi;

import java.util.Arrays;

import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.DialogInterface.OnClickListener;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnLongClickListener;
import android.widget.AdapterView;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView.ScaleType;
import android.widget.TableRow.LayoutParams;
import android.support.v4.app.NavUtils;

public class UYICreatePasswordActivity extends Activity {

private Vibrator vibrator;

private int length;

private ImageView[] originalViews;


private ImageView[] distortedViews;

private Picture[] selectedPictures;

private Gallery gallery;


private TableLayout table;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_uyi_create_password);
// Show the Up button in the action bar.

Page | 179
ICCT COLLEGES FOUNDATION INCORPORATED

setupActionBar();

SharedPreferences sharedPref = PreferenceManager


.getDefaultSharedPreferences(this);
length = Integer.parseInt(sharedPref.getString("uyi_length", "10"));

originalViews = new ImageView[length];


distortedViews = new ImageView[length];
selectedPictures = new Picture[length];

Bundle bundle = new Bundle();


bundle.putInt("length", length);
DialogFragment intro = new IntroDialogFragment();
intro.setArguments(bundle);
intro.show(getFragmentManager(), "intro");

vibrator = (Vibrator) this.getSystemService(VIBRATOR_SERVICE);

Arrays.fill(selectedPictures, null);

gallery = (Gallery) findViewById(R.id.uyi_gallery_originals);


gallery.setAdapter(new UYIImageAdapter(this));

gallery.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
ImageView viewOriginal = new ImageView(
UYICreatePasswordActivity.this);
ImageView viewDistorted = new ImageView(
UYICreatePasswordActivity.this);

int i = 0;
for (; i < selectedPictures.length; i++) {
if (i == selectedPictures.length - 1
&& selectedPictures[i] != null) {
removePicture(i);
}
if (selectedPictures[i] == null
|| i == selectedPictures.length -
1) {
viewOriginal = originalViews[i];
viewDistorted = distortedViews[i];
selectedPictures[i] = ((UYIImageAdapter)
parent

.getAdapter()).getPicture(position);
vibrator.vibrate(100);

ScrollView sv = (ScrollView)
findViewById(R.id.uyi_choosepi_scrollview);
int height =
originalViews[0].getMeasuredHeight();
sv.scrollTo(0, (i * height) - 200);

break;

Page | 180
ICCT COLLEGES FOUNDATION INCORPORATED

}
}

int originalImageResource = ((UYIImageAdapter) parent

.getAdapter()).getImageResource(position);
viewOriginal.setImageResource(originalImageResource);
viewDistorted.setImageResource(((UYIImageAdapter)
parent

.getAdapter()).getDistortedImageResource(position));
((UYIImageAdapter)
parent.getAdapter()).removePicture(position);

OnLongClickListener listener = new


OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
vibrator.vibrate(200);
int viewid = v.getId();
int index = -1;

for (int i = 0; i < originalViews.length;


i++) {
if (originalViews[i].getId() ==
viewid) {
index = i;
break;
} else if
(distortedViews[i].getId() == viewid) {
index = i;
break;
}
}
Bundle bundle = new Bundle();
bundle.putInt("index", index);
DialogFragment dialog = new
DeleteImageDialogFragment();
dialog.setArguments(bundle);
dialog.show(getFragmentManager(),
"delete");
return false;
}
};

viewOriginal.setOnLongClickListener(listener);
viewDistorted.setOnLongClickListener(listener);

// Check
int count = 0;
for (int j = 0; j < selectedPictures.length; j++) {
if (selectedPictures[j] != null) {
count++;
}
}

Page | 181
ICCT COLLEGES FOUNDATION INCORPORATED

if (count == selectedPictures.length) {
findViewById(R.id.uyi_save).setClickable(true);
findViewById(R.id.uyi_save).setEnabled(true);
}
}
});

table = (TableLayout) findViewById(R.id.uyi_choosepi_tablelayout);


LayoutParams params = new LayoutParams(
android.widget.TableRow.LayoutParams.WRAP_CONTENT,
android.widget.TableRow.LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.CENTER;
for (int i = 0; i < length; i++) {
TableRow row = new TableRow(table.getContext());

originalViews[i] = new ImageView(row.getContext());


originalViews[i].setAdjustViewBounds(true);
originalViews[i].setScaleType(ScaleType.FIT_XY);
originalViews[i].setPadding(3, 3, 3, 3);
originalViews[i].setImageResource(R.drawable.oempty);
originalViews[i].setId(100 + i);

distortedViews[i] = new ImageView(row.getContext());


distortedViews[i].setAdjustViewBounds(true);
distortedViews[i].setScaleType(ScaleType.FIT_XY);
distortedViews[i].setPadding(3, 3, 3, 3);
distortedViews[i].setImageResource(R.drawable.wempty);
distortedViews[i].setId(1000 + i);

ImageView arrow = new ImageView(row.getContext());


arrow.setAdjustViewBounds(true);
arrow.setScaleType(ScaleType.FIT_XY);
arrow.setMaxWidth(80);
arrow.setPadding(3, 3, 3, 3);
arrow.setImageResource(R.drawable.arrow_active);
arrow.setLayoutParams(params);

row.addView(originalViews[i]);
row.addView(arrow);
row.addView(distortedViews[i]);
table.addView(row);
}
}

private void removePicture(int index) {


findViewById(R.id.uyi_save).setClickable(false);
findViewById(R.id.uyi_save).setEnabled(false);

ImageView orig = originalViews[index];


ImageView dist = distortedViews[index];
orig.setOnLongClickListener(null);
dist.setOnLongClickListener(null);
orig.setImageResource(R.drawable.oempty);
dist.setImageResource(R.drawable.wempty);
orig.setClickable(false);

Page | 182
ICCT COLLEGES FOUNDATION INCORPORATED

dist.setClickable(false);
((UYIImageAdapter) gallery.getAdapter())
.addPicture(selectedPictures[index]);
selectedPictures[index] = null;
}

/**
* Set up the {@link android.app.ActionBar}.
*/
private void setupActionBar() {

getActionBar().setDisplayHomeAsUpEnabled(true);

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.uyi_create_password, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

public void submit(View view) {


SharedPreferences sharedPref = PreferenceManager
.getDefaultSharedPreferences(this);
SharedPreferences.Editor edit = sharedPref.edit();
edit.putString("uyi_pw",
Picture.distortedToSortedString(selectedPictures));
edit.commit();

Bundle bundle = new Bundle();


bundle.putIntArray("input",
Picture.distortedToIntArray(selectedPictures));
DialogFragment dialog = new RememberPasswordDialogFragment();

Page | 183
ICCT COLLEGES FOUNDATION INCORPORATED

dialog.setArguments(bundle);
dialog.show(getFragmentManager(), "remember");
}

public static class IntroDialogFragment extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
String message = getString(R.string.msg_dialog_uyi_createpw,
getArguments().getInt("length"));
builder.setTitle(R.string.title_dialog_uyi_createpw)
.setMessage(message)
.setNeutralButton(R.string.btn_ok, new
OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int which) {
dialog.dismiss();
}
});
return builder.create();
}
}

public static class DeleteImageDialogFragment extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
DeleteOnClickListener deleteListener = new
DeleteOnClickListener(
getArguments().getInt("index", -1));
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
builder.setMessage(R.string.msg_dialog_uyi_deleteimage)
.setCancelable(false)
.setPositiveButton(R.string.btn_yes,
deleteListener)
.setNegativeButton(R.string.btn_no, new
OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int which) {
dialog.dismiss();
}
});
return builder.create();
}

class DeleteOnClickListener implements


DialogInterface.OnClickListener {

Page | 184
ICCT COLLEGES FOUNDATION INCORPORATED

private int deletePicture;

public DeleteOnClickListener(int deletePicture) {


super();
this.deletePicture = deletePicture;
}

@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if (which == Dialog.BUTTON_POSITIVE && deletePicture !=
-1) {
((UYICreatePasswordActivity) getActivity())
.removePicture(deletePicture);
}
}
}
}

public static class RememberPasswordDialogFragment extends DialogFragment {


@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater layoutInflater = (LayoutInflater) getActivity()
.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = layoutInflater.inflate(
R.layout.uyi_rememberpw_dialog, (ViewGroup)
getActivity()

.findViewById(R.id.uyi_rememberpw_gallery));

AlertDialog.Builder builder = new


AlertDialog.Builder(getActivity());
builder.setView(layout)
.setTitle(R.string.title_dialog_uyi_rememberpw)
.setPositiveButton(R.string.btn_done,
new OnClickListener() {
public void
onClick(DialogInterface dialog,
int which) {
dialog.dismiss();

getActivity().finish();
}
});

Dialog dialog = builder.create();

Gallery g = (Gallery) layout


.findViewById(R.id.uyi_rememberpw_gallery);
g.setAdapter(new ImageAdapter(getActivity(), getArguments()
.getIntArray("input")));

return dialog;
}
}}

Page | 185
ICCT COLLEGES FOUNDATION INCORPORATED

UYIPagerAdapter.cs
package de.uulm.graphicalpasswords.openuyi;

import java.util.Random;

import de.uulm.graphicalpasswords.R;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TableLayout;
import android.widget.TableRow;

public class UYIPagerAdapter extends PagerAdapter {

private int[] pictures_page1 = new int[9];


private int[] pictures_page2 = new int[9];
private int[] pictures_page3 = new int[9];

private int[][] picture_arrays = { pictures_page1, pictures_page2,


pictures_page3 };

private OnClickListener clickListener;

public UYIPagerAdapter(OnClickListener listener, Activity activity) {


super();
this.clickListener = listener;

int length = UYIActivity.DISTORTED_PICTURES.length;

boolean[] pictureUsed = new boolean[length];


for (int i = 0; i < length; i++) {
pictureUsed[i] = false;
}

int[] pictures = UYIActivity.DISTORTED_PICTURES;

Random random = new Random(System.currentTimeMillis());


for (int i = 0; i < 9; i++) {
for (int j = 0; j < 3; j++) {
int index = random.nextInt(length);
boolean pictureset = false;
do {
if (!pictureUsed[index]) {
picture_arrays[j][i] = pictures[index];
pictureUsed[index] = true;
pictureset = true;

Page | 186
ICCT COLLEGES FOUNDATION INCORPORATED

} else {
index++;
if (index >= pictures.length) {
index = 0;
}
}
} while (!pictureset);
}
}
}

@Override
public void destroyItem(View collection, int arg1, Object object) {
((ViewPager) collection).removeView((View) object);
}

@Override
public int getCount() {
return 3;
}

@Override
public Object instantiateItem(View collection, int pos) {
LayoutInflater inflater = (LayoutInflater) collection.getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

int page = 0;

switch (pos) {
case 1:
page = R.layout.uyipage2;
break;
case 2:
page = R.layout.uyipage3;
break;
default:
page = R.layout.uyipage1;
break;
}

View view = inflater.inflate(page, null);


TableLayout currentTable;

switch (pos) {
case 1:
currentTable = (TableLayout) view
.findViewById(R.id.uyi_tablelayout_page2);
break;
case 2:
currentTable = (TableLayout) view
.findViewById(R.id.uyi_tablelayout_page3);
break;
default:
currentTable = (TableLayout) view
.findViewById(R.id.uyi_tablelayout_page1);

Page | 187
ICCT COLLEGES FOUNDATION INCORPORATED

break;
}

// Add ImageButtons to TableLayout


int index = 0;
for (int i = 0; i < 3; i++) {
TableRow currentRow = new TableRow(view.getContext());
for (int j = 0; j < 3; j++) {
ImageButton button = new
ImageButton(view.getContext());
button.setBackgroundColor(Color.TRANSPARENT);
button.setPadding(3, 3, 3, 3);
button.setAdjustViewBounds(true);
button.setOnClickListener(clickListener);
button.setImageResource(picture_arrays[pos][index]);
button.setId(picture_arrays[pos][index]);
button.setClickable(true);
index++;
currentRow.addView(button);
}
currentTable.addView(currentRow);
}

((ViewPager) collection).addView(view, 0);

return view;
}

@Override
public boolean isViewFromObject(View view, Object object) {
return view == ((View) object);
}

@Override
public Parcelable saveState() {
return null;
}

@Override
public void finishUpdate(View arg0) {
// TODO Auto-generated method stub

@Override
public void restoreState(Parcelable arg0, ClassLoader arg1) {
// TODO Auto-generated method stub
}

@Override
public void startUpdate(View arg0) {
// TODO Auto-generated method stub
}

public String getPictureSet() {

Page | 188
ICCT COLLEGES FOUNDATION INCORPORATED

String set1 = "";


String set2 = "";
String set3 = "";
for (int i = 0; i < pictures_page1.length; i++) {
set1 += "[" + pictures_page1[i] + "]";
set2 += "[" + pictures_page2[i] + "]";
set3 += "[" + pictures_page3[i] + "]";
}
return "(" + set1 + ")(" + set2 + ")(" + set3 + ")";
}
}

UYIActivity.cs
package de.uulm.graphicalpasswords.openuyi;

import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.support.v4.app.NavUtils;

public class UYIActivity extends Activity {

protected static final int[] ORIGINAL_PICTURES = { R.drawable.o1,


R.drawable.o2, R.drawable.o3, R.drawable.o4, R.drawable.o5,
R.drawable.o6, R.drawable.o7, R.drawable.o8, R.drawable.o9,
R.drawable.o10, R.drawable.o11, R.drawable.o12,
R.drawable.o13,
R.drawable.o14, R.drawable.o15, R.drawable.o16,
R.drawable.o17,
R.drawable.o18, R.drawable.o19, R.drawable.o20,
R.drawable.o21,
R.drawable.o22, R.drawable.o23, R.drawable.o24,
R.drawable.o25,
R.drawable.o26, R.drawable.o27 };
protected static final int[] DISTORTED_PICTURES = { R.drawable.w1,
R.drawable.w2, R.drawable.w3, R.drawable.w4, R.drawable.w5,
R.drawable.w6, R.drawable.w7, R.drawable.w8, R.drawable.w9,
R.drawable.w10, R.drawable.w11, R.drawable.w12,
R.drawable.w13,
R.drawable.w14, R.drawable.w15, R.drawable.w16,
R.drawable.w17,
R.drawable.w18, R.drawable.w19, R.drawable.w20,
R.drawable.w21,
R.drawable.w22, R.drawable.w23, R.drawable.w24,
R.drawable.w25,
R.drawable.w26, R.drawable.w27 };

Page | 189
ICCT COLLEGES FOUNDATION INCORPORATED

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_uyi);
// Show the Up button in the action bar.
setupActionBar();
}

@Override
protected void onResume() {
super.onResume();
Button login = (Button) findViewById(R.id.btn_login);
SharedPreferences sharedPref = PreferenceManager
.getDefaultSharedPreferences(this);
if (sharedPref.getString("uyi_pw", "").equals(""))
login.setEnabled(false);
else
login.setEnabled(true);
}

/**
* Set up the {@link android.app.ActionBar}.
*/
private void setupActionBar() {

getActionBar().setDisplayHomeAsUpEnabled(true);

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.uyi, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
case R.id.action_settings:
Intent intent = new Intent(this,

Page | 190
ICCT COLLEGES FOUNDATION INCORPORATED

de.uulm.graphicalpasswords.openuyi.UYISettingsActivity.class);
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}

public void startCreatePassword(View view) {


Intent intent = new Intent(this,

de.uulm.graphicalpasswords.openuyi.UYICreatePasswordActivity.class);
startActivity(intent);
}

public void startEnterPassword(View view) {


Intent intent = new Intent(this,

de.uulm.graphicalpasswords.openuyi.UYILoginActivity.class);
startActivity(intent);
}

UYILoginActivity.cs
package de.uulm.graphicalpasswords.openuyi;

import java.util.Arrays;

import de.uulm.graphicalpasswords.R;
import android.os.Bundle;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.support.v4.app.NavUtils;
import android.support.v4.view.ViewPager;

public class UYILoginActivity extends Activity implements OnClickListener {

private Vibrator vibrator;

private int password_length;


private String password;
private int[] clickedPictures;

private UYIPagerAdapter pageradapter;

Page | 191
ICCT COLLEGES FOUNDATION INCORPORATED

private int countClicks;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_uyi_login);
// Show the Up button in the action bar.
setupActionBar();

SharedPreferences sharedPref = PreferenceManager


.getDefaultSharedPreferences(this);
password_length =
Integer.parseInt(sharedPref.getString("uyi_length",
"10"));
password = sharedPref.getString("uyi_pw", "");
clickedPictures = new int[password_length];

vibrator = (Vibrator) this.getSystemService(VIBRATOR_SERVICE);


countClicks = 0;

pageradapter = new UYIPagerAdapter(this, this);


ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
viewPager.setAdapter(pageradapter);
viewPager.setCurrentItem(0);
}

@Override
public void onClick(View v) {
vibrator.vibrate(25);
clickedPictures[countClicks] = v.getId();
countClicks++;
if (countClicks == password_length) {
Arrays.sort(clickedPictures);
DialogFragment dialog;
if (password.equals(Arrays.toString(clickedPictures))) {
dialog = new ResultOKDialog();
} else {
dialog = new WrongResultDialog();
}
dialog.show(getFragmentManager(), "result");
}
}

/**
* Set up the {@link android.app.ActionBar}.
*/
private void setupActionBar() {

getActionBar().setDisplayHomeAsUpEnabled(true);

@Override
public boolean onCreateOptionsMenu(Menu menu) {

Page | 192
ICCT COLLEGES FOUNDATION INCORPORATED

// Inflate the menu; this adds items to the action bar if it is


present.
getMenuInflater().inflate(R.menu.uyi_login, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of
this
// activity, the Up button is shown. Use NavUtils to allow
users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

public static class ResultOKDialog extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
builder.setMessage(R.string.msg_pw_correct).setNeutralButton(
R.string.btn_ok, new
DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int id) {
dialog.dismiss();
getActivity().finish();
}
});
return builder.create();
}
}

public static class WrongResultDialog extends DialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new
AlertDialog.Builder(getActivity());
builder.setMessage(R.string.msg_pw_wrong).setNeutralButton(

Page | 193
ICCT COLLEGES FOUNDATION INCORPORATED

R.string.btn_ok, new
DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface
dialog, int id) {
dialog.dismiss();
getActivity().finish();
}
});
return builder.create();
}
}

Page | 194
ICCT COLLEGES FOUNDATION INCORPORATED

MainActivity.cs
package de.uulm.graphicalpasswords;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

public void startMIBA(View view) {


Intent intent = new Intent(this,

de.uulm.graphicalpasswords.openmiba.MIBAActivity.class);
startActivity(intent);
}

public void startPassGo(View view) {


Intent intent = new Intent(this,

de.uulm.graphicalpasswords.openpassgo.PassGoActivity.class);
startActivity(intent);
}

public void startTAPI(View view) {


Intent intent = new Intent(this,

de.uulm.graphicalpasswords.opentapi.TAPIActivity.class);
startActivity(intent);
}

public void startUYI(View view) {


Intent intent = new Intent(this,
de.uulm.graphicalpasswords.openuyi.UYIActivity.class);
startActivity(intent);
}

Page | 195
ICCT COLLEGES FOUNDATION INCORPORATED

Page | 196

You might also like