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

Commit 0a987dfd authored by Alexander Ivanov's avatar Alexander Ivanov Committed by Linux Build Service Account
Browse files

server: start cne service

Connectivity Engine (CnE) provides advanced network selection per socket,
reduced signalling traffic, and increased power savings.
The service implements the interface defined by CNEManager which Android
applications may use.

Conflicts:
	services/java/com/android/server/SystemServer.java

Change-Id: I9ffd1f5d60f5e9e185ab482a35b3b07f29a4124c
(cherry picked from commit 3a4e3ba1bc67c460ec3c2fd4ef169ae25e3e69b1)
(cherry picked from commit 1bb0036652318ac8bbecf3e6c810bbc779387c61)
(cherry picked from commit 3c8af4a2546d9b71d113072d680107cb56651e71)
(cherry picked from commit 861a4b062196020bf24a5b3731c717b5b95a7d77)
(cherry picked from commit e3dba9799892f13c5bc2376b81cf5dceae17492c)
parent ae3b72d2
Loading
Loading
Loading
Loading
+33 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2006 The Android Open Source Project
 * Copyright (c) 2012, 2013. The Linux Foundation. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -28,6 +29,7 @@ import android.content.res.Configuration;
import android.media.AudioService;
import android.net.wifi.p2p.WifiP2pService;
import android.os.Environment;
import android.os.IBinder;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
@@ -76,6 +78,9 @@ import java.io.File;
import java.util.Timer;
import java.util.TimerTask;

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

class ServerThread {
    private static final String TAG = "SystemServer";
    private static final String ENCRYPTING_STATE = "trigger_restart_min_framework";
@@ -137,6 +142,7 @@ class ServerThread {
        NetworkStatsService networkStats = null;
        NetworkPolicyManagerService networkPolicy = null;
        ConnectivityService connectivity = null;
        Object cneObj = null;
        WifiP2pService wifiP2p = null;
        WifiService wifi = null;
        NsdService serviceDiscovery= null;
@@ -522,6 +528,32 @@ class ServerThread {
                    reportWtf("starting Connectivity Service", e);
                }

                try {
                    int value = SystemProperties.getInt("persist.cne.feature", 0);
                    if(value > 0) {
                        try {
                            PathClassLoader cneClassLoader =
                                new PathClassLoader("/system/framework/com.quicinc.cne.jar",
                                        ClassLoader.getSystemClassLoader());
                            Class cneClass = cneClassLoader.loadClass("com.quicinc.cne.CNE");
                            Constructor cneConstructor = cneClass.getConstructor
                                (new Class[] {Context.class, Handler.class});
                            cneObj = cneConstructor.newInstance(context, null);
                        } catch (Exception e) {
                            Slog.e(TAG,"Failed to load CNE class", e);
                            cneObj = null;
                            reportWtf("Creating Connectivity Engine Service", e);
                        }
                        if (cneObj != null && (cneObj instanceof IBinder)) {
                            ServiceManager.addService("cneservice", (IBinder)cneObj);
                            Slog.i(TAG, "starting cneservice");
                        }
                    }
                } catch (Throwable e) {
                    Slog.e(TAG,"Loading CNEService failed: ", e);
                    reportWtf("starting Connectivity Engine Service", e);
                }

                try {
                    Slog.i(TAG, "Network Service Discovery Service");
                    serviceDiscovery = NsdService.create(context);