mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-30 05:37:43 +00:00
Merge branch '1.x'
This commit is contained in:
commit
cfcf9d97e7
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.kde.kdeconnect_tp"
|
||||
android:versionCode="1330"
|
||||
android:versionName="1.3.3">
|
||||
android:versionCode="1410"
|
||||
android:versionName="1.4.1">
|
||||
|
||||
<uses-sdk android:minSdkVersion="9"
|
||||
android:targetSdkVersion="22" />
|
||||
@ -23,7 +23,7 @@
|
||||
<uses-permission android:name="android.permission.BATTERY_STATS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" android:required="false" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_SMS" android:required="false" />
|
||||
<!-- <uses-permission android:name="android.permission.SEND_SMS" android:required="false" /> -->
|
||||
<uses-permission android:name="android.permission.SEND_SMS" android:required="false" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
@ -198,6 +198,20 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
|
||||
SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE);
|
||||
boolean isDeviceTrusted = preferences.getBoolean(deviceId, false);
|
||||
|
||||
if (isDeviceTrusted && !SslHelper.isCertificateStored(context, deviceId)) {
|
||||
//Device paired with and old version, we can't use it as we lack the certificate
|
||||
BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(BackgroundService service) {
|
||||
Device device = service.getDevice(deviceId);
|
||||
if (device == null) return;
|
||||
device.unpair();
|
||||
//Retry as unpaired
|
||||
identityPackageReceived(identityPackage, socket, connectionStarted);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Log.i("KDE/LanLinkProvider","Starting SSL handshake with " + identityPackage.getString("deviceName") + " trusted:"+isDeviceTrusted);
|
||||
|
||||
final SSLSocket sslsocket = SslHelper.convertToSslSocket(context, socket, deviceId, isDeviceTrusted, clientMode);
|
||||
@ -249,15 +263,6 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() {
|
||||
@Override
|
||||
public void onServiceStart(BackgroundService service) {
|
||||
Device device = service.getDevice(deviceId);
|
||||
Log.e("LanLinkProvider", "Unpairing "+(device != null));
|
||||
if (device == null) return;
|
||||
device.unpair();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -284,7 +284,6 @@ public class Device implements BaseLink.PackageReceiver {
|
||||
SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE);
|
||||
preferences.edit().remove(deviceId).apply();
|
||||
|
||||
// FIXME : We delete all device info here, but the xml file still persists
|
||||
SharedPreferences devicePreferences = context.getSharedPreferences(deviceId, Context.MODE_PRIVATE);
|
||||
devicePreferences.edit().clear().apply();
|
||||
|
||||
|
@ -131,6 +131,12 @@ public class SslHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCertificateStored(Context context, String deviceId) {
|
||||
SharedPreferences devicePreferences = context.getSharedPreferences(deviceId, Context.MODE_PRIVATE);
|
||||
String cert = devicePreferences.getString("certificate", "");
|
||||
return !cert.isEmpty();
|
||||
}
|
||||
|
||||
public static SSLContext getSslContext(Context context, String deviceId, boolean isDeviceTrusted) {
|
||||
//TODO: Cache
|
||||
try {
|
||||
|
@ -36,6 +36,7 @@ import org.kde.kdeconnect.Plugins.ReceiveNotificationsPlugin.ReceiveNotification
|
||||
import org.kde.kdeconnect.Plugins.RunCommandPlugin.RunCommandPlugin;
|
||||
import org.kde.kdeconnect.Plugins.SftpPlugin.SftpPlugin;
|
||||
import org.kde.kdeconnect.Plugins.SharePlugin.SharePlugin;
|
||||
import org.kde.kdeconnect.Plugins.TelepathyPlugin.TelepathyPlugin;
|
||||
import org.kde.kdeconnect.Plugins.TelephonyPlugin.TelephonyPlugin;
|
||||
|
||||
import java.util.Collections;
|
||||
@ -110,7 +111,6 @@ public class PluginFactory {
|
||||
private static final Map<String, PluginInfo> pluginInfoCache = new TreeMap<>();
|
||||
|
||||
static {
|
||||
//TODO: Use reflection to find all subclasses of Plugin, instead of adding them manually
|
||||
PluginFactory.registerPlugin(TelephonyPlugin.class);
|
||||
PluginFactory.registerPlugin(PingPlugin.class);
|
||||
PluginFactory.registerPlugin(MprisPlugin.class);
|
||||
@ -121,7 +121,7 @@ public class PluginFactory {
|
||||
PluginFactory.registerPlugin(ReceiveNotificationsPlugin.class);
|
||||
PluginFactory.registerPlugin(MousePadPlugin.class);
|
||||
PluginFactory.registerPlugin(SharePlugin.class);
|
||||
//PluginFactory.registerPlugin(TelepathyPlugin.class);
|
||||
PluginFactory.registerPlugin(TelepathyPlugin.class);
|
||||
PluginFactory.registerPlugin(FindMyPhonePlugin.class);
|
||||
PluginFactory.registerPlugin(RunCommandPlugin.class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user