diff --git a/src/org/kde/kdeconnect/Helpers/SMSHelper.java b/src/org/kde/kdeconnect/Helpers/SMSHelper.java index d2342814..7f1f5047 100644 --- a/src/org/kde/kdeconnect/Helpers/SMSHelper.java +++ b/src/org/kde/kdeconnect/Helpers/SMSHelper.java @@ -20,6 +20,7 @@ package org.kde.kdeconnect.Helpers; +import android.annotation.SuppressLint; import android.content.Context; import android.database.ContentObserver; import android.database.Cursor; @@ -43,6 +44,7 @@ import java.util.concurrent.locks.ReentrantLock; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; +@SuppressLint("InlinedApi") public class SMSHelper { /** @@ -94,7 +96,6 @@ public class SMSHelper { * @param threadID Thread to look up * @return List of all messages in the thread */ - @RequiresApi(api = Build.VERSION_CODES.KITKAT) public static List getMessagesInThread(Context context, ThreadID threadID) { final String selection = ThreadID.lookupColumn + " == ?"; final String[] selectionArgs = new String[] { threadID.toString() }; @@ -108,7 +109,6 @@ public class SMSHelper { * @param timestamp epoch in millis matching the timestamp to return * @return null if no matching message is found, otherwise return a Message */ - @RequiresApi(api = Build.VERSION_CODES.KITKAT) public static List getMessagesSinceTimestamp(Context context, long timestamp) { final String selection = Message.DATE + " > ?"; final String[] selectionArgs = new String[] {Long.toString(timestamp)}; @@ -125,7 +125,6 @@ public class SMSHelper { * @param selectionArgs Parameters for selection. May be null. * @return Returns HashMap>, which is transformed in caller functions into other classes. */ - @RequiresApi(api = Build.VERSION_CODES.KITKAT) private static HashMap> getMessages(Uri Uri, Context context, String selection, @@ -171,7 +170,6 @@ public class SMSHelper { * @param selectionArgs Parameters for selection. May be null. * @return List of messages matching the filter */ - @RequiresApi(api = Build.VERSION_CODES.KITKAT) private static List getMessagesWithFilter(Context context, String selection, String[] selectionArgs) { HashMap> result = getMessages(SMSHelper.getSMSUri(), context, selection, selectionArgs); List toReturn = new ArrayList<>(); @@ -189,7 +187,6 @@ public class SMSHelper { * @param context android.content.Context running the request * @return Mapping of thread_id to the first message in each thread */ - @RequiresApi(api = Build.VERSION_CODES.KITKAT) public static Map getConversations(Context context) { HashMap> result = getMessages(SMSHelper.getConversationUri(), context, null, null); HashMap toReturn = new HashMap<>(); @@ -219,7 +216,6 @@ public class SMSHelper { /** * Represent an ID used to uniquely identify a message thread */ - @RequiresApi(api = Build.VERSION_CODES.KITKAT) public static class ThreadID { final Long threadID; static final String lookupColumn = Telephony.Sms.THREAD_ID; @@ -247,7 +243,6 @@ public class SMSHelper { /** * Represent a message and all of its interesting data columns */ - @RequiresApi(api = Build.VERSION_CODES.KITKAT) public static class Message { final String address; diff --git a/src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java b/src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java index d24c1a7c..92e87130 100644 --- a/src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java @@ -22,6 +22,7 @@ package org.kde.kdeconnect.Plugins.SMSPlugin; import android.Manifest; +import android.annotation.SuppressLint; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -65,6 +66,7 @@ import androidx.core.content.ContextCompat; import static org.kde.kdeconnect.Plugins.TelephonyPlugin.TelephonyPlugin.PACKET_TYPE_TELEPHONY; @PluginFactory.LoadablePlugin +@SuppressLint("InlinedApi") public class SMSPlugin extends Plugin { /** @@ -181,7 +183,6 @@ public class SMSPlugin extends Plugin { * In this case, this onChange expects to be called whenever *anything* in the Messages * database changes and simply reports those updated messages to anyone who might be listening */ - @RequiresApi(api = Build.VERSION_CODES.KITKAT) @Override public void onChange(boolean selfChange) { if (mPlugin.mostRecentTimestamp == 0) { @@ -275,7 +276,6 @@ public class SMSPlugin extends Plugin { device.sendPacket(np); } - @RequiresApi(api = Build.VERSION_CODES.KITKAT) @Override public boolean onCreate() { permissionExplanation = R.string.telepathy_permission_explanation; @@ -301,7 +301,6 @@ public class SMSPlugin extends Plugin { return context.getResources().getString(R.string.pref_plugin_telepathy_desc); } - @RequiresApi(api = Build.VERSION_CODES.KITKAT) @Override public boolean onPacketReceived(NetworkPacket np) { @@ -344,7 +343,6 @@ public class SMSPlugin extends Plugin { * @param messages Messages to include in the packet * @return NetworkPacket of type PACKET_TYPE_SMS_MESSAGE */ - @RequiresApi(api = Build.VERSION_CODES.KITKAT) private static NetworkPacket constructBulkMessagePacket(Collection messages) { NetworkPacket reply = new NetworkPacket(PACKET_TYPE_SMS_MESSAGE); @@ -373,7 +371,6 @@ public class SMSPlugin extends Plugin { *

* Send one packet of type PACKET_TYPE_SMS_MESSAGE with the first message in all conversations */ - @RequiresApi(api = Build.VERSION_CODES.KITKAT) private boolean handleRequestConversations(NetworkPacket packet) { Map conversations = SMSHelper.getConversations(this.context); @@ -394,7 +391,6 @@ public class SMSPlugin extends Plugin { return true; } - @RequiresApi(api = Build.VERSION_CODES.KITKAT) private boolean handleRequestConversation(NetworkPacket packet) { SMSHelper.ThreadID threadID = new SMSHelper.ThreadID(packet.getLong("threadID")); @@ -443,6 +439,9 @@ public class SMSPlugin extends Plugin { }; } + /** + * I suspect we can actually go lower than this, but it might get unstable + */ @Override public int getMinSdk() { return Build.VERSION_CODES.KITKAT;