Android Open Source - Aegis Root Task






From Project

Back to project page Aegis.

License

The source code is released under:

GNU General Public License

If you think the Android project Aegis listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.decad3nce.aegis;
/*from www  . j  a  v a 2  s. c o  m*/
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import eu.chainfire.libsuperuser.Shell;

import java.util.List;

/**
 *
 */
public class RootTask extends AsyncTask<Void, Void, Void> {
    private ProgressDialog dialog = null;
    public Dialog dialog1 = null;
    private Context context = null;
    private boolean suAvailable = false;
    private String suVersion = null;
    private String suVersionInternal = null;
    private List<String> suResult = null;

    public RootTask setContext(Context context) {
        this.context = context;
        return this;
    }

    @Override
    protected void onPreExecute() {
        dialog = new ProgressDialog(context);
        dialog.setTitle(context.getResources().getString(R.string.app_name));
        dialog.setMessage(context.getResources().getString(R.string.advanced_dialog_installing));
        dialog.setIndeterminate(true);
        dialog.setCancelable(false);
        dialog.show();

        dialog1 = new Dialog(context);
        dialog1.setTitle(context.getResources().getString(R.string.app_name));
        dialog1.setContentView(R.layout.dialog_view);
        dialog1.setCancelable(true);
    }

    @Override
    protected Void doInBackground(Void... params) {
        suAvailable = Shell.SU.available();
        if (suAvailable) {
            suVersion = Shell.SU.version(false);
            suVersionInternal = Shell.SU.version(true);
            suResult = Shell.SU.run(new String[] {
                    "id",
                    "busybox mount -o remount,rw /system",
                    "busybox cp /data/app/com.decad3nce.aegis*.apk /system/app/",
                    "busybox chmod 644 /system/app/com.decad3nce.aegis*.apk",
                    "busybox pm uninstall com.decad3nce.aegis",
                    "busybox rmdir /data/app-lib/com.decad3nce*",
                    "busybox rm /data/app/com.decad3nce.aegis*.apk",
                    "busybox mount -o remount,ro /system",
                    "busybox reboot"
            });
        }

        return null;
    }

    @Override
    protected void onPostExecute(Void result) {
        dialog.dismiss();

        if(!suAvailable) {
            dialog1.show();
        }
    }
}




Java Source Code List

com.decad3nce.aegis.AegisActivity.java
com.decad3nce.aegis.AlarmService.java
com.decad3nce.aegis.BackupDropboxAccountsActivity.java
com.decad3nce.aegis.BackupGoogleAccountsActivity.java
com.decad3nce.aegis.BackupUtils.java
com.decad3nce.aegis.DeviceAdmin.java
com.decad3nce.aegis.DialerCodeReceiver.java
com.decad3nce.aegis.DrawerLayoutAdapter.java
com.decad3nce.aegis.FontAdapter.java
com.decad3nce.aegis.LoginActivity.java
com.decad3nce.aegis.PhoneTrackerActivity.java
com.decad3nce.aegis.RegisterActivity.java
com.decad3nce.aegis.RootTask.java
com.decad3nce.aegis.SIMStateReceiver.java
com.decad3nce.aegis.SMSReceiver.java
com.decad3nce.aegis.Utils.java
com.decad3nce.aegis.WipeBaseActivity.java
com.decad3nce.aegis.WipeTask.java
com.decad3nce.aegis.Fragments.AboutFragment.java
com.decad3nce.aegis.Fragments.AdvancedSettingsFragment.java
com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment.java
com.decad3nce.aegis.Fragments.ChooseBackupProgramDialogFragment.java
com.decad3nce.aegis.Fragments.InstallToSystemDialogFragment.java
com.decad3nce.aegis.Fragments.SIMListFragment.java
com.decad3nce.aegis.Fragments.SMSAlarmFragment.java
com.decad3nce.aegis.Fragments.SMSDataFragment.java
com.decad3nce.aegis.Fragments.SMSLocateFragment.java
com.decad3nce.aegis.Fragments.SMSLockFragment.java
com.decad3nce.aegis.Fragments.SMSWipeFragment.java