Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions uraniborg/AndroidStudioProject/Hubble/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
Comment on lines +20 to +21
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using JavaVersion.VERSION_17 for targetCompatibility with a minSdkVersion of 23 can lead to runtime crashes (such as VerifyError) on older devices (pre-Android 12) because Java 17 bytecode features are not natively supported by older Android runtimes. Since core library desugaring is not enabled in this project, it is safer to use VERSION_11 or ensure that desugaring is configured to handle the higher bytecode version on older ART runtimes.

}
namespace 'com.uraniborg.hubble'
namespace = 'com.uraniborg.hubble'
}

dependencies {
Expand All @@ -32,3 +32,7 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
implementation 'org.jetbrains:annotations:26.1.0'
}

tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private boolean initialize() {
// this allows us to get APEX packages when calling getInstalledPackages
final int MATCH_APEX = 0x40000000;

@SuppressWarnings("deprecation")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The @SuppressWarnings("deprecation") annotation is applied at the method level. This is a broad suppression that can hide other deprecated API usages introduced in the future. It is recommended to apply this annotation as narrowly as possible, such as on the specific variable declaration or statement that triggers the warning (e.g., the getInstalledPackages call).

private void getInstalledPackagesInformation() {
String tag = TAG + "-PKGS";

Expand Down Expand Up @@ -127,6 +128,7 @@ private void getInstalledPackagesInformation() {
Log.d(tag, String.format("There are %d packages (including APEX)", mAllPackages.size()));
}

@SuppressWarnings("deprecation")
private void getAllCertificates() {
final String tag = TAG + "-CERT";
for (String pkgName : mAllPackages.keySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public class PackageMetadata extends BaseInfo {
* @param packageManager A valid {@link PackageManager} object used to load app description.
* @return a valid {@link PackageMetadata} object containing parsed information about the APK.
*/
@SuppressWarnings("deprecation")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Applying @SuppressWarnings("deprecation") to this entire factory method is too broad. Since the method contains significant logic, it is better to localize the suppression to the specific blocks or variables where deprecated APIs (such as PackageInfo.versionCode) are accessed. This ensures that other parts of the method remain subject to compiler checks for deprecations.

static public PackageMetadata parse(Context context, @NotNull PackageInfo packageInfo,
@NotNull PackageManager packageManager) {
PackageMetadata result = new PackageMetadata();
Expand Down Expand Up @@ -494,6 +495,7 @@ public void parseRequestedPermissions() {
* {@link PackageMetadata#permissionsDeclared} field.
* @return <code>true</code> if no errors were encountered. <code>false</code> otherwise.
*/
@SuppressWarnings("deprecation")
public boolean parseDeclaredPermissions() {
final String TAG = "getDeclaredPerms";
PermissionInfo[] perms = ref.permissions;
Expand Down