Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace usage of deprecated libs/versions of libs #24

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,25 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.mediarouter:mediarouter:1.0.0'
implementation 'androidx.mediarouter:mediarouter:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
googleImplementation 'com.google.android.gms:play-services-cast:8.1.0'
implementation 'com.sothree.slidinguppanel:library:3.0.0'
implementation 'de.hdodenhof:circleimageview:1.2.1'
implementation 'com.shehabic.droppy:Droppy:0.5.1@aar'
implementation 'org.fourthline.cling:cling-core:2.1.1'
implementation 'org.fourthline.cling:cling-support:2.1.1'
implementation 'org.eclipse.jetty:jetty-server:8.1.16.v20140903'
implementation 'org.eclipse.jetty:jetty-servlet:8.1.16.v20140903'
implementation 'org.eclipse.jetty:jetty-client:8.1.16.v20140903'
implementation 'org.eclipse.jetty:jetty-servlet:9.4.14.v20181114'
implementation 'org.eclipse.jetty:jetty-client:9.4.14.v20181114'
implementation 'javax.servlet:javax.servlet-api:3.1.0'
implementation 'androidx.vectordrawable:vectordrawable:1.0.0'
implementation 'org.jupnp:org.jupnp:3.0.2'
implementation 'org.jupnp:org.jupnp.support:3.0.2'
implementation 'org.jupnp:org.jupnp.android:3.0.2'
androidTestImplementation "androidx.test:runner:1.5.2"
androidTestImplementation "androidx.test:rules:1.5.0"
androidTestImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.7.10'
implementation 'com.esotericsoftware:kryo:5.6.0'
implementation 'androidx.fragment:fragment:1.3.3'
debugImplementation 'org.slf4j:slf4j-api:2.0.11' // For jupnp logging in debug builds
debugImplementation 'uk.uuid.slf4j:slf4j-android:2.0.7-0'
}
Binary file removed app/libs/kryo-2.21-all.jar
Binary file not shown.
9 changes: 5 additions & 4 deletions app/proguard.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@
-dontwarn com.sothree.slidinguppanel.SlidingUpPanelLayout

# DLNA/Cling
-keep class org.fourthline.cling.** { *; }
-keep interface org.fourthline.cling.** { *; }
-keep class org.jupnp.** { *; }
-keep interface org.jupnp.** { *; }
-dontwarn javax.**
-dontwarn org.objectweb.**
-dontwarn org.slf4j.**
-dontwarn org.mortbay.**
-dontwarn org.fourthline.**
-dontwarn org.seamless.**
-dontwarn org.jupnp.**
-dontwarn org.eclipse.**
-dontwarn java.**
-dontwarn org.osgi.framework.**
-dontwarn org.osgi.service.**
-keepattributes *Annotation*, InnerClasses
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package github.daneren2005.dsub.domain;

import java.text.ParseException;

import org.jupnp.model.action.ActionInvocation;
import org.jupnp.model.message.control.ActionResponseMessage;
import org.jupnp.model.meta.Action;
import org.jupnp.transport.impl.SOAPActionProcessorImpl;

import junit.framework.TestCase;

public class JUPNPTest extends TestCase {
public void testParseWithPooledParsers() throws ParseException {
// for context see: https://github.com/jupnp/jupnp/issues/232
SOAPActionProcessorImpl p = new SOAPActionProcessorImpl();
ActionResponseMessage arg1 = new ActionResponseMessage() {
final String body = "<?xml version=\"1.0\" encoding=\"utf-8\"?><s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><u:GetPositionInfoResponse xmlns:u=\"urn:schemas-upnp-org:service:AVTransport:1\"><Track>1</Track><TrackDuration>0</TrackDuration><TrackMetaData>doesn't really matter</TrackMetaData><TrackURI>doesn't really matter</TrackURI><RelTime>0:00:00</RelTime><AbsTime>0:00:00</AbsTime><RelCount>2147483647</RelCount><AbsCount>2147483647</AbsCount></u:GetPositionInfoResponse></s:Body></s:Envelope>";

@Override
public String getActionNamespace() {
System.out.println("GetActionNamespace");
return "GetActionNamespace";
}

@Override
public boolean isBodyNonEmptyString() {
System.out.println("IsBodyNonEmptyString");
return true;
}

@Override
public String getBodyString() {
System.out.println("getBodyString");
return body;
}

@Override
public void setBody(String string) {
System.out.println("setBody");
}
};
ActionInvocation arg2 = new ActionInvocation(new Action("GetPositionInfo", null));
for (int i = 0; i < 20; i++) { // 20 is default pool size
p.readBody(arg1, arg2);
}
System.out.println("--- Crash after this line ---");
p.readBody(arg1, arg2);

}
}
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
</intent-filter>
</service>

<service android:name="org.fourthline.cling.android.AndroidUpnpServiceImpl"/>
<service android:name="org.jupnp.android.AndroidUpnpServiceImpl"/>
<service android:name="github.daneren2005.dsub.service.sync.AuthenticatorService">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import android.os.Parcel;
import android.os.Parcelable;

