Commit 2264c5b3 authored by José Soares's avatar José Soares

Added senception logo

parent 11922cf9
......@@ -101,7 +101,7 @@ public class ContextualManagerMainActivity extends Activity {
super.onCreate(savedInstanceState);
setContentView(R.layout.cmumobile_ma_layout);
FragmentManager manager = getFragmentManager();
FragmentManager manager = getFragmentManager();
//Asks user for permission to get usage stats
if(!ContextualManagerPermissions.usageStatsPermission(getApplicationContext())) {
......@@ -124,7 +124,6 @@ public class ContextualManagerMainActivity extends Activity {
doBindReportService();
Log.d(TAG, "ContextualManagerService started.");
}
@Override
......
......@@ -239,7 +239,7 @@ public class ContextualManagerCaptureService extends Service {
@Override
public void onReceive(Context context, Intent intent) {
ContextualManagerMainActivity.backupDB(context);
Calendar day = Calendar.getInstance();
int newDayOfTheWeek = day.get(Calendar.DAY_OF_WEEK);
......@@ -295,7 +295,7 @@ public class ContextualManagerCaptureService extends Service {
double similarity = numEncounters*avgEncDur;
peer.setSimilarity(similarity);
dataSource.updatePeer(peer, checkWeek("peers"));
Log.d(TAG, "Calculated I: " + similarity + "And saved it on the DB");
Log.d(TAG, "Calculated I: " + similarity + " and saved it on the DB" + "for peer: " + peer.getSSID());
}
}
......@@ -324,9 +324,9 @@ public class ContextualManagerCaptureService extends Service {
dataSource.registerNewAppUsage(app);
}
}
Log.d(TAG, "Saved the physical resources and the apps usage on the DB");
}
ContextualManagerMainActivity.backupDB(context);
}
}
......
......@@ -78,7 +78,7 @@ public class ContextualManagerInterfaceService extends Service {
if(dataSource.hasPeer(peerList.get(i), checkWeek("peers"))){
ContextualManagerAP peer = dataSource.getPeer(peerList.get(i), checkWeek("peers"));
hashMapSimilarity.put(peerList.get(i), peer.getSimilarity());
Log.d(TAG, "Calculated the similarity of the peer " + peerList.get(i) + "with I = " + peer.getSimilarity());
Log.d(TAG, "Calculated the similarity of the peer " + peerList.get(i) + " with I = " + peer.getSimilarity());
}
else {
hashMapSimilarity.put(peerList.get(i), null); //if the peer id given was not found on the db then we can't provide it's centrality
......
......@@ -221,8 +221,9 @@ public class ContextualManagerService extends Service{
}
/*Checks if we lost a connection with any peer*/
//if any peer on the db is not on the peers list found in this scan, then the peer was disconnected
//with time: optimize this function (find the symmetric difference list)
// we assume that the peer was disconnected if any peer on the db is not on the peers list found in this scan
//with time: its possible to optimize this function (find the symmetric difference list)
//idea to optimize: disconnect all peers and only connect those who were found on the scan
boolean connectionLost = false;
for (int i = 0; i < allPeersOnDB.size(); i++) {
ContextualManagerAP peerOnDB = allPeersOnDB.get(i);
......@@ -238,6 +239,7 @@ public class ContextualManagerService extends Service{
//We lost connection of a peer
if( connectionLost && allPeersOnDB.get(i).getIsConnected() == 1 ) {
peerOnDB.setEndEncounter((int)(System.currentTimeMillis() / 1000));
Log.d(TAG, "ENDENCOUNTER: " + peerOnDB.getEndEncounter());
peerOnDB.setIsConnected(0);
dataSource.updatePeer(peerOnDB, checkWeek("peers"));
}
......@@ -257,8 +259,11 @@ public class ContextualManagerService extends Service{
ap.setSimilarity(0.0);
ap.setNumEncounters(1);
ap.setStartEncounter((int)(System.currentTimeMillis()/1000)); //time in seconds System.currentTimeMillis()/1000
Log.d(TAG, "StartEncounter: " + ap.getStartEncounter());
ap.setEndEncounter((int)(System.currentTimeMillis()/1000));
Log.d(TAG, "EndEncounter: " + ap.getEndEncounter());
ap.setAvgEncounterDuration(0);
Log.d(TAG, "AvgDuration: " + ap.getAvgEncounterDuration());
ap.setIsConnected(1);
/*Average encounter calculation*/
double peerAvgEncDur = ap.getAvgEncounterDuration();
......@@ -280,12 +285,18 @@ public class ContextualManagerService extends Service{
peer.setIsConnected(1);
peer.setStartEncounter((int)(System.currentTimeMillis()/1000));
}
Log.d(TAG, "ENDENCOUNTER: " + peer.getEndEncounter());
/*AVG ENCOUNTER CALCULATION*/
/*AVG ENCOUNTER DURATION CALCULATION*/
double peerAvgEncDur = peer.getAvgEncounterDuration();
int peerEndEnc = peer.getEndEncounter();
Log.d(TAG, "endEnc = " + peerEndEnc);
int peerStartEnc = peer.getStartEncounter();
peer.setAvgEncounterDuration((peerAvgEncDur + (peerEndEnc-peerStartEnc))/ (double) (System.currentTimeMillis() / 1000));
Log.d(TAG, "startEnc = " + peerStartEnc);
int duration = (peerEndEnc-peerStartEnc);
Log.d(TAG, "duration = " + duration);
peer.setAvgEncounterDuration((peerAvgEncDur + duration)/ (double) (System.currentTimeMillis() / 1000));
Log.d(TAG, "The avgEncounterDuration of the peer " + peer.getSSID() + " is " + peer.getAvgEncounterDuration());
dataSource.updatePeer(peer, checkWeek("peers"));
Log.d(TAG, "The peer " + ap.getSSID() + " was found and updated into the DB");
}
......
......@@ -9,26 +9,36 @@
android:id="@+id/rev_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<ImageView
android:id="@+id/tkiddo_logo"
android:contentDescription="@string/app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cmumobilelight"
/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tkiddo_logo"
android:layout_centerHorizontal="true"
android:text="@string/background"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#808080"
android:textSize="22sp" />
android:layout_centerHorizontal="true">
<ImageView
android:id="@+id/tkiddo_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/app_name"
android:src="@drawable/cmumobilelight" />
<ImageView
android:id="@+id/company_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/text"
android:contentDescription="@string/company"
android:elevation="0dp"
android:src="@drawable/senception_logo" />
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tkiddo_logo"
android:layout_centerHorizontal="true"
android:text="@string/background"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#808080"
android:textSize="22sp" />
</RelativeLayout>
<android.support.v4.widget.DrawerLayout
......
......@@ -27,5 +27,7 @@
<string name="location_msg">Vefique se o Serviço de Localizaçao esta Activo</string>
<string name="project_name_report">Contextual_Manager_Relatorio</string>
<string name="projname_report">cm_relatorio-</string>
<string name="company_logo">Senception_Logo</string>
<string name="company">Senception</string>
</resources>
\ No newline at end of file
......@@ -27,6 +27,8 @@
<string name="location_msg">Verify Location Services is Enabled</string>
<string name="project_name_report">Contextual_Manager_Report</string>
<string name="projname_report">cm_report-</string>
<string name="company_logo">Senception_Logo</string>
<string name="company">Senception</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment