// Path: library/src/main/java/com/oasisfeng/android/util/MultiCatchROECompat.java
// public class MultiCatchROECompat extends RuntimeException {}


import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Application;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Debug;
import android.os.IBinder;
import android.os.IInterface;
import android.util.Log;
import com.oasisfeng.android.util.MultiCatchROECompat;
import java.io.Closeable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
		} catch (final IllegalAccessException e) {
			Log.e(TAG, "Unexpected exception when attaching service.", e);
		} catch (final InvocationTargetException e) {
			throw new RuntimeException(e.getTargetException());
		}
	}

	private static Application getApplication(final Context context) {
		if (context instanceof Activity) return ((Activity) context).getApplication();
		if (context instanceof Service) return ((Service) context).getApplication();
		final Context app_context = context.getApplicationContext();
		if (app_context instanceof Application) return (Application) app_context;
		Log.w(TAG, "Cannot discover application from context " + context);
		return null;
	}

	private static final Map<Class<? extends IInterface>, ServiceRecord> sServices = Collections.synchronizedMap(new HashMap<Class<? extends IInterface>, ServiceRecord>());
	private static final BroadcastReceiver sDummyReceiver = new BroadcastReceiver() { @Override public void onReceive(final Context context, final Intent intent) {}};
	private static final String TAG = "LocalSvc";

	// Method signature: (useless parameters for AIDL service - thread, token, activityManager)
	//   public final void attach(Context context, ActivityThread thread, String className, IBinder token, Application application, Object activityManager)
	private static final Method Service_attach;
	static {
		Method method = null;
		try {
			final Class<?> ActivityThread = Class.forName("android.app.ActivityThread");
			method = Service.class.getDeclaredMethod("attach", Context.class, ActivityThread, String.class,
					IBinder.class, Application.class, Object.class);
			method.setAccessible(true);
// Path: library/src/main/java/com/oasisfeng/android/util/MultiCatchROECompat.java
// public class MultiCatchROECompat extends RuntimeException {}


// Path: library/src/main/java/com/oasisfeng/android/service/LocalAidlServices.java
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Application;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Debug;
import android.os.IBinder;
import android.os.IInterface;
import android.util.Log;
import com.oasisfeng.android.util.MultiCatchROECompat;
import java.io.Closeable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

		} catch (final IllegalAccessException e) {
			Log.e(TAG, "Unexpected exception when attaching service.", e);
		} catch (final InvocationTargetException e) {
			throw new RuntimeException(e.getTargetException());
		}
	}

	private static Application getApplication(final Context context) {
		if (context instanceof Activity) return ((Activity) context).getApplication();
		if (context instanceof Service) return ((Service) context).getApplication();
		final Context app_context = context.getApplicationContext();
		if (app_context instanceof Application) return (Application) app_context;
		Log.w(TAG, "Cannot discover application from context " + context);
		return null;
	}

	private static final Map<Class<? extends IInterface>, ServiceRecord> sServices = Collections.synchronizedMap(new HashMap<Class<? extends IInterface>, ServiceRecord>());
	private static final BroadcastReceiver sDummyReceiver = new BroadcastReceiver() { @Override public void onReceive(final Context context, final Intent intent) {}};
	private static final String TAG = "LocalSvc";

	// Method signature: (useless parameters for AIDL service - thread, token, activityManager)
	//   public final void attach(Context context, ActivityThread thread, String className, IBinder token, Application application, Object activityManager)
	private static final Method Service_attach;
	static {
		Method method = null;
		try {
			final Class<?> ActivityThread = Class.forName("android.app.ActivityThread");
			method = Service.class.getDeclaredMethod("attach", Context.class, ActivityThread, String.class,
					IBinder.class, Application.class, Object.class);
			method.setAccessible(true);
		} catch (final ClassNotFoundException | NoSuchMethodException | MultiCatchROECompat e) {