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.core.common.config.CommonConfig; import com.fuying.sn.platform.app.RunningAppManager; public class RemoteService extends Service { private static final String TAG = "RemoteService"; public RemoteService() { } @Override public IBinder onBind(Intent intent) { Log.e(TAG, "onBind: "); return mBinde; } @Override public void onCreate() { super.onCreate(); Log.e(TAG, "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 { if (BuildConfig.VERSION_CODE < 88) { boolean control = RunningAppManager.getInstance().inControlTime(pkg); Log.e(TAG, "inControl: " + control); return control; } else { return false; } } @Override public String getDisableContent(String pkg) throws RemoteException { if (BuildConfig.VERSION_CODE < 88) { String content = RunningAppManager.getInstance().getDisableContent(pkg); if (BuildConfig.DEBUG) { Log.e(TAG, "getDisableContent: " + content); } return content; } else { return "新版本测试"; } } }; }