-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIntentObj.rb
More file actions
78 lines (63 loc) · 1.84 KB
/
IntentObj.rb
File metadata and controls
78 lines (63 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#
# IntentObj.rb
#
#
# Created by Erika Chin on 10/26/10.
# Copyright (c) 2010 __MyCompanyName__. All rights reserved.
#
class IntentObj
attr_accessor :name, :line, :line_num, :source_line_num, :method, :isMethodParam, :type, :registers, :init_line_num, :explicit, :explicit_destination, :dest_type, :done, :limitation, :sink_line, :is_init, :returned, :hasExtra, :hasChooser, :hasURI, :hasFlagRead, :hasFlagWrite, :action
#@name="" #name of method+@+line_num #@line="" #Dalvik code line
#@line_num=0 #line num (counted from beginning of method)
#@source_line_num=0 #line num from source code
#@method="" #name of method where it appears
#@isMethodParam=false #is it a method declaration?
#@type=0 #type of constructor
#@registers=[] #registers holding intent
#@init_line_num=0 #line num of the init
#@explicit=false #explicit or implicit intent
#@explicit_destination="" #component destination
#@dest_type="" #broadcast, service, activity
#@done=false #whether it has been processed
#@limitation="" #package limitation
def initialize(meth, lnum, line, src_lnum)
@name=meth+"@"+lnum.to_s
@line=line
@line_num=lnum
@source_line_num=src_lnum
@method=meth
@isMethodParam=false
@type=0
@registers=[]
@init_line_num=0
@is_init=false
@explicit=false
@explicit_destination=""
@dest_type=""
@sink_line=""
@done=false
@limitation=""
@returned=false
@hasExtra=false
@hasChooser=false
@hasURI=false
@hasFlagRead=false
@hasFlagWrite=false
@action=[]
end
def addregister(reg)
if hasregister(reg) == false then
@registers.push(reg)
puts "Adding register #{reg}" if $options[:debug]
end
end
def removeregister(reg)
if hasregister(reg) == true then
@registers.delete(reg)
puts "Removing register #{reg}" if $options[:debug]
end
end
def hasregister(reg)
return @registers.include?(reg)
end
end