Skip to content

Commit 73f85db

Browse files
K2GO-438 chore(lint): resolve 3 new lint errors from the compileSdk 35 / AGP 8.8 bump
Add ACCESS_COARSE_LOCATION alongside FINE (CoarseFineLocation), and route two registerReceiver sites through ContextCompat.registerReceiver (UnspecifiedRegisterReceiverFlag).
1 parent 80e489d commit 73f85db

3 files changed

Lines changed: 7 additions & 11 deletions

File tree

‎controller/app/src/main/AndroidManifest.xml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
99
<!-- ADFA-4520: LocalOnlyHotspot requires location at runtime on this targetSdk -->
1010
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
11+
<!-- K2GO-438: Android 12+ lets the user grant COARSE only, so declare it with FINE (CoarseFineLocation). -->
12+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
1113
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
1214
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
1315

‎controller/app/src/main/java/org/appdevforall/k2go/redesign/DashboardDetailFragment.java‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import android.content.Context;
1717
import android.content.Intent;
1818
import android.content.IntentFilter;
19-
import android.os.Build;
2019
import android.os.Bundle;
2120
import android.os.Handler;
2221
import android.os.Looper;
@@ -143,11 +142,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
143142
public void onStart() {
144143
super.onStart();
145144
IntentFilter f = new IntentFilter(DashboardRebuildService.ACTION_STATE);
146-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
147-
requireContext().registerReceiver(rebuildState, f, Context.RECEIVER_NOT_EXPORTED);
148-
} else {
149-
requireContext().registerReceiver(rebuildState, f);
150-
}
145+
ContextCompat.registerReceiver(requireContext(), rebuildState, f,
146+
ContextCompat.RECEIVER_NOT_EXPORTED);
151147
resolveInitialUpdatingState();
152148
}
153149

‎controller/app/src/main/java/org/appdevforall/k2go/update/presentation/UpdateController.java‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
import org.appdevforall.k2go.ui.dialog.BrandDialog;
3232
import androidx.appcompat.app.AppCompatActivity;
33+
import androidx.core.content.ContextCompat;
3334
import androidx.core.content.FileProvider;
3435
import androidx.lifecycle.ViewModelProvider;
3536

@@ -79,11 +80,8 @@ public UpdateController(AppCompatActivity activity) {
7980

8081
public void registerDownloadReceiver() {
8182
IntentFilter filter = new IntentFilter(android.app.DownloadManager.ACTION_DOWNLOAD_COMPLETE);
82-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
83-
activity.registerReceiver(downloadReceiver, filter, Context.RECEIVER_NOT_EXPORTED);
84-
} else {
85-
activity.registerReceiver(downloadReceiver, filter);
86-
}
83+
ContextCompat.registerReceiver(activity, downloadReceiver, filter,
84+
ContextCompat.RECEIVER_NOT_EXPORTED);
8785
}
8886

8987
public void unregisterDownloadReceiver() {

0 commit comments

Comments
 (0)