mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 786414 - unable to update sutagent on the panda boards. r=wlach DONTBUILD
This commit is contained in:
parent
4bc0865dbd
commit
ea4911f41d
@ -107,7 +107,7 @@ public class DoCommand {
|
|||||||
String ffxProvider = "org.mozilla.ffxcp";
|
String ffxProvider = "org.mozilla.ffxcp";
|
||||||
String fenProvider = "org.mozilla.fencp";
|
String fenProvider = "org.mozilla.fencp";
|
||||||
|
|
||||||
private final String prgVersion = "SUTAgentAndroid Version 1.13";
|
private final String prgVersion = "SUTAgentAndroid Version 1.15";
|
||||||
|
|
||||||
public enum Command
|
public enum Command
|
||||||
{
|
{
|
||||||
@ -1335,7 +1335,6 @@ private void CancelNotification()
|
|||||||
}
|
}
|
||||||
if (tmpFile.exists())
|
if (tmpFile.exists())
|
||||||
{
|
{
|
||||||
Log.i("CLINT", "tmpfile exists");
|
|
||||||
return("/data/local");
|
return("/data/local");
|
||||||
}
|
}
|
||||||
Log.e("SUTAgentAndroid", "ERROR: Cannot access world writeable test root");
|
Log.e("SUTAgentAndroid", "ERROR: Cannot access world writeable test root");
|
||||||
@ -3253,69 +3252,9 @@ private void CancelNotification()
|
|||||||
String sRet = "";
|
String sRet = "";
|
||||||
File srcFile = new File(sApp);
|
File srcFile = new File(sApp);
|
||||||
|
|
||||||
sRet = CopyFile(sApp, GetTmpDir() + "/" + srcFile.getName());
|
|
||||||
try {
|
|
||||||
out.write(sRet.getBytes());
|
|
||||||
out.flush();
|
|
||||||
}
|
|
||||||
catch (IOException e1)
|
|
||||||
{
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pProc = Runtime.getRuntime().exec(this.getSuArgs("mv " + GetTmpDir() + "/" +
|
pProc = Runtime.getRuntime().exec(this.getSuArgs("pm install -r " + sApp + " Cleanup;exit"));
|
||||||
srcFile.getName() +
|
|
||||||
" /data/local/tmp/" +
|
|
||||||
srcFile.getName() + ";exit"));
|
|
||||||
|
|
||||||
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
|
|
||||||
outThrd.start();
|
|
||||||
try {
|
|
||||||
outThrd.joinAndStopRedirect(90000);
|
|
||||||
int nRet = pProc.exitValue();
|
|
||||||
sRet = "\nmove complete [" + nRet + "]";
|
|
||||||
}
|
|
||||||
catch (IllegalThreadStateException itse) {
|
|
||||||
itse.printStackTrace();
|
|
||||||
sRet = "\nmove command timed out";
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
out.write(sRet.getBytes());
|
|
||||||
out.flush();
|
|
||||||
}
|
|
||||||
catch (IOException e1)
|
|
||||||
{
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
pProc = Runtime.getRuntime().exec(this.getSuArgs("chmod 666 /data/local/tmp/" +
|
|
||||||
srcFile.getName() + ";exit"));
|
|
||||||
RedirOutputThread outThrd2 = new RedirOutputThread(pProc, out);
|
|
||||||
outThrd2.start();
|
|
||||||
try {
|
|
||||||
outThrd2.joinAndStopRedirect(10000);
|
|
||||||
int nRet2 = pProc.exitValue();
|
|
||||||
sRet = "\npermission change complete [" + nRet2 + "]\n";
|
|
||||||
}
|
|
||||||
catch (IllegalThreadStateException itse) {
|
|
||||||
itse.printStackTrace();
|
|
||||||
sRet = "\npermission change timed out";
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
out.write(sRet.getBytes());
|
|
||||||
out.flush();
|
|
||||||
}
|
|
||||||
catch (IOException e1)
|
|
||||||
{
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
pProc = Runtime.getRuntime().exec(this.getSuArgs("pm install -r /data/local/tmp/" +
|
|
||||||
srcFile.getName() + " Cleanup" +
|
|
||||||
";exit"));
|
|
||||||
RedirOutputThread outThrd3 = new RedirOutputThread(pProc, out);
|
RedirOutputThread outThrd3 = new RedirOutputThread(pProc, out);
|
||||||
outThrd3.start();
|
outThrd3.start();
|
||||||
try {
|
try {
|
||||||
@ -3335,29 +3274,6 @@ private void CancelNotification()
|
|||||||
{
|
{
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
pProc = Runtime.getRuntime().exec(this.getSuArgs("rm /data/local/tmp/" +
|
|
||||||
srcFile.getName() + ";exit"));
|
|
||||||
RedirOutputThread outThrd4 = new RedirOutputThread(pProc, out);
|
|
||||||
outThrd4.start();
|
|
||||||
try {
|
|
||||||
outThrd4.joinAndStopRedirect(60000);
|
|
||||||
int nRet4 = pProc.exitValue();
|
|
||||||
sRet = "\ntmp file removed [" + nRet4 + "]";
|
|
||||||
}
|
|
||||||
catch (IllegalThreadStateException itse) {
|
|
||||||
itse.printStackTrace();
|
|
||||||
sRet = "\nrm command timed out";
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
out.write(sRet.getBytes());
|
|
||||||
out.flush();
|
|
||||||
}
|
|
||||||
catch (IOException e1)
|
|
||||||
{
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
sRet = "\nSuccess";
|
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
@ -402,6 +402,7 @@ public class WatcherService extends Service
|
|||||||
|
|
||||||
public void doToast(String sMsg)
|
public void doToast(String sMsg)
|
||||||
{
|
{
|
||||||
|
Log.i("Watcher", sMsg);
|
||||||
Toast toast = Toast.makeText(this, sMsg, Toast.LENGTH_LONG);
|
Toast toast = Toast.makeText(this, sMsg, Toast.LENGTH_LONG);
|
||||||
toast.setGravity(Gravity.TOP|Gravity.CENTER_HORIZONTAL, 0, 100);
|
toast.setGravity(Gravity.TOP|Gravity.CENTER_HORIZONTAL, 0, 100);
|
||||||
toast.show();
|
toast.show();
|
||||||
@ -716,15 +717,9 @@ public class WatcherService extends Service
|
|||||||
public String UnInstallApp(String sApp, OutputStream out)
|
public String UnInstallApp(String sApp, OutputStream out)
|
||||||
{
|
{
|
||||||
String sRet = "";
|
String sRet = "";
|
||||||
String [] theArgs = new String [3];
|
|
||||||
|
|
||||||
theArgs[0] = "su";
|
|
||||||
theArgs[1] = "-c";
|
|
||||||
theArgs[2] = "pm uninstall " + sApp + ";exit";
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pProc = Runtime.getRuntime().exec(theArgs);
|
pProc = Runtime.getRuntime().exec(this.getSuArgs("pm uninstall " + sApp + ";exit"));
|
||||||
|
|
||||||
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
|
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
|
||||||
outThrd.start();
|
outThrd.start();
|
||||||
@ -745,19 +740,24 @@ public class WatcherService extends Service
|
|||||||
return (sRet);
|
return (sRet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String [] getSuArgs(String cmdString)
|
||||||
|
{
|
||||||
|
String [] theArgs = new String [3];
|
||||||
|
theArgs[0] = "su";
|
||||||
|
theArgs[1] = "-c";
|
||||||
|
// as a security measure, ICS and later resets LD_LIBRARY_PATH. reset
|
||||||
|
// it here when executing the command
|
||||||
|
theArgs[2] = "LD_LIBRARY_PATH=/vendor/lib:/system/lib " + cmdString;
|
||||||
|
return theArgs;
|
||||||
|
}
|
||||||
|
|
||||||
public String InstallApp(String sApp, OutputStream out)
|
public String InstallApp(String sApp, OutputStream out)
|
||||||
{
|
{
|
||||||
String sRet = "";
|
String sRet = "";
|
||||||
String sHold = "";
|
String sHold = "";
|
||||||
String [] theArgs = new String [3];
|
|
||||||
|
|
||||||
theArgs[0] = "su";
|
|
||||||
theArgs[1] = "-c";
|
|
||||||
theArgs[2] = "pm install -r " + sApp + ";exit";
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pProc = Runtime.getRuntime().exec(theArgs);
|
pProc = Runtime.getRuntime().exec(this.getSuArgs("pm install -r " + sApp + " Cleanup;exit"));
|
||||||
|
|
||||||
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
|
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
|
||||||
outThrd.start();
|
outThrd.start();
|
||||||
@ -976,7 +976,8 @@ public class WatcherService extends Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bStartSUTAgent && !GetProcessInfo(sProgramName))
|
boolean isProc = GetProcessInfo(sProgramName);
|
||||||
|
if (bStartSUTAgent && !isProc)
|
||||||
{
|
{
|
||||||
Log.i("SUTAgentWatcher", "Starting SUTAgent from watcher code");
|
Log.i("SUTAgentWatcher", "Starting SUTAgent from watcher code");
|
||||||
Intent agentIntent = new Intent();
|
Intent agentIntent = new Intent();
|
||||||
@ -1014,26 +1015,7 @@ public class WatcherService extends Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void SendNotification(String tickerText, String expandedText) {
|
private void SendNotification(String tickerText, String expandedText) {
|
||||||
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
Log.i("Watcher", expandedText);
|
||||||
int icon = R.drawable.ateamlogo;
|
|
||||||
long when = System.currentTimeMillis();
|
|
||||||
|
|
||||||
Notification notification = new Notification(icon, tickerText, when);
|
|
||||||
|
|
||||||
notification.flags |= Notification.FLAG_AUTO_CANCEL;
|
|
||||||
notification.defaults |= Notification.DEFAULT_SOUND;
|
|
||||||
// notification.defaults |= Notification.DEFAULT_VIBRATE;
|
|
||||||
notification.defaults |= Notification.DEFAULT_LIGHTS;
|
|
||||||
|
|
||||||
Context context = getApplicationContext();
|
|
||||||
|
|
||||||
// Intent to launch an activity when the extended text is clicked
|
|
||||||
Intent intent = new Intent(this, WatcherService.class);
|
|
||||||
PendingIntent launchIntent = PendingIntent.getActivity(context, 0, intent, 0);
|
|
||||||
|
|
||||||
notification.setLatestEventInfo(context, tickerText, expandedText, launchIntent);
|
|
||||||
|
|
||||||
notificationManager.notify(NOTIFICATION_ID, notification);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CancelNotification() {
|
private void CancelNotification() {
|
||||||
|
Loading…
Reference in New Issue
Block a user