mmathieum / montrealtransit-for-android

MonTransit for Android (OLD) / MonTransit pour Android (ANCIEN)
https://play.google.com/store/apps/details?id=org.montrealtransit.android
7 stars 3 forks source link

API Compatibility Issues #45

Open lilicoding opened 7 years ago

lilicoding commented 7 years ago

Dear developers,

We have recently developed a state-of-the-art static analysis tool for uncovering API compatibility issues in Android apps. Applying this tool to open source apps on F-droid, we have exposed a few instances of compatibility issues and submitting them to development teams for a fix.

For your app, we have found that this project has accessed the following APIs which are available only on an API level higher than the declared minSdkVersion and which are accessed without proper protection. In other words, if those APIs get called at runtime, it will trigger a NoSuchMethodError and thus result in a crash of the running application.

<android.os.StrictMode.VmPolicy.Builder: android.os.StrictMode.VmPolicy.Builder detectAll()>:[9,25] <android.nfc.NfcAdapter: android.nfc.NfcAdapter getDefaultAdapter(android.content.Context)>:[10,25] <android.view.View: void setRotation(float)>:[11,25] <android.nfc.NfcAdapter: void disableForegroundDispatch(android.app.Activity)>:[10,25] <android.os.StrictMode.ThreadPolicy.Builder: android.os.StrictMode.ThreadPolicy.Builder penaltyLog()>:[9,25] <android.nfc.NdefRecord: byte[] getPayload()>:[9,25] <android.app.backup.BackupManager: void dataChanged()>:[8,25] <android.os.StrictMode: void setThreadPolicy(android.os.StrictMode.ThreadPolicy)>:[9,25] <android.app.backup.BackupDataOutput: int writeEntityData(byte[],int)>:[8,25] <android.os.StatFs: long getBlockSizeLong()>:[18,25] <android.os.StrictMode.VmPolicy.Builder: android.os.StrictMode.VmPolicy build()>:[9,25] <android.app.backup.BackupHelper: void writeNewStateDescription(android.os.ParcelFileDescriptor)>:[8,25] <android.os.StrictMode.ThreadPolicy.Builder: android.os.StrictMode.ThreadPolicy.Builder penaltyFlashScreen()>:[11,25] <android.os.StrictMode: void setVmPolicy(android.os.StrictMode.VmPolicy)>:[9,25] <java.lang.String: byte[] getBytes(java.nio.charset.Charset)>:[9,25] <android.app.backup.BackupManager: void (android.content.Context)>:[8,25] <android.os.StrictMode.VmPolicy.Builder: void ()>:[9,25] <android.nfc.NdefRecord: android.nfc.NdefRecord createApplicationRecord(java.lang.String)>:[14,25] <android.os.StrictMode.ThreadPolicy.Builder: android.os.StrictMode.ThreadPolicy build()>:[9,25] <android.app.backup.BackupDataInputStream: java.lang.String getKey()>:[8,25] <android.nfc.NfcAdapter: void enableForegroundDispatch(android.app.Activity,android.app.PendingIntent,android.content.IntentFilter[],java.lang.String[][])>:[10,25] <android.app.backup.BackupDataOutput: int writeEntityHeader(java.lang.String,int)>:[8,25] <android.nfc.NdefMessage: android.nfc.NdefRecord[] getRecords()>:[9,25] <android.nfc.NdefRecord: void (short,byte[],byte[],byte[])>:[9,25] <android.app.backup.BackupAgentHelper: void addHelper(java.lang.String,android.app.backup.BackupHelper)>:[8,25] <android.content.SharedPreferences.Editor: void apply()>:[9,25] <android.os.StrictMode.ThreadPolicy.Builder: android.os.StrictMode.ThreadPolicy.Builder detectAll()>:[9,25] <android.nfc.NdefMessage: void (android.nfc.NdefRecord[])>:[9,25] <android.os.StatFs: long getAvailableBlocksLong()>:[18,25] <android.app.backup.BackupDataInputStream: int size()>:[8,25] <android.os.StrictMode.ThreadPolicy.Builder: void ()>:[9,25] <android.os.StrictMode.VmPolicy.Builder: android.os.StrictMode.VmPolicy.Builder penaltyLog()>:[9,25] <android.widget.LinearLayout: void setDividerDrawable(android.graphics.drawable.Drawable)>:[11,25] <android.widget.SimpleCursorAdapter: void (android.content.Context,int,android.database.Cursor,java.lang.String[],int[],int)>:[11,25] <java.util.concurrent.LinkedBlockingDeque: void (int)>:[9,25] <android.view.Display: int getRotation()>:[8,25]

Note that, because of the nature of the static analysis, we cannot confirm whether the flagged APIs would actually be called at runtime (e.g., unreachable code). However, we still believe that those APIs, which may cause compatibility issues, should not be accessed or at least be accessed with proper protections.

In addition to the aforementioned APIs (i.e., backward-compatibility), which could cause app crashes if accessed, we have also identified that this project has also accessed some APIs that have been removed from the latest public SDK, making the app possibly suffer from forward-compatibility issues.

<android.util.FloatMath: float sqrt(float)>:[1,22] <android.util.FloatMath: float ceil(float)>:[1,22]

We would be very much appreciated if you can acknowledge to us that those reported APIs are indeed problematic for the project’s long-term stability. please let us know if you need any more information relating to this issue report.