Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

SDRise.class

By: a guest on Sep 3rd, 2011  |  syntax: Java  |  size: 5.10 KB  |  hits: 79  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package com.android.settings.deviceinfo;
  2.  
  3. import android.app.Activity;
  4. import android.app.AlertDialog;
  5. import android.app.AlertDialog.Builder;
  6. import android.content.DialogInterface;
  7. import android.content.DialogInterface.OnClickListener;
  8. import android.content.Intent;
  9. import android.os.Bundle;
  10. import android.os.Handler;
  11. import android.util.Log;
  12. import java.io.BufferedReader;
  13. import java.io.IOException;
  14. import java.io.InputStream;
  15. import java.io.InputStreamReader;
  16. import java.io.PrintStream;
  17. import java.util.Timer;
  18. import java.util.TimerTask;
  19.  
  20. public class SDRise extends Activity
  21. {
  22.   int code = -1;
  23.   final Handler cwjHandler;
  24.   final Runnable mUpdateResults;
  25.   Thread m_update;
  26.  
  27.   public SDRise()
  28.   {
  29.     Handler localHandler = new Handler();
  30.     this.cwjHandler = localHandler;
  31.     1 local1 = new Runnable()
  32.     {
  33.       public void run()
  34.       {
  35.         SDRise.this.updateUI();
  36.       }
  37.     };
  38.     this.mUpdateResults = local1;
  39.     3 local3 = new Thread()
  40.     {
  41.       public void run()
  42.       {
  43.         try
  44.         {
  45.           localProcess = Runtime.getRuntime().exec("/system/bin/Tgetmem 0x00201018 0x2E6F73C9 6");
  46.           InputStream localInputStream = localProcess.getInputStream();
  47.           InputStreamReader localInputStreamReader = new InputStreamReader(localInputStream);
  48.           BufferedReader localBufferedReader = new BufferedReader(localInputStreamReader);
  49.           while (true)
  50.           {
  51.             String str1 = localBufferedReader.readLine();
  52.             if (str1 == null)
  53.               break;
  54.             System.out.println(str1);
  55.           }
  56.         }
  57.         catch (IOException localInterruptedException)
  58.         {
  59.           localIOException.printStackTrace();
  60.           int i = Log.e("HWY", "Exception in process");
  61.           StringBuilder localStringBuilder1 = new StringBuilder().append("code=");
  62.           int j = SDRise.this.code;
  63.           String str2 = j;
  64.           int k = Log.e("HWY", str2);
  65.           if (localProcess != null)
  66.             localProcess.destroy();
  67.           while (true)
  68.           {
  69.             Intent localIntent1 = new Intent();
  70.             Intent localIntent2 = localIntent1.setAction("android.intent.action.REBOOT");
  71.             Intent localIntent3 = localIntent1.putExtra("nowait", 1);
  72.             Intent localIntent4 = localIntent1.putExtra("interval", 1);
  73.             Intent localIntent5 = localIntent1.putExtra("window", 0);
  74.             SDRise.this.sendBroadcast(localIntent1);
  75.             return;
  76.             try
  77.             {
  78.               SDRise localSDRise = SDRise.this;
  79.               int m = localProcess.waitFor();
  80.               localSDRise.code = m;
  81.               StringBuilder localStringBuilder2 = new StringBuilder().append("code=");
  82.               int n = SDRise.this.code;
  83.               String str3 = n;
  84.               int i1 = Log.e("HWY", str3);
  85.               if (localProcess != null)
  86.                 localProcess.destroy();
  87.             }
  88.             catch (InterruptedException localInterruptedException)
  89.             {
  90.               while (true)
  91.               {
  92.                 localInterruptedException.printStackTrace();
  93.                 int i2 = Log.e("HWY", "InterruptedException in process");
  94.               }
  95.             }
  96.           }
  97.         }
  98.         finally
  99.         {
  100.           Process localProcess;
  101.           StringBuilder localStringBuilder3 = new StringBuilder().append("code=");
  102.           int i3 = SDRise.this.code;
  103.           String str4 = i3;
  104.           int i4 = Log.e("HWY", str4);
  105.           if (localProcess != null)
  106.             localProcess.destroy();
  107.         }
  108.         throw localObject;
  109.       }
  110.     };
  111.     this.m_update = local3;
  112.   }
  113.  
  114.   private void updateUI()
  115.   {
  116.     AlertDialog.Builder localBuilder = new AlertDialog.Builder(this).setTitle(2131297397).setMessage(2131297400);
  117.     4 local4 = new DialogInterface.OnClickListener()
  118.     {
  119.       public void onClick(DialogInterface paramDialogInterface, int paramInt)
  120.       {
  121.         SDRise.this.finish();
  122.       }
  123.     };
  124.     AlertDialog localAlertDialog = localBuilder.setPositiveButton("OK", local4).show();
  125.   }
  126.  
  127.   public void onCreate(Bundle paramBundle)
  128.   {
  129.     super.onCreate(paramBundle);
  130.     setContentView(2130968615);
  131.     this.m_update.start();
  132.     try
  133.     {
  134.       this.m_update.join(2000L);
  135.       Timer localTimer = new Timer();
  136.       2 local2 = new TimerTask()
  137.       {
  138.         public void run()
  139.         {
  140.           if (SDRise.this.code != -1)
  141.             return;
  142.           StringBuilder localStringBuilder = new StringBuilder().append("outtime code=");
  143.           int i = SDRise.this.code;
  144.           String str = i;
  145.           int j = Log.e("HWY", str);
  146.           int k = Log.e("HWY", "update failed");
  147.           Handler localHandler = SDRise.this.cwjHandler;
  148.           Runnable localRunnable = SDRise.this.mUpdateResults;
  149.           boolean bool = localHandler.post(localRunnable);
  150.         }
  151.       };
  152.       localTimer.schedule(local2, 2000L);
  153.       return;
  154.     }
  155.     catch (InterruptedException localInterruptedException)
  156.     {
  157.       while (true)
  158.         int i = Log.e("HWY", "Exception in shell");
  159.     }
  160.   }
  161. }