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

Commit 9e259171 authored by Hamad Kadmany's avatar Hamad Kadmany Committed by Linux Build Service Account
Browse files

SystemServer: add WiGig services

WiGig services implement an API for managing wigig wireless
network device, in similar fashion done for WiFi.

The services are not enabled by default.

Change-Id: Iff682ec191cbd4ab3e78837308312ef3fbb7564e
CRs-Fixed: 997364
parent 754b57e2
Loading
Loading
Loading
Loading
+52 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.os.Build;
import android.os.Environment;
import android.os.FactoryTest;
import android.os.FileUtils;
import android.os.IBinder;
import android.os.IPowerManager;
import android.os.Looper;
import android.os.PowerManager;
@@ -99,6 +100,9 @@ import com.android.server.webkit.WebViewUpdateService;
import com.android.server.wm.WindowManagerService;

import dalvik.system.VMRuntime;
import dalvik.system.PathClassLoader;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

import java.io.File;
import java.io.IOException;
@@ -523,6 +527,8 @@ public final class SystemServer {
        ConsumerIrService consumerIr = null;
        MmsServiceBroker mmsService = null;
        HardwarePropertiesManagerService hardwarePropertiesService = null;
        Object wigigP2pService = null;
        Object wigigService = null;

        boolean disableStorage = SystemProperties.getBoolean("config.disable_storage", false);
        boolean disableBluetooth = SystemProperties.getBoolean("config.disable_bluetooth", false);
@@ -543,6 +549,7 @@ public final class SystemServer {
        boolean disableSamplingProfiler = SystemProperties.getBoolean("config.disable_samplingprof",
                false);
        boolean isEmulator = SystemProperties.get("ro.kernel.qemu").equals("1");
        boolean enableWigig = SystemProperties.getBoolean("persist.wigig.enable", false);

        try {
            Slog.i(TAG, "Reading configuration...");
@@ -832,6 +839,31 @@ public final class SystemServer {
                    mSystemServiceManager.startService("com.android.server.wifi.RttService");
                }

                if (enableWigig) {
                    try {
                        Slog.i(TAG, "Wigig Service");
                        PathClassLoader wigigClassLoader =
                                new PathClassLoader("/system/framework/wigig-service.jar",
                                        "/system/lib64:/system/vendor/lib64",
                                        getClass().getClassLoader());
                        Class wigigP2pClass = wigigClassLoader.loadClass(
                            "com.qualcomm.qti.server.wigig.p2p.WigigP2pServiceImpl");
                        Constructor<Class> ctor = wigigP2pClass.getConstructor(Context.class);
                        wigigP2pService = ctor.newInstance(context);
                        Slog.i(TAG, "Successfully loaded WigigP2pServiceImpl class");
                        ServiceManager.addService("wigigp2p", (IBinder) wigigP2pService);

                        Class wigigClass = wigigClassLoader.loadClass(
                            "com.qualcomm.qti.server.wigig.WigigService");
                        ctor = wigigClass.getConstructor(Context.class);
                        wigigService = ctor.newInstance(context);
                        Slog.i(TAG, "Successfully loaded WigigService class");
                        ServiceManager.addService("wigig", (IBinder) wigigService);
                    } catch (Throwable e) {
                        reportWtf("starting WigigService", e);
                    }
                }

                if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_ETHERNET) ||
                    mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)) {
                    mSystemServiceManager.startService(ETHERNET_SERVICE_CLASS);
@@ -1203,6 +1235,26 @@ public final class SystemServer {
        mSystemServiceManager.startBootPhase(SystemService.PHASE_SYSTEM_SERVICES_READY);

        Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeWindowManagerServiceReady");

        // Wigig services are not registered as system services because of class loader
        // limitations, send boot phase notification separately
        if (enableWigig) {
            try {
                Slog.i(TAG, "calling onBootPhase for Wigig Services");
                Class wigigP2pClass = wigigP2pService.getClass();
                Method m = wigigP2pClass.getMethod("onBootPhase", int.class);
                m.invoke(wigigP2pService, new Integer(
                    SystemService.PHASE_SYSTEM_SERVICES_READY));

                Class wigigClass = wigigService.getClass();
                m = wigigClass.getMethod("onBootPhase", int.class);
                m.invoke(wigigService, new Integer(
                    SystemService.PHASE_SYSTEM_SERVICES_READY));
            } catch (Throwable e) {
                reportWtf("Wigig services ready", e);
            }
        }

        try {
            wm.systemReady();
        } catch (Throwable e) {