Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3feab1b4 authored by Steven Moreland's avatar Steven Moreland
Browse files

ServiceManagerNative: delete unused methods

This class is never instantiated (and should be deleted in the future),
doesn't need to inherit from anything, and only has one method that is
used (to get an instance of BpServiceManager defined here). Deleting
unused code, and we can delete the class once apps stop linking against
it.

Bug: 135768100
Test: TH
Change-Id: Ie19e099551b10599a4b7bab29b35d78d66cd3442
parent 4507201d
Loading
Loading
Loading
Loading
+7 −68
Original line number Original line Diff line number Diff line
@@ -17,16 +17,18 @@
package android.os;
package android.os;


import android.annotation.UnsupportedAppUsage;
import android.annotation.UnsupportedAppUsage;
import java.util.ArrayList;


import java.util.ArrayList;


/**
/**
 * Native implementation of the service manager.  Most clients will only
 * Native implementation of the service manager.  Most clients will only
 * care about getDefault() and possibly asInterface().
 * care about asInterface().
 *
 * @hide
 * @hide
 */
 */
public abstract class ServiceManagerNative extends Binder implements IServiceManager
public final class ServiceManagerNative {
{
    private ServiceManagerNative() {}

    /**
    /**
     * Cast a Binder object into a service manager interface, generating
     * Cast a Binder object into a service manager interface, generating
     * a proxy if needed.
     * a proxy if needed.
@@ -38,76 +40,13 @@ public abstract class ServiceManagerNative extends Binder implements IServiceMan
            return null;
            return null;
        }
        }
        IServiceManager in =
        IServiceManager in =
            (IServiceManager)obj.queryLocalInterface(descriptor);
                (IServiceManager) obj.queryLocalInterface(IServiceManager.descriptor);
        if (in != null) {
        if (in != null) {
            return in;
            return in;
        }
        }


        return new ServiceManagerProxy(obj);
        return new ServiceManagerProxy(obj);
    }
    }

    public ServiceManagerNative()
    {
        attachInterface(this, descriptor);
    }

    public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
    {
        try {
            switch (code) {
                case IServiceManager.GET_SERVICE_TRANSACTION: {
                    data.enforceInterface(IServiceManager.descriptor);
                    String name = data.readString();
                    IBinder service = getService(name);
                    reply.writeStrongBinder(service);
                    return true;
                }

                case IServiceManager.CHECK_SERVICE_TRANSACTION: {
                    data.enforceInterface(IServiceManager.descriptor);
                    String name = data.readString();
                    IBinder service = checkService(name);
                    reply.writeStrongBinder(service);
                    return true;
                }

                case IServiceManager.ADD_SERVICE_TRANSACTION: {
                    data.enforceInterface(IServiceManager.descriptor);
                    String name = data.readString();
                    IBinder service = data.readStrongBinder();
                    boolean allowIsolated = data.readInt() != 0;
                    int dumpPriority = data.readInt();
                    addService(name, service, allowIsolated, dumpPriority);
                    return true;
                }

                case IServiceManager.LIST_SERVICES_TRANSACTION: {
                    data.enforceInterface(IServiceManager.descriptor);
                    int dumpPriority = data.readInt();
                    String[] list = listServices(dumpPriority);
                    reply.writeStringArray(list);
                    return true;
                }

                case IServiceManager.SET_PERMISSION_CONTROLLER_TRANSACTION: {
                    data.enforceInterface(IServiceManager.descriptor);
                    IPermissionController controller =
                            IPermissionController.Stub.asInterface(
                                    data.readStrongBinder());
                    setPermissionController(controller);
                    return true;
                }
            }
        } catch (RemoteException e) {
        }

        return false;
    }

    public IBinder asBinder()
    {
        return this;
    }
}
}


class ServiceManagerProxy implements IServiceManager {
class ServiceManagerProxy implements IServiceManager {