Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #207 from denzilferreira/development
Browse files Browse the repository at this point in the history
Sync with development
  • Loading branch information
denzilferreira authored Jul 11, 2017
2 parents b39173a + 9d172e3 commit b5808ae
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 9 deletions.
9 changes: 9 additions & 0 deletions aware-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@
</intent-filter>
</receiver>

<receiver android:name="com.aware.Aware$Aware_Broadcaster"
android:exported="true">
<intent-filter>
<action android:name="ACTION_AWARE_CLEAR_DATA" />
<action android:name="ACTION_AWARE_SYNC_DATA" />
<action android:name="ACTION_QUIT_STUDY" />
</intent-filter>
</receiver>

<!-- Core providers -->
<provider
android:name="com.aware.providers.Scheduler_Provider"
Expand Down
17 changes: 11 additions & 6 deletions aware-core/src/main/java/com/aware/Aware.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ public void onCreate() {
storage.addDataScheme("file");
registerReceiver(storage_BR, storage);

IntentFilter aware_actions = new IntentFilter();
aware_actions.addAction(Aware.ACTION_AWARE_CLEAR_DATA);
aware_actions.addAction(Aware.ACTION_AWARE_SYNC_DATA);
aware_actions.addAction(Aware.ACTION_QUIT_STUDY);
registerReceiver(aware_BR, aware_actions);
//IntentFilter aware_actions = new IntentFilter();
//aware_actions.addAction(Aware.ACTION_AWARE_CLEAR_DATA);
//aware_actions.addAction(Aware.ACTION_AWARE_SYNC_DATA);
//aware_actions.addAction(Aware.ACTION_QUIT_STUDY);
//registerReceiver(aware_BR, aware_actions);

IntentFilter boot = new IntentFilter();
boot.addAction(Intent.ACTION_BOOT_COMPLETED);
Expand Down Expand Up @@ -1717,7 +1717,7 @@ public void onDestroy() {
super.onDestroy();

try {
unregisterReceiver(aware_BR);
//unregisterReceiver(aware_BR);
unregisterReceiver(storage_BR);
unregisterReceiver(awareBoot);
unregisterReceiver(foregroundMgr);
Expand Down Expand Up @@ -2037,6 +2037,8 @@ public void onReceive(Context context, Intent intent) {
public static class Aware_Broadcaster extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {

if (! (context.getPackageName().equals("com.aware.phone") || context.getApplicationContext().getResources().getBoolean(R.bool.standalone))) return;
//We are only synching the device information, study compliance and overall framework execution logs.
String[] DATABASE_TABLES = new String[]{Aware_Provider.DATABASE_TABLES[0], Aware_Provider.DATABASE_TABLES[3], Aware_Provider.DATABASE_TABLES[4]};
String[] TABLES_FIELDS = new String[]{Aware_Provider.TABLES_FIELDS[0], Aware_Provider.TABLES_FIELDS[3], Aware_Provider.TABLES_FIELDS[4]};
Expand Down Expand Up @@ -2138,6 +2140,9 @@ public void onReceive(Context context, Intent intent) {

Intent aware = new Intent(context, Aware.class);
context.startService(aware);
// Start the foreground service only if it's the client or a standalone application
if ((context.getPackageName().equals("com.aware.phone") || context.getApplicationContext().getResources().getBoolean(R.bool.standalone)))
context.sendBroadcast(new Intent(Aware.ACTION_AWARE_PRIORITY_FOREGROUND));
}
if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SHUTDOWN)) {
Aware.debug(context, "phone: off");
Expand Down
6 changes: 6 additions & 0 deletions aware-core/src/main/java/com/aware/utils/Aware_Sensor.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ public int onStartCommand(Intent intent, int flags, int startId) {

PERMISSIONS_OK = true;

//Restores core AWARE service in case it get's killed
if (!Aware.isServiceRunning(getApplicationContext(), Aware.class)) {
Intent aware = new Intent(getApplicationContext(), Aware.class);
startService(aware);
}

if (Aware.getSetting(this, Aware_Preferences.STATUS_WEBSERVICE).equals("true")) {
SSLManager.handleUrl(getApplicationContext(), Aware.getSetting(this, Aware_Preferences.WEBSERVICE_SERVER), true);
}
Expand Down
7 changes: 7 additions & 0 deletions aware-phone/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@
android:label="Join study"
android:launchMode="singleTop"
android:theme="@style/Theme.Aware">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="aware"/>
<data android:scheme="aware-ssl"/>
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.aware.phone.Aware_Client" />
Expand Down
11 changes: 11 additions & 0 deletions aware-phone/src/main/java/com/aware/phone/ui/Aware_Join_Study.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ protected void onCreate(Bundle savedInstanceState) {

study_url = getIntent().getStringExtra(EXTRA_STUDY_URL);

//If we are getting here from an AWARE study link
String scheme = getIntent().getScheme();
if (scheme != null) {
if (Aware.DEBUG) Log.d(Aware.TAG, "AWARE Link detected: " + getIntent().getDataString() + " SCHEME: " + scheme);
if (scheme.equalsIgnoreCase("aware")) {
study_url = getIntent().getDataString().replace("aware://","http://");
} else if (scheme.equalsIgnoreCase("aware-ssl")) {
study_url = getIntent().getDataString().replace("aware-ssl://","https://");
}
}

if (Aware.DEBUG) Log.d(Aware.TAG, "Study URL:" + study_url);

Cursor qry = Aware.getStudy(this, study_url);
Expand Down
4 changes: 2 additions & 2 deletions aware-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':aware-core')
implementation "com.android.support:gridlayout-v7:$support_libs"
implementation "com.android.support:appcompat-v7:$support_libs"
implementation "com.android.support:gridlayout-v7:$support_libs"
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
classpath 'com.android.tools.build:gradle:3.0.0-alpha6'
}
}

Expand Down

0 comments on commit b5808ae

Please sign in to comment.