Commit 13e6f2d2 authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Emergency update to fix Play Store's policy violation

- Make TelephonyPlugin only handle calls and not texts
- Disable SMSPlugin.
- Stop using READ_CALL_LOG permission (for contact names)
parent 34db7f68
......@@ -22,16 +22,19 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!--
FIXME: Disabled because of https://support.google.com/googleplay/android-developer/answer/9047303
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
-->
<application
android:icon="@drawable/icon"
......
......@@ -44,7 +44,6 @@ import org.kde.kdeconnect.Helpers.ContactsHelper;
import org.kde.kdeconnect.Helpers.SMSHelper;
import org.kde.kdeconnect.NetworkPacket;
import org.kde.kdeconnect.Plugins.Plugin;
import org.kde.kdeconnect.Plugins.PluginFactory;
import org.kde.kdeconnect.Plugins.TelephonyPlugin.TelephonyPlugin;
import org.kde.kdeconnect_tp.BuildConfig;
import org.kde.kdeconnect_tp.R;
......@@ -60,7 +59,8 @@ import androidx.core.content.ContextCompat;
import static org.kde.kdeconnect.Plugins.TelephonyPlugin.TelephonyPlugin.PACKET_TYPE_TELEPHONY;
@PluginFactory.LoadablePlugin
//FIXME: Disabled because of https://support.google.com/googleplay/android-developer/answer/9047303
///@PluginFactory.LoadablePlugin
public class SMSPlugin extends Plugin {
/**
......
......@@ -51,14 +51,11 @@ public class TelephonyPlugin extends Plugin {
/**
* Packet used for simple telephony events
* Packet used for simple call events
* <p>
* It contains the key "event" which maps to a string indicating the type of event:
* - "ringing" - A phone call is incoming
* - "missedCall" - An incoming call was not answered
* - "sms" - An incoming SMS message
* - Note: As of this writing (15 May 2018) the SMS interface is being improved and this type of event
* is no longer the preferred way of handling SMS. Use the packets defined by the SMS plugin instead.
* <p>
* Depending on the event, other fields may be defined
*/
......@@ -70,18 +67,9 @@ public class TelephonyPlugin extends Plugin {
* The two possible events used the be to request a message be sent or request the device
* silence its ringer
* <p>
* In case an SMS was being requested, the body was like so:
* { "sendSms": true,
* "phoneNumber": "542904563213",
* "messageBody": "Hi mom!"
* }
* <p>
* In case a ringer muted was requested, the body looked like so:
* { "action": "mute" }
* <p>
* As of 15 May 2018, the SMS interface is being improved. Use the packets defined by the
* SMS plugin instead for SMS events
* <p>
  • @albertvaka Do you want these comments (lines 54-84) removed? As I explained on !31 (closed), I think they're useful to document the old way of doing things in case we see old packets from old desktop installations

  • We can keep them documented, but it may be better to do so in the SMS plugin. Right now those packets are handled there, aren't they? In any case, feel free to re-add it where you see it belongs.

Please register or sign in to reply
* Ringer mute requests are best handled by PACKET_TYPE_TELEPHONY_REQUEST_MUTE
* <p>
* This packet type is retained for backwards-compatibility with old desktop applications,
......@@ -255,9 +243,8 @@ public class TelephonyPlugin extends Plugin {
@Override
public boolean onCreate() {
IntentFilter filter = new IntentFilter("android.provider.Telephony.SMS_RECEIVED");
IntentFilter filter = new IntentFilter(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
filter.setPriority(500);
filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
context.registerReceiver(receiver, filter);
permissionExplanation = R.string.telephony_permission_explanation;
optionalPermissionExplanation = R.string.telephony_optional_permission_explanation;
......@@ -315,7 +302,11 @@ public class TelephonyPlugin extends Plugin {
@Override
public String[] getRequiredPermissions() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return new String[]{Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_SMS, Manifest.permission.READ_CALL_LOG};
return new String[]{
Manifest.permission.READ_PHONE_STATE,
//FIXME: Disabled because of https://support.google.com/googleplay/android-developer/answer/9047303
//Manifest.permission.READ_CALL_LOG
};
} else {
return new String[0];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment