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

Commit d2a3bc09 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Start DpmService (Data Power Manager Service)"

parents cfe6870b 7dacfbee
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -581,6 +581,13 @@ class ServerThread {
                } catch (Throwable e) {
                    reportWtf("starting Service Discovery Service", e);
                }

                try {
                    Slog.i(TAG, "DPM Service");
                    startDpmService(context, connectivity);
                } catch (Throwable e) {
                    reportWtf("starting DpmService", e);
                }
            }

            if (!disableNonCoreServices) {
@@ -1185,6 +1192,34 @@ class ServerThread {
        }
        return true;
    }

    private static final void startDpmService(Context context, ConnectivityService connectivity) {
        try {
            Object dpmObj = null;
            int dpmFeature = SystemProperties.getInt("persist.dpm.feature", 0);
            Slog.i(TAG, "DPM configuration set to " + dpmFeature);

            if (dpmFeature > 0 && dpmFeature < 8) {
                PathClassLoader dpmClassLoader =
                  new PathClassLoader("/system/framework/com.qti.dpmframework.jar",
                                        ClassLoader.getSystemClassLoader());
                Class dpmClass = dpmClassLoader.loadClass("com.qti.dpm.DpmService");
                Constructor dpmConstructor = dpmClass.getConstructor(
                                    new Class[] {Context.class, ConnectivityService.class});
                dpmObj = dpmConstructor.newInstance(context, connectivity);
                try {
                    if(dpmObj != null && (dpmObj instanceof IBinder)) {
                        ServiceManager.addService("dpmservice", (IBinder)dpmObj);
                        Slog.i(TAG, "Created DPM Service");
                    }
                } catch (Exception e) {
                    Slog.i(TAG, "starting DPM Service", e);
                }
            }
        } catch (Throwable e) {
            Slog.i(TAG, "starting DPM Service", e);
        }
    }
}

public class SystemServer {