Advertisement
playfulgod

Untitled

Mar 26th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.97 KB | None | 0 0
  1. package com.oudhitsquad.oudinfograbber;
  2.  
  3. import java.io.IOException;
  4. import android.os.Bundle;
  5. import android.app.Activity;
  6. import android.graphics.drawable.Drawable;
  7. import android.view.Menu;
  8. import android.view.View;
  9. import android.widget.Button;
  10. public class Main extends Activity {
  11.  
  12.     @Override
  13.     protected void onCreate(Bundle savedInstanceState) {
  14.         super.onCreate(savedInstanceState);
  15.         setContentView(R.layout.main);
  16.    
  17.     final Button button1 = (Button) findViewById(R.id.button1);
  18.     button1.setOnClickListener(new View.OnClickListener() {
  19.        
  20.         public void onClick(View v) {
  21.             try {
  22.                 Runtime.getRuntime().exec("mkdir /sdcard/phone-info");
  23.                 Runtime.getRuntime().exec("cp proc/cmdline sdcard/phone-info/cmdline.txt");
  24.                 Runtime.getRuntime().exec("cp proc/cpuinfo sdcard/phone-info/cpuinfo.txt");
  25.                 Runtime.getRuntime().exec("cp proc/partitions sdcard/phone-info/partitions.txt");
  26.                 Runtime.getRuntime().exec("cp proc/mounts sdcard/phone-info/mounts.txt");
  27.                 Runtime.getRuntime().exec("cp system/build.prop sdcard/phone-info/build.prop");
  28.                 Runtime.getRuntime().exec("chmod 0777 /sdcard/phone-info/*");
  29.                 Runtime.getRuntime().exec("tar -cf sdcard/info.tar /sdcard/phone-info");
  30.                 //Runtime.getRuntime().exec("rm -rf sdcard/phone-info");
  31.             } catch (IOException e) {
  32.                 // TODO Auto-generated catch block
  33.                 e.printStackTrace();
  34.             }
  35.         }
  36.     });
  37.    
  38. final Button button2 = (Button) findViewById(R.id.button2);
  39.  
  40. button2.setOnClickListener(new View.OnClickListener() {
  41.    
  42.     public void onClick(View v) {
  43.         try {
  44.             Runtime.getRuntime().exec("exit");
  45.         } catch (IOException e) {
  46.             // TODO Auto-generated catch block
  47.             e.printStackTrace();
  48.         }
  49.     }
  50.   });
  51. }
  52.     @Override
  53.     public boolean onCreateOptionsMenu(Menu menu) {
  54.         // Inflate the menu; this adds items to the action bar if it is present.
  55.         getMenuInflater().inflate(R.menu.main, menu);
  56.         return true;
  57.     }
  58.    
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement