package com.example.plugina;

import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;

import com.bingo.apkloader.base.ApkBaseService;

public class ServiceA extends ApkBaseService {
    private final static String TAG = "ServiceA";
    private ServiceABinder serviceABinder = new ServiceABinder();

    @Override
    public void onCreate() {
        // TODO Auto-generated method stub
        Log.e(TAG, "onCreate " + this.toString());
        super.onCreate();
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        // TODO Auto-generated method stub
        Log.e(TAG, "onStartCommand " + this.toString());
        return super.onStartCommand(intent, flags, startId);
    }
    @Override
    public IBinder onBind(Intent intent) {
        // TODO Auto-generated method stub
        Log.e(TAG, "onBind");
        return serviceABinder;
    }

    @Override
    public boolean onUnbind(Intent intent) {
        // TODO Auto-generated method stub
        Log.e(TAG, "onUnbind");
        return super.onUnbind(intent);
    }


    private class ServiceABinder extends Binder implements ServiceABinderInterface{
        @Override
        public int sum(int a, int b) {
            // TODO Auto-generated method stub
            return a + b;
        }

        @Override
        public String hello() {
            return Man.stringFromJNI();
        }
    }
}