import org.fourthline.cling.model.meta.Device;
import org.jupnp.model.meta.Device;

/**
* Created by Scott on 11/1/2014.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
import android.util.Log;

import org.eclipse.jetty.util.log.Logger;
import org.fourthline.cling.android.AndroidUpnpService;
import org.fourthline.cling.android.AndroidUpnpServiceImpl;
import org.fourthline.cling.model.action.ActionInvocation;
import org.fourthline.cling.model.message.UpnpResponse;
import org.fourthline.cling.model.meta.Device;
import org.fourthline.cling.model.meta.LocalDevice;
import org.fourthline.cling.model.meta.RemoteDevice;
import org.fourthline.cling.model.meta.StateVariable;
import org.fourthline.cling.model.meta.StateVariableAllowedValueRange;
import org.fourthline.cling.model.types.ServiceType;
import org.fourthline.cling.registry.Registry;
import org.fourthline.cling.registry.RegistryListener;
import org.fourthline.cling.support.renderingcontrol.callback.GetVolume;
import org.jupnp.android.AndroidUpnpService;
import org.jupnp.android.AndroidUpnpServiceImpl;
import org.jupnp.model.action.ActionInvocation;
import org.jupnp.model.message.UpnpResponse;
import org.jupnp.model.meta.Device;
import org.jupnp.model.meta.LocalDevice;
import org.jupnp.model.meta.RemoteDevice;
import org.jupnp.model.meta.StateVariable;
import org.jupnp.model.meta.StateVariableAllowedValueRange;
import org.jupnp.model.types.ServiceType;
import org.jupnp.registry.Registry;
import org.jupnp.registry.RegistryListener;
import org.jupnp.support.renderingcontrol.callback.GetVolume;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -85,6 +85,9 @@ public DLNARouteProvider(Context context) {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
dlnaService = (AndroidUpnpService) service;
// cling to jupnp migration workaround:
// https://github.com/jupnp/jupnp/issues/153#issuecomment-1917832580
dlnaService.get().startup();
dlnaService.getRegistry().addListener(registryListener = new RegistryListener() {
@Override
public void remoteDeviceDiscoveryStarted(Registry registry, RemoteDevice remoteDevice) {
Expand Down Expand Up @@ -213,7 +216,7 @@ public RouteController onCreateRouteController(String routeId) {
}

private void deviceAdded(final Device device) {
final org.fourthline.cling.model.meta.Service renderingControl = device.findService(new ServiceType("schemas-upnp-org", "RenderingControl"));
final org.jupnp.model.meta.Service renderingControl = device.findService(new ServiceType("schemas-upnp-org", "RenderingControl"));
if(renderingControl == null) {
return;
}
Expand Down Expand Up @@ -400,6 +403,11 @@ public void debug(String msg, Object... args) {
// Log.d(TAG, msg);
}

@Override
public void debug(String s, long l) {

}

public Logger getLogger(String name) {
return new JettyAndroidLog(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,39 @@
import android.os.Looper;
import android.util.Log;

import org.fourthline.cling.controlpoint.ActionCallback;
import org.fourthline.cling.controlpoint.ControlPoint;
import org.fourthline.cling.controlpoint.SubscriptionCallback;
import org.fourthline.cling.model.action.ActionInvocation;
import org.fourthline.cling.model.gena.CancelReason;
import org.fourthline.cling.model.gena.GENASubscription;
import org.fourthline.cling.model.message.UpnpResponse;
import org.fourthline.cling.model.meta.Action;
import org.fourthline.cling.model.meta.Service;
import org.fourthline.cling.model.meta.StateVariable;
import org.fourthline.cling.model.state.StateVariableValue;
import org.fourthline.cling.model.types.ServiceType;
import org.fourthline.cling.model.types.UnsignedIntegerFourBytes;
import org.fourthline.cling.support.avtransport.callback.GetPositionInfo;
import org.fourthline.cling.support.avtransport.callback.Pause;
import org.fourthline.cling.support.avtransport.callback.Play;
import org.fourthline.cling.support.avtransport.callback.Seek;
import org.fourthline.cling.support.avtransport.callback.SetAVTransportURI;
import org.fourthline.cling.support.avtransport.callback.Stop;
import org.fourthline.cling.support.avtransport.lastchange.AVTransportLastChangeParser;
import org.fourthline.cling.support.avtransport.lastchange.AVTransportVariable;
import org.fourthline.cling.support.contentdirectory.DIDLParser;
import org.fourthline.cling.support.lastchange.LastChange;
import org.fourthline.cling.support.model.DIDLContent;
import org.fourthline.cling.support.model.DIDLObject;
import org.fourthline.cling.support.model.PositionInfo;
import org.fourthline.cling.support.model.Res;
import org.fourthline.cling.support.model.SeekMode;
import org.fourthline.cling.support.model.item.Item;
import org.fourthline.cling.support.model.item.MusicTrack;
import org.fourthline.cling.support.model.item.VideoItem;
import org.fourthline.cling.support.renderingcontrol.callback.SetVolume;
import org.seamless.util.MimeType;
import org.jupnp.controlpoint.ActionCallback;
import org.jupnp.controlpoint.ControlPoint;
import org.jupnp.controlpoint.SubscriptionCallback;
import org.jupnp.model.action.ActionInvocation;
import org.jupnp.model.gena.CancelReason;
import org.jupnp.model.gena.GENASubscription;
import org.jupnp.model.message.UpnpResponse;
import org.jupnp.model.meta.Action;
import org.jupnp.model.meta.Service;
import org.jupnp.model.meta.StateVariable;
import org.jupnp.model.state.StateVariableValue;
import org.jupnp.model.types.ServiceType;
import org.jupnp.model.types.UnsignedIntegerFourBytes;
import org.jupnp.support.avtransport.callback.GetPositionInfo;
import org.jupnp.support.avtransport.callback.Pause;
import org.jupnp.support.avtransport.callback.Play;
import org.jupnp.support.avtransport.callback.Seek;
import org.jupnp.support.avtransport.callback.SetAVTransportURI;
import org.jupnp.support.avtransport.callback.Stop;
import org.jupnp.support.avtransport.lastchange.AVTransportLastChangeParser;
import org.jupnp.support.avtransport.lastchange.AVTransportVariable;
import org.jupnp.support.contentdirectory.DIDLParser;
import org.jupnp.support.lastchange.LastChange;
import org.jupnp.support.model.DIDLContent;
import org.jupnp.support.model.DIDLObject;
import org.jupnp.support.model.PositionInfo;
import org.jupnp.support.model.Res;
import org.jupnp.support.model.SeekMode;
import org.jupnp.support.model.item.Item;
import org.jupnp.support.model.item.MusicTrack;
import org.jupnp.support.model.item.VideoItem;
import org.jupnp.support.renderingcontrol.callback.SetVolume;
import org.jupnp.util.MimeType;

import java.io.File;
import java.net.URI;
Expand Down Expand Up @@ -266,7 +266,7 @@ public void shutdown() {
try {
controlPoint.execute(new Stop(getTransportService()) {
@Override
public void failure(ActionInvocation invocation, org.fourthline.cling.model.message.UpnpResponse operation, String defaultMessage) {
public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMessage) {
Log.w(TAG, "Stop failed: " + defaultMessage);
}
});
Expand Down Expand Up @@ -374,7 +374,7 @@ public void success(ActionInvocation invocation) {
}

@Override
public void failure(ActionInvocation invocation, org.fourthline.cling.model.message.UpnpResponse operation, String defaultMessage) {
public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMessage) {
Log.w(TAG, "Stop failed before startSong: " + defaultMessage);
startSongRemote(currentPlaying, autoStart, position);
}
Expand Down Expand Up @@ -597,7 +597,7 @@ public void run() {

@Override
public void failure(ActionInvocation actionInvocation, UpnpResponse upnpResponse, String s) {
Log.w(TAG, "Failed to get an update");
Log.w(TAG, "Failed to get an update: " + s);

downloadService.postDelayed(new Runnable() {
@Override
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/java/github/daneren2005/dsub/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public class FileUtil {
private static HashMap<String, MusicDirectory.Entry> entryLookup;

static {
kryo.setRegistrationRequired(false); // Every class will be registered at use time, with
// hope their order of serialization will be consistent, before migration kryo 2.21 -> 5.6.0
// this was default
kryo.register(MusicDirectory.Entry.class);
kryo.register(Indexes.class);
kryo.register(Artist.class);
Expand Down Expand Up @@ -808,7 +811,7 @@ public static <T extends Serializable> boolean serialize(Context context, T obj,
}
return true;
} catch (Throwable x) {
Log.w(TAG, "Failed to serialize object to " + fileName);
Log.w(TAG, "Failed to serialize object to " + fileName, x);
return false;
} finally {
Util.close(out);
Expand Down Expand Up @@ -845,10 +848,10 @@ public static <T extends Serializable> T deserialize(Context context, String fil
}
} catch(FileNotFoundException e) {
// Different error message
Log.w(TAG, "No serialization for object from " + fileName);
Log.w(TAG, "No serialization for object from " + fileName, e);
return null;
} catch (Throwable x) {
Log.w(TAG, "Failed to deserialize object from " + fileName);
Log.w(TAG, "Failed to deserialize object from " + fileName, x);
return null;
} finally {
Util.close(in);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
level=VERBOSE
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools:r8:8.3.37' // this is a workaround for building problems
// if in the future the project builds fine without it, try to remove it
classpath 'com.android.tools.build:gradle:7.4.2'

// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -20,10 +22,6 @@ buildscript {
allprojects {
repositories {
jcenter()
maven {
url 'http://4thline.org/m2'
allowInsecureProtocol = true
}
google()
}
}