67 lines
1.9 KiB
Java
67 lines
1.9 KiB
Java
package com.fuying.sn.service;
|
|
|
|
import android.app.Service;
|
|
import android.content.Intent;
|
|
import android.os.IBinder;
|
|
import android.os.RemoteException;
|
|
import android.provider.Settings;
|
|
import android.util.Log;
|
|
|
|
import com.fuying.sn.BuildConfig;
|
|
import com.fuying.sn.IGetInfoInterface;
|
|
import com.fuying.sn.config.CommonConfig;
|
|
import com.fuying.sn.desktop.RunningAppManager;
|
|
|
|
public class RemoteService extends Service {
|
|
private String TAG = RemoteService.class.getSimpleName();
|
|
|
|
public RemoteService() {
|
|
}
|
|
|
|
@Override
|
|
public IBinder onBind(Intent intent) {
|
|
Log.e(TAG, "onBind: ");
|
|
return mBinde;
|
|
}
|
|
|
|
@Override
|
|
public void onCreate() {
|
|
Log.e(TAG, "onCreate: ");
|
|
super.onCreate();
|
|
}
|
|
|
|
@Override
|
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
Log.e(TAG, "onStartCommand: ");
|
|
return super.onStartCommand(intent, flags, startId);
|
|
}
|
|
|
|
private IBinder mBinde = new IGetInfoInterface.Stub() {
|
|
@Override
|
|
public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, double aDouble, String aString) throws RemoteException {
|
|
|
|
}
|
|
|
|
@Override
|
|
public boolean isControl() throws RemoteException {
|
|
int is_control = Settings.System.getInt(getContentResolver(), CommonConfig.KEY_IS_CONTROL, 1);
|
|
Log.e(TAG, "inControlTime: is_control = " + is_control);
|
|
return is_control == 1;
|
|
}
|
|
|
|
@Override
|
|
public boolean inControl(String pkg) throws RemoteException {
|
|
return RunningAppManager.getInstance().inControlTime(pkg);
|
|
}
|
|
|
|
@Override
|
|
public String getDisableContent(String pkg) throws RemoteException {
|
|
String content = RunningAppManager.getInstance().getDisableContent(pkg);
|
|
if (BuildConfig.DEBUG) {
|
|
Log.e(TAG, "getDisableContent: " + content);
|
|
}
|
|
return content;
|
|
}
|
|
};
|
|
}
|