OSDN Git Service

Add MIPS support
[android-x86/external-koush-Superuser.git] / Superuser / src / com / koushikdutta / superuser / MainActivity.java
index c6b8114..dc14acd 100644 (file)
@@ -67,13 +67,21 @@ public class MainActivity extends BetterListActivity {
         
         return super.onCreateOptionsMenu(menu);
     }
+
+    private String getArch() {
+        String prop = System.getProperty("os.arch");
+        if (prop.contains("x86") || prop.contains("i686") || prop.contains("i386")) {
+            return "x86";
+        } else if (prop.contains("mips")) {
+            return "mips";
+        } else {
+            return "armeabi";
+        }
+    }
     
     File extractSu() throws IOException, InterruptedException {
-        String arch = "armeabi";
-        if (System.getProperty("os.arch").contains("x86") || System.getProperty("os.arch").contains("i686") || System.getProperty("os.arch").contains("i386"))
-            arch = "x86";
         ZipFile zf = new ZipFile(getPackageCodePath());
-        ZipEntry su = zf.getEntry("assets/" + arch + "/su");
+        ZipEntry su = zf.getEntry("assets/" + getArch() + "/su");
         InputStream zin = zf.getInputStream(su);
         File ret = getFileStreamPath("su");
         FileOutputStream fout = new FileOutputStream(ret);
@@ -111,7 +119,7 @@ public class MainActivity extends BetterListActivity {
                     zout.close();
 
                     ZipFile zf = new ZipFile(getPackageCodePath());
-                    ZipEntry ze = zf.getEntry("assets/reboot");
+                    ZipEntry ze = zf.getEntry("assets/" + getArch() + "/reboot");
                     InputStream in;
                     FileOutputStream reboot;
                     StreamUtility.copyStream(in = zf.getInputStream(ze), reboot = openFileOutput("reboot", MODE_PRIVATE));
@@ -245,7 +253,7 @@ public class MainActivity extends BetterListActivity {
     }
     
     // this is intentionally not localized as it will change constantly.
-    private static final String WHATS_NEW = "Recovery installation fixes for some devices.";
+    private static final String WHATS_NEW = "Added support for Android 4.3.";
     protected void doWhatsNew() {
         if (WHATS_NEW.equals(Settings.getString(this, "whats_new")))
             return;