Bug 456515 - Ring my phone not working
Summary: Ring my phone not working
Status: CONFIRMED
Alias: None
Product: kdeconnect
Classification: Applications
Component: android-application (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-09 14:07 UTC by henrycovili2004
Modified: 2024-02-19 02:04 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description henrycovili2004 2022-07-09 14:07:45 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Install KDE connect from playstore (currenty using beta version 1.19)
2. Enable "Ring my phone plugin" on both linux and android
3. Not working when i try to make the phone ring

OBSERVED RESULT
the phone is not ringing

EXPECTED RESULT
phone should be ringing

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Arch linux, plasma
(available in About System)
KDE Plasma Version: 5.25.2
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.5

ADDITIONAL INFORMATION
adb log when i try to ring the phone:
Ignoring packet with type kdeconnect.findmyphone.request because no plugin can handle it

adb log when i try to activate the plugin (from the android app):
07-09 16:06:04.076 28267 28267 I KDE/addPlugin: Optional Permissions OK SftpPlugin
07-09 16:06:04.077 28267 28267 I KDE/addPlugin: Optional Permissions OK MprisReceiverPlugin
07-09 16:06:04.077 28267 28267 I KDE/addPlugin: Optional Permissions OK SharePlugin
07-09 16:06:04.077 28267 28267 I KDE/addPlugin: Optional Permissions OK BatteryPlugin
07-09 16:06:04.077 28267 28267 I KDE/addPlugin: Optional Permissions OK ConnectivityReportPlugin
07-09 16:06:04.077 28267 28267 I KDE/addPlugin: Optional Permissions OK NotificationsPlugin
07-09 16:06:04.077 28267 28267 I KDE/addPlugin: Optional Permissions OK TelephonyPlugin
07-09 16:06:04.077 28267 28267 I KDE/addPlugin: Optional Permissions OK PhotoPlugin
07-09 16:06:04.077 28267 28267 I KDE/addPlugin: Optional Permissions OK FindRemoteDevicePlugin
07-09 16:06:04.077 28267 28267 I KDE/addPlugin: Optional Permissions OK ClipboardPlugin
07-09 16:06:04.078 28267 28267 I KDE/addPlugin: Optional Permissions OK SMSPlugin
07-09 16:06:04.078 28267 28267 I KDE/addPlugin: Optional Permissions OK PingPlugin
07-09 16:06:04.078 28267 28267 I KDE/addPlugin: Optional Permissions OK SystemVolumePlugin
07-09 16:06:04.078 28267 28267 I KDE/addPlugin: Optional Permissions OK PresenterPlugin
07-09 16:06:04.078 28267 28267 I KDE/addPlugin: Optional Permissions OK RemoteKeyboardPlugin
07-09 16:06:04.078 28267 28267 I KDE/addPlugin: Optional Permissions OK MprisPlugin
07-09 16:06:04.078 28267 28267 I KDE/addPlugin: Optional Permissions OK ContactsPlugin
07-09 16:06:04.078 28267 28267 I KDE/addPlugin: Minimum requirements (e.g. API level) not fulfilled BigscreenPlugin
07-09 16:06:04.078 28267 28267 I KDE/addPlugin: Optional Permissions OK RunCommandPlugin
07-09 16:06:04.078 28267 28267 I KDE/addPlugin: Optional Permissions OK MousePadPlugin
07-09 16:06:04.078 28267 28267 I KDE/addPlugin: Optional Permissions OK MouseReceiverPlugin
07-09 16:06:04.678 28267 28267 I KDE/addPlugin: Optional Permissions OK SftpPlugin
07-09 16:06:04.678 28267 28267 I KDE/addPlugin: Optional Permissions OK MprisReceiverPlugin
07-09 16:06:04.678 28267 28267 I KDE/addPlugin: Optional Permissions OK SharePlugin
07-09 16:06:04.678 28267 28267 I KDE/addPlugin: Optional Permissions OK BatteryPlugin
07-09 16:06:04.678 28267 28267 I KDE/addPlugin: Optional Permissions OK ConnectivityReportPlugin
07-09 16:06:04.678 28267 28267 I KDE/addPlugin: Optional Permissions OK NotificationsPlugin
07-09 16:06:04.678 28267 28267 I KDE/addPlugin: Optional Permissions OK TelephonyPlugin
07-09 16:06:04.678 28267 28267 I KDE/addPlugin: Optional Permissions OK PhotoPlugin
07-09 16:06:04.679 28267 28267 I KDE/addPlugin: Optional Permissions OK FindRemoteDevicePlugin
07-09 16:06:04.679 28267 28267 I KDE/addPlugin: Optional Permissions OK ClipboardPlugin
07-09 16:06:04.679 28267 28267 I KDE/addPlugin: Optional Permissions OK SMSPlugin
07-09 16:06:04.679 28267 28267 I KDE/addPlugin: Optional Permissions OK PingPlugin
07-09 16:06:04.679 28267 28267 I KDE/addPlugin: Optional Permissions OK SystemVolumePlugin
07-09 16:06:04.679 28267 28267 I KDE/addPlugin: Permissions OK FindMyPhonePlugin
07-09 16:06:04.679 28267 28267 I KDE/addPlugin: Optional Permissions OK FindMyPhonePlugin
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity: Exception
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity: java.lang.SecurityException: getDefaultOutgoingPhoneAccount: Neither user 10365 nor current process has android.permission.READ_PRIVILEGED_PHONE_STATE.
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.os.Parcel.createException(Parcel.java:2357)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.os.Parcel.readException(Parcel.java:2340)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.os.Parcel.readException(Parcel.java:2282)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at com.android.internal.telecom.ITelecomService$Stub$Proxy.getUserSelectedOutgoingPhoneAccount(ITelecomService.java:1647)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.telecom.TelecomManager.getUserSelectedOutgoingPhoneAccount(TelecomManager.java:1026)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.media.RingtoneManager.getDefaultPhoneAccountHandle(RingtoneManager.java:900)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.media.RingtoneManager.getCacheForType(RingtoneManager.java:1061)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1066)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1005)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at org.kde.kdeconnect.Plugins.FindMyPhonePlugin.FindMyPhonePlugin.onCreate(FindMyPhonePlugin.java:86)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at org.kde.kdeconnect.Device.addPlugin(Device.java:777)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at org.kde.kdeconnect.Device.reloadPluginsFromSettings(Device.java:825)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at org.kde.kdeconnect.Device.setPluginEnabled(Device.java:804)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at org.kde.kdeconnect.UserInterface.PluginPreference.lambda$onBindViewHolder$1(PluginPreference.java:59)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at org.kde.kdeconnect.UserInterface.PluginPreference.$r8$lambda$VOEueu9AAYrH-VhwlHzwOWcILM8(Unknown Source:0)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at org.kde.kdeconnect.UserInterface.PluginPreference$$ExternalSyntheticLambda1.onClick(Unknown Source:4)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.view.View.performClick(View.java:7448)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.view.View.performClickInternal(View.java:7425)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.view.View.access$3600(View.java:810)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.view.View$PerformClick.run(View.java:28307)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.os.Handler.handleCallback(Handler.java:938)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.os.Handler.dispatchMessage(Handler.java:99)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.os.Looper.loop(Looper.java:223)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.app.ActivityThread.main(ActivityThread.java:7666)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at java.lang.reflect.Method.invoke(Native Method)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity: Caused by: android.os.RemoteException: Remote stack trace:
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.app.ContextImpl.enforce(ContextImpl.java:2018)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:2046)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:851)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at com.android.server.telecom.TelecomServiceImpl.isDialerOrPrivileged(TelecomServiceImpl.java:2242)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity:   at com.android.server.telecom.TelecomServiceImpl.access$400(TelecomServiceImpl.java:75)
07-09 16:06:04.718 28267 28267 E FindMyPhoneActivity: 
07-09 16:06:04.718 28267 28267 V MediaPlayer: resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
07-09 16:06:04.718 28267 28267 V MediaPlayer: cleanDrmObj: mDrmObj=null mDrmSessionId=null
07-09 16:06:04.719 28267 28267 I KDE/addPlugin: Optional Permissions OK PresenterPlugin
07-09 16:06:04.719 28267 28267 I KDE/addPlugin: Optional Permissions OK RemoteKeyboardPlugin
07-09 16:06:04.719 28267 28267 I KDE/addPlugin: Optional Permissions OK MprisPlugin
07-09 16:06:04.719 28267 28267 I KDE/addPlugin: Optional Permissions OK ContactsPlugin
07-09 16:06:04.719 28267 28267 I KDE/addPlugin: Minimum requirements (e.g. API level) not fulfilled BigscreenPlugin
07-09 16:06:04.719 28267 28267 I KDE/addPlugin: Optional Permissions OK RunCommandPlugin
07-09 16:06:04.719 28267 28267 I KDE/addPlugin: Optional Permissions OK MousePadPlugin
07-09 16:06:04.719 28267 28267 I KDE/addPlugin: Optional Permissions OK MouseReceiverPlugin
Comment 1 Joost 2023-01-03 18:10:59 UTC
I am using Android 10 (crDroid 6.12) on rooted phone. 

01-03 18:14:54.705 E/FindMyPhoneActivity(15086): java.lang.SecurityException: getDefaultOutgoingPhoneAccount: Neither user 10303 nor current process has android.permission.READ_PRIVILEGED_PHONE_STATE.

According to the Android developer reference, the method getDefaultOutgoingPhoneAccount does not need this permission. If any phone does require it, then this is likely some bug or enhanced security feature in the (custom) ROM or some magisk/xposed module that is installed.
https://developer.android.com/reference/android/telecom/TelecomManager#getDefaultOutgoingPhoneAccount(java.lang.String)

This means it is not a bug in kdeconnect. 
It is possible though to create a workaround by requesting the required permission if needed, but that would violate playstore rules and then the app cant be published there.
https://developer.android.com/about/versions/10/privacy/changes#non-resettable-device-ids
Comment 2 Albert Vaca Cintora 2023-03-23 17:08:46 UTC
This is super weird because KDE Connect doesn't use `getDefaultOutgoingPhoneAccount`. Even less in the FindMyPhone plugin. Is this still happening to you?
Comment 3 Joost 2023-04-22 09:30:59 UTC
Maybe not so weird. 
Looking at logcat above and the source code here:
https://github.com/KDE/kdeconnect-android/blob/master/src/org/kde/kdeconnect/Plugins/FindMyPhonePlugin/FindMyPhonePlugin.java
what I think is happening:

The onCreate function (line 68) obtains a content-uri to the default ringtone. Then the  uri is opened by the mediaplayer, but it does not simply point to a file, but to a resource within ringtonemanager.java that is trying to obtain the ringtone data and it does not have the permission to do that. 

Perhaps there is a more compatible way to play the default ringtone. For example the second answer here:
https://stackoverflow.com/questions/22503189/how-to-get-current-ringtone-in-android

quote:

>Uri defaultRintoneUri = RingtoneManager.getActualDefaultRingtoneUri(getApplicationContext(), RingtoneManager.TYPE_RINGTONE);
>Ringtone defaultRingtone = RingtoneManager.getRingtone(getApplicationContext(), defaultRintoneUri);
>defaultRingtone.play();

Maybe when I have time I'll play around with that and see if it works on my phone.
Comment 4 dmitrmax 2023-11-30 14:10:26 UTC
Seems that it is a bug in AOSP. Stock firmwares have TelecomService replaced by vendors without this bug. But AOSP-based firmwares (LineageOS, crDroid etc.) suffer from that. I created an issue in AOSP bug tracker. Feel free to look at it and vote for it if you suffer from this: https://issuetracker.google.com/issues/312227037