use of com.moro.mtweaks.services.monitor.Monitor in project MTweaks-KernelAdiutorMOD by morogoku.
the class Control method apply.
private synchronized void apply(String command, String category, String id, final Context context) {
if (context != null) {
if (mProfileMode) {
Log.i(TAG, "Added to profile: " + id);
mProfileCommands.put(id, command);
} else {
Settings settings = new Settings(context);
List<Settings.SettingsItem> items = settings.getAllSettings();
for (int i = 0; i < items.size(); i++) {
if (items.get(i).getId().equals(id) && items.get(i).getCategory().equals(category)) {
settings.delete(i);
}
}
settings.putSetting(category, command, id);
settings.commit();
Log.i(TAG, "saved " + id);
}
}
if (command.startsWith("#"))
return;
RootUtils.runCommand(command);
Log.i(TAG, command);
if (context != null) {
context.bindService(new Intent(context, Monitor.class), new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
try {
IMonitor monitor = IMonitor.Stub.asInterface(iBinder);
monitor.onSettingsChange();
context.unbindService(this);
} catch (RemoteException e) {
e.printStackTrace();
}
}
@Override
public void onServiceDisconnected(ComponentName componentName) {
}
}, Context.BIND_AUTO_CREATE);
}
}
Aggregations