Search in sources :

Example 6 with ServiceThread

use of com.android.server.ServiceThread in project android_frameworks_base by ResurrectionRemix.

the class NetworkLogger method startNetworkLogging.

boolean startNetworkLogging() {
    Log.d(TAG, "Starting network logging.");
    if (!checkIpConnectivityMetricsService()) {
        // the IIpConnectivityMetrics service should have been present at this point
        Slog.wtf(TAG, "Failed to register callback with IIpConnectivityMetrics.");
        return false;
    }
    try {
        if (mIpConnectivityMetrics.registerNetdEventCallback(mNetdEventCallback)) {
            mHandlerThread = new ServiceThread(TAG, Process.THREAD_PRIORITY_BACKGROUND, /* allowIo */
            false);
            mHandlerThread.start();
            mNetworkLoggingHandler = new NetworkLoggingHandler(mHandlerThread.getLooper(), mDpm);
            mNetworkLoggingHandler.scheduleBatchFinalization();
            mIsLoggingEnabled.set(true);
            return true;
        } else {
            return false;
        }
    } catch (RemoteException re) {
        Slog.wtf(TAG, "Failed to make remote calls to register the callback", re);
        return false;
    }
}
Also used : ServiceThread(com.android.server.ServiceThread) RemoteException(android.os.RemoteException)

Example 7 with ServiceThread

use of com.android.server.ServiceThread in project android_frameworks_base by crdroidandroid.

the class RetailDemoModeService method onStart.

@Override
public void onStart() {
    if (DEBUG) {
        Slog.d(TAG, "Service starting up");
    }
    mHandlerThread = new ServiceThread(TAG, android.os.Process.THREAD_PRIORITY_FOREGROUND, false);
    mHandlerThread.start();
    mHandler = new MainHandler(mHandlerThread.getLooper());
    publishLocalService(RetailDemoModeServiceInternal.class, mLocalService);
}
Also used : ServiceThread(com.android.server.ServiceThread)

Aggregations

ServiceThread (com.android.server.ServiceThread)7 RemoteException (android.os.RemoteException)3