Bug 926997 - Eliminate toasts from Watcher service, bump version to 1.17; r=wlach

This commit is contained in:
Geoff Brown 2013-10-16 13:47:47 -06:00
parent 517eea6b39
commit 5a20ae1728
2 changed files with 8 additions and 19 deletions

View File

@ -101,7 +101,6 @@ public class RedirOutputThread extends Thread
}
catch (IOException e)
{
// Toast.makeText(SUTAgentAndroid.me.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}

View File

@ -43,13 +43,11 @@ import android.os.PowerManager;
import android.os.RemoteException;
import android.provider.Settings;
import android.util.Log;
import android.view.Gravity;
import android.widget.Toast;
import android.os.Environment;
public class WatcherService extends Service
{
private final String prgVersion = "Watcher Version 1.16";
private final String prgVersion = "Watcher Version 1.17";
private final String LOGTAG = "Watcher";
String sErrorPrefix = "##Installer Error## ";
@ -135,16 +133,16 @@ public class WatcherService extends Service
try {
if (nStayOn != 0) {
if (!Settings.System.putInt(getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN, BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB)) {
doToast("Screen couldn't be set to Always On [stay on while plugged in]");
Log.e(LOGTAG, "Screen couldn't be set to Always On [stay on while plugged in]");
}
}
} catch (Exception e) {
e.printStackTrace();
String sExcept = e.getMessage();
doToast("Screen couldn't be set to Always On [exception " + sExcept + "]");
Log.e(LOGTAG, "Screen couldn't be set to Always On [exception " + sExcept + "]");
}
doToast("WatcherService created");
Log.i(LOGTAG, "WatcherService created");
}
public String GetIniData(String sSection, String sKey, String sFile, String sDefault)
@ -228,7 +226,7 @@ public class WatcherService extends Service
{
if (!this.bStartedTimer)
{
doToast("WatcherService started");
Log.i(LOGTAG, "WatcherService started");
myTimer = new Timer();
Date startSchedule = new Date(System.currentTimeMillis() + lDelay);
myTimer.schedule(new MyTime(), startSchedule, lPeriod);
@ -237,11 +235,11 @@ public class WatcherService extends Service
}
else
{
doToast("WatcherService unknown command");
Log.w(LOGTAG, "WatcherService unknown command");
}
}
else
doToast("WatcherService created");
Log.w(LOGTAG, "WatcherService intent had null command");
}
public void writeVersion() {
@ -280,7 +278,7 @@ public class WatcherService extends Service
@Override
public void onDestroy() {
super.onDestroy();
doToast("WatcherService destroyed");
Log.i(LOGTAG, "WatcherService destroyed");
if (pwl != null)
pwl.release();
stopForegroundCompat(R.string.foreground_service_started);
@ -447,14 +445,6 @@ public class WatcherService extends Service
}
}
public void doToast(String sMsg)
{
Log.i(LOGTAG, sMsg);
Toast toast = Toast.makeText(this, sMsg, Toast.LENGTH_LONG);
toast.setGravity(Gravity.TOP|Gravity.CENTER_HORIZONTAL, 0, 100);
toast.show();
}
public void CheckMem()
{
System.gc();