android: readParcelable compatibility.

This commit is contained in:
Cory McWilliams 2024-09-29 08:18:46 -04:00
parent bce263a928
commit fabdfb76b9
2 changed files with 8 additions and 3 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unprompted.tildefriends" package="com.unprompted.tildefriends"
android:versionCode="27" android:versionCode="28"
android:versionName="0.0.23"> android:versionName="0.0.24-wip">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<application <application

View File

@ -41,7 +41,7 @@ public class TildeFriendsSandboxService extends Service {
@Override @Override
protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) { protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) {
if (code == START_CALL) { if (code == START_CALL) {
ParcelFileDescriptor pfd = data.readParcelable(ParcelFileDescriptor.class.getClassLoader(), ParcelFileDescriptor.class); ParcelFileDescriptor pfd = read_pfd(data);
if (pfd != null) { if (pfd != null) {
Log.w("tildefriends", "fd is " + pfd.getFd()); Log.w("tildefriends", "fd is " + pfd.getFd());
start_thread(pfd.detachFd()); start_thread(pfd.detachFd());
@ -56,4 +56,9 @@ public class TildeFriendsSandboxService extends Service {
} }
}; };
} }
@SuppressWarnings("deprecation")
static private ParcelFileDescriptor read_pfd(Parcel data) {
return data.readParcelable(ParcelFileDescriptor.class.getClassLoader());
}
} }