Skip to content

Commit

Permalink
Merge branch 'master' into reportNonFatals
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham1g5 authored Dec 10, 2024
2 parents 75a6bf3 + 61e12ff commit bf98668
Show file tree
Hide file tree
Showing 24 changed files with 95 additions and 264 deletions.
15 changes: 10 additions & 5 deletions app/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.commcare.dalvik"
xmlns:android="http://schemas.android.com/apk/res/android"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="106"
android:versionName="2.55">
Expand Down Expand Up @@ -38,6 +37,7 @@
<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES"
android:usesPermissionFlags="neverForLocation"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />

<uses-feature
android:name="android.hardware.telephony"
Expand Down Expand Up @@ -304,12 +304,14 @@
android:name="org.commcare.activities.FormRecordListActivity"
android:windowSoftInputMode="adjustResize">
</activity>

<service
android:enabled="true"
android:foregroundServiceType="specialUse"
android:name="org.commcare.services.CommCareSessionService">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Service that maintains an encryption key in memory to securely submit data to the server" />
</service>

<activity
android:launchMode="singleTop"
android:name="org.commcare.activities.FormEntryActivity"
Expand Down Expand Up @@ -372,7 +374,9 @@
<activity android:name="org.commcare.activities.MessageActivity">
</activity>

<receiver android:name="org.commcare.views.notifications.NotificationClearReceiver">
<receiver
android:exported="false"
android:name="org.commcare.views.notifications.NotificationClearReceiver">
</receiver>

<activity
Expand Down Expand Up @@ -560,6 +564,7 @@
Below code removes this receiver's entry from Manifest.
-->
<receiver android:name="io.ona.kujaku.receivers.KujakuNetworkChangeReceiver"
android:exported="false"
tools:node="remove"/>

<!-- The zebra-print-android library is not yet targeting Android 12 and at least one
Expand Down
27 changes: 14 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ configurations {
}

dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'
testImplementation('org.robolectric:robolectric:4.8.2') {
exclude(group: 'org.bouncycastle', module: 'bcprov-jdk15on')
}
Expand All @@ -40,9 +40,9 @@ dependencies {
testImplementation 'androidx.work:work-testing:2.7.1'
testImplementation 'androidx.test.espresso:espresso-core:3.4.0'
testImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.2'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3'
testImplementation 'io.mockk:mockk:1.12.7'
testImplementation 'org.json:json:20140107'
testImplementation 'org.json:json:20231013'
testImplementation project(path: ':commcare-core', configuration: 'testsAsJar')

androidTestImplementation 'androidx.test:runner:1.4.0'
Expand Down Expand Up @@ -121,10 +121,10 @@ dependencies {
exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-accounts'
exclude group: 'io.realm'
}
implementation 'androidx.work:work-runtime:2.7.1'
implementation 'androidx.work:work-runtime-ktx:2.7.1'
implementation 'androidx.work:work-runtime:2.10.0'
implementation 'androidx.work:work-runtime-ktx:2.10.0'

implementation 'com.google.android.play:core:1.10.3'
implementation 'com.google.android.play:app-update:2.1.0'
implementation 'android.arch.lifecycle:common-java8:1.1.1'


Expand All @@ -138,7 +138,7 @@ dependencies {
implementation 'com.appmattus.certificatetransparency:certificatetransparency-android:2.5.4'

// Dependency required for API desugaring
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_minimal:2.0.3'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_minimal:2.1.3'
}

ext {
Expand Down Expand Up @@ -184,7 +184,7 @@ afterEvaluate {
* https://discuss.gradle.org/t/gradle-7-0-seems-to-take-an-overzealous-approach-to-inter-task-dependencies/39656/2
* Gradle 7.0 treats any copy tasks as having an implicit dependencies with each other.
*/
task injectPropertiesIntoFirebaseConfigFile {
tasks.register('injectPropertiesIntoFirebaseConfigFile') {
description = 'Injects properties into the google-services.json file at runtime'

copy {
Expand Down Expand Up @@ -222,7 +222,7 @@ static def getDate() {

android {
namespace 'org.commcare.dalvik'
compileSdk 33
compileSdk 35

lintOptions {
abortOnError false
Expand All @@ -249,7 +249,8 @@ android {

defaultConfig {
minSdkVersion 21
targetSdkVersion 33
targetSdkVersion 34

applicationId 'org.commcare.dalvik'
testNamespace 'org.commcare.dalvik.test'

Expand Down Expand Up @@ -491,7 +492,7 @@ android {
* Download and unpack commcare app associated with 'cc_app_id' into assets
* folder
*/
task downloadCCApp(type: Exec)
tasks.register('downloadCCApp', Exec)

// task configuration phase
downloadCCApp {
Expand Down Expand Up @@ -521,7 +522,7 @@ downloadCCApp {
}


task downloadRestoreFile(type: Exec)
tasks.register('downloadRestoreFile', Exec)

// task configuration phase
downloadRestoreFile {
Expand Down Expand Up @@ -551,7 +552,7 @@ downloadRestoreFile {
}

// dynamically inject commcare app download into standalone build process
tasks.whenTaskAdded { task ->
tasks.configureEach { task ->
if ((task.name == 'processStandaloneDebugResources' ||
task.name == 'processStandaloneReleaseResources') && 'true' == runDownloadScripts) {
task.dependsOn downloadCCApp
Expand Down
10 changes: 9 additions & 1 deletion app/src/org/commcare/activities/CommCareActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.content.DialogInterface;
import android.content.IntentFilter;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.text.Spannable;
import android.util.DisplayMetrics;
Expand Down Expand Up @@ -302,7 +303,14 @@ protected void onResume() {

if (shouldListenToSyncComplete() && isBackgroundSyncEnabled()) {
dataSyncCompleteBroadcastReceiver = new DataSyncCompleteBroadcastReceiver();
registerReceiver(dataSyncCompleteBroadcastReceiver, new IntentFilter(COMMCARE_DATA_UPDATE_ACTION));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(
dataSyncCompleteBroadcastReceiver,
new IntentFilter(COMMCARE_DATA_UPDATE_ACTION), Context.RECEIVER_NOT_EXPORTED);
} else {
registerReceiver(
dataSyncCompleteBroadcastReceiver, new IntentFilter(COMMCARE_DATA_UPDATE_ACTION));
}
}
}

Expand Down
4 changes: 0 additions & 4 deletions app/src/org/commcare/activities/CommCareGraphActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,5 @@ protected void onCreate(Bundle savedInstanceState) {
protected void onDestroy() {
super.onDestroy();
FirebaseAnalyticsUtil.reportGraphViewFullScreenClosed();

String title = getTitle() == null || getTitle().length() == 0 ? "(no title)" : getTitle().toString();
Logger.log(LogTypes.TYPE_GRAPHING,
String.format("End viewing full screen graph for %s", title));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ public void onResumeSessionSafe() {
.findFragmentById(R.id.wifi_manager_fragment);

mReceiver = new WiFiDirectBroadcastReceiver(mManager, fragment);
registerReceiver(mReceiver, mIntentFilter);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(mReceiver, mIntentFilter, Context.RECEIVER_EXPORTED);
} else {
registerReceiver(mReceiver, mIntentFilter);
}

fragment.startReceiver(mManager, mChannel);

Expand Down
12 changes: 10 additions & 2 deletions app/src/org/commcare/activities/FormEntryActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ public void onReceive(Context context, Intent intent) {
IntentFilter filter = new IntentFilter();
filter.addAction(PollSensorAction.XPATH_ERROR_ACTION);
filter.addAction(GeoUtils.ACTION_LOCATION_ERROR);
registerReceiver(mLocationServiceIssueReceiver, filter);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(mLocationServiceIssueReceiver, filter, Context.RECEIVER_NOT_EXPORTED);
} else {
registerReceiver(mLocationServiceIssueReceiver, filter);
}
}

@Override
Expand Down Expand Up @@ -997,7 +1001,11 @@ public void onResumeSessionSafe() {
reportVideoUsageIfAny();

IntentFilter intentFilter = new IntentFilter(PENGING_SYNC_ALERT_ACTION);
registerReceiver(pendingSyncAlertBroadcastReceiver, intentFilter);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(pendingSyncAlertBroadcastReceiver, intentFilter, Context.RECEIVER_NOT_EXPORTED);
} else {
registerReceiver(pendingSyncAlertBroadcastReceiver, intentFilter);
}

// Flag that a background sync shouldn't be triggered when this activity is in the foreground
CommCareApplication.instance().setBackgroundSyncSafe(false);
Expand Down
1 change: 0 additions & 1 deletion app/src/org/commcare/android/javarosa/IntentCallout.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ public Intent generate(EvaluationContext ec) {
}
}
}
Logger.log(LogTypes.TYPE_FORM_ENTRY, "Generated intent for callout: " + i.toString());
return i;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ private void publishStatus() {
if (mAppUpdateState == newState) {
return;
}
Logger.log(LogTypes.TYPE_CC_UPDATE, "Publishing status update to : " + newState.name() + ", from : "
+ (mAppUpdateState != null ? mAppUpdateState.name() : "null"));
mAppUpdateState = newState;
mCallback.run();
}
Expand Down
8 changes: 0 additions & 8 deletions app/src/org/commcare/graph/view/GraphView.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,12 @@ public GraphWebView(Context context) {
protected void onAttachedToWindow() {
super.onAttachedToWindow();
FirebaseAnalyticsUtil.reportGraphViewAttached();

String displayTitle = mTitle == null || "".equals(mTitle) ? "(no title)" : mTitle;
Logger.log(LogTypes.TYPE_GRAPHING,
String.format("Start viewing graph in list for %s", displayTitle));
}

@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
FirebaseAnalyticsUtil.reportGraphViewDetached();

String displayTitle = mTitle == null || "".equals(mTitle) ? "(no title)" : mTitle;
Logger.log(LogTypes.TYPE_GRAPHING,
String.format("End viewing graph in list for %s", displayTitle));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import android.content.IntentFilter
import android.location.Location
import android.location.LocationListener
import android.location.LocationManager
import android.os.Build
import android.os.Bundle
import androidx.annotation.RequiresApi
import org.commcare.utils.GeoUtils

/**
Expand Down Expand Up @@ -47,7 +49,12 @@ class CommCareProviderLocationController(private var mContext: Context?,
mListener?.missingPermissions()
return
}
mContext?.registerReceiver(mReceiver, IntentFilter(LocationManager.PROVIDERS_CHANGED_ACTION))
val intentFilter = IntentFilter(LocationManager.PROVIDERS_CHANGED_ACTION);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
mContext?.registerReceiver(mReceiver, intentFilter, Context.RECEIVER_EXPORTED)
} else {
mContext?.registerReceiver(mReceiver, intentFilter)
}
checkProviderAndRequestLocation()
}

Expand Down
59 changes: 0 additions & 59 deletions app/src/org/commcare/models/encryption/CipherPool.java

This file was deleted.

Loading

0 comments on commit bf98668

Please sign in to comment.