├── .gitignore
├── .navigation
└── app
│ └── raw
│ └── main.nvg.xml
├── LICENSE
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── org
│ │ └── efidroid
│ │ └── efidroidmanager
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── armeabi-v7a
│ │ │ └── busybox
│ ├── java
│ │ └── org
│ │ │ └── efidroid
│ │ │ └── efidroidmanager
│ │ │ ├── AppConstants.java
│ │ │ ├── DataHelper.java
│ │ │ ├── RootToolsEx.java
│ │ │ ├── Util.java
│ │ │ ├── activities
│ │ │ ├── AboutActivity.java
│ │ │ ├── GenericProgressActivity.java
│ │ │ ├── MainActivity.java
│ │ │ ├── NotificationReceiverActivity.java
│ │ │ └── OperatingSystemEditActivity.java
│ │ │ ├── fragments
│ │ │ ├── EmptyFragment.java
│ │ │ ├── InstallFragment.java
│ │ │ ├── InstallStatusRecyclerViewAdapter.java
│ │ │ ├── OperatingSystemFragment.java
│ │ │ ├── OperatingSystemRecyclerViewAdapter.java
│ │ │ └── operatingsystemedit
│ │ │ │ ├── GeneralFragment.java
│ │ │ │ ├── PartitionItemFragment.java
│ │ │ │ ├── PartitionItemRecyclerViewAdapter.java
│ │ │ │ ├── ReplacementItemFragment.java
│ │ │ │ └── ReplacementItemRecyclerViewAdapter.java
│ │ │ ├── models
│ │ │ ├── DeviceInfo.java
│ │ │ ├── FSTab.java
│ │ │ ├── MountInfo.java
│ │ │ └── OperatingSystem.java
│ │ │ ├── services
│ │ │ ├── GenericProgressIntentService.java
│ │ │ └── IntentServiceEx.java
│ │ │ ├── tasks
│ │ │ ├── EFIDroidInstallServiceTask.java
│ │ │ ├── EFIDroidUninstallServiceTask.java
│ │ │ ├── OSRemovalProgressServiceTask.java
│ │ │ └── OSUpdateProgressServiceTask.java
│ │ │ ├── types
│ │ │ ├── ArgbEvaluator.java
│ │ │ ├── CommandEx.java
│ │ │ ├── FABListener.java
│ │ │ ├── FSTabEntry.java
│ │ │ ├── InstallationEntry.java
│ │ │ ├── InstallationStatus.java
│ │ │ ├── MountEntry.java
│ │ │ ├── OSEditFragmentInteractionListener.java
│ │ │ ├── Pointer.java
│ │ │ ├── ProgressReceiver.java
│ │ │ ├── ProgressServiceTask.java
│ │ │ ├── ReturnCodeException.java
│ │ │ ├── RootFileChooserDialog.java
│ │ │ └── SystemPropertiesProxy.java
│ │ │ └── view
│ │ │ ├── CustomViewPager.java
│ │ │ └── ProgressCircle.java
│ └── res
│ │ ├── anim
│ │ ├── abc_slide_in_bottom_full.xml
│ │ ├── abc_slide_in_left_full.xml
│ │ ├── abc_slide_in_right_full.xml
│ │ ├── abc_slide_out_bottom_full.xml
│ │ ├── abc_slide_out_left_full.xml
│ │ ├── abc_slide_out_right_full.xml
│ │ └── hold.xml
│ │ ├── drawable-v21
│ │ ├── ic_menu_camera.xml
│ │ ├── ic_menu_gallery.xml
│ │ ├── ic_menu_manage.xml
│ │ ├── ic_menu_send.xml
│ │ ├── ic_menu_share.xml
│ │ ├── ic_menu_slideshow.xml
│ │ └── ripple.xml
│ │ ├── drawable
│ │ ├── activatable_item_background.xml
│ │ ├── efidroid.xml
│ │ ├── ic_action_cancel.xml
│ │ ├── ic_action_delete.xml
│ │ ├── ic_action_done.xml
│ │ ├── ic_action_refresh.xml
│ │ ├── ic_dialog_add.xml
│ │ ├── ic_menu_archive.xml
│ │ ├── ic_menu_bug_report.xml
│ │ ├── ic_menu_color_lens.xml
│ │ ├── ic_menu_extension.xml
│ │ ├── ic_menu_hospital.xml
│ │ ├── ic_menu_info.xml
│ │ ├── ic_menu_info_outline.xml
│ │ ├── ic_menu_memory.xml
│ │ ├── ic_menu_settings.xml
│ │ ├── md_circle.xml
│ │ ├── side_nav_bar.xml
│ │ └── tablayout_background_transition.xml
│ │ ├── layout
│ │ ├── activity_about.xml
│ │ ├── activity_main.xml
│ │ ├── activity_operating_system_edit.xml
│ │ ├── activity_osupdate_progress.xml
│ │ ├── app_bar_main.xml
│ │ ├── content_about.xml
│ │ ├── content_main.xml
│ │ ├── dialog_edit_partition.xml
│ │ ├── dialog_new_cmdline.xml
│ │ ├── divider.xml
│ │ ├── efidroid_simple_spinner_dropdown_item.xml
│ │ ├── fragment_general.xml
│ │ ├── fragment_install.xml
│ │ ├── fragment_operating_system_edit.xml
│ │ ├── fragment_operatingsystem_item.xml
│ │ ├── fragment_operatingsystem_list.xml
│ │ ├── fragment_partitionitem.xml
│ │ ├── fragment_partitionitem_list.xml
│ │ ├── fragment_replacemenitem.xml
│ │ ├── fragment_replacemenitem_header.xml
│ │ ├── fragment_replacemenitem_list.xml
│ │ ├── nav_header_main.xml
│ │ └── toolbar_layout_install.xml
│ │ ├── menu
│ │ ├── actionmode_operatingsystemedit.xml
│ │ ├── activity_main_drawer.xml
│ │ ├── activity_operatingsystemedit.xml
│ │ └── fragment_install.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── arrays.xml
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── drawables.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── org
│ └── efidroid
│ └── efidroidmanager
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── sub_projects
├── RootShell
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── rootshell
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── stericson
│ │ │ └── rootshell
│ │ │ ├── NativeJavaClass.java
│ │ │ ├── RootShell.java
│ │ │ ├── SanityCheckRootShell.java
│ │ │ ├── containers
│ │ │ └── RootClass.java
│ │ │ ├── exceptions
│ │ │ └── RootDeniedException.java
│ │ │ └── execution
│ │ │ ├── Command.java
│ │ │ ├── JavaCommand.java
│ │ │ └── Shell.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── example
│ └── rootshell
│ └── ExampleUnitTest.java
└── RootTools
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
├── androidTest
└── java
│ └── com
│ └── example
│ └── roottools
│ └── ApplicationTest.java
├── main
├── AndroidManifest.xml
├── java
│ └── com
│ │ └── stericson
│ │ └── roottools
│ │ ├── Constants.java
│ │ ├── RootTools.java
│ │ ├── SanityCheckRootTools.java
│ │ ├── containers
│ │ ├── Mount.java
│ │ ├── Permissions.java
│ │ └── Symlink.java
│ │ └── internal
│ │ ├── Installer.java
│ │ ├── InternalVariables.java
│ │ ├── Remounter.java
│ │ ├── RootToolsInternalMethods.java
│ │ └── Runner.java
└── res
│ └── values
│ └── strings.xml
└── test
└── java
└── com
└── example
└── roottools
└── ExampleUnitTest.java
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/.navigation/app/raw/main.nvg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
10 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | static def gitRevision() {
4 | def cmd = "git rev-parse --short HEAD"
5 | return cmd.execute().text.trim()
6 | }
7 |
8 | static def gitDirty() {
9 | def cmd = "git diff-index --name-only HEAD"
10 | if(cmd.execute().text.trim().length()>0)
11 | return "-dirty";
12 | return "";
13 | }
14 |
15 | android {
16 | compileSdkVersion 25
17 | buildToolsVersion "25.0.2"
18 | defaultConfig {
19 | applicationId "org.efidroid.efidroidmanager"
20 | minSdkVersion 15
21 | targetSdkVersion 25
22 | versionCode 5
23 | versionName "1.0-g${gitRevision()}${gitDirty()}"
24 |
25 | buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
26 | buildConfigField "String", "USERNAME", "\""+System.getProperty("user.name")+"\""
27 | buildConfigField "String", "HOSTNAME", "\""+InetAddress.getLocalHost().getHostName()+"\""
28 | }
29 | buildTypes {
30 | release {
31 | minifyEnabled false
32 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
33 | }
34 | debug {
35 | applicationIdSuffix ".debug"
36 | versionNameSuffix "-debug"
37 | }
38 | }
39 | }
40 |
41 | dependencies {
42 | compile fileTree(dir: 'libs', include: ['*.jar'])
43 | testCompile 'junit:junit:4.12'
44 | compile('com.github.afollestad.material-dialogs:core:0.8.5.6@aar') {
45 | transitive = true
46 | }
47 | compile('com.github.afollestad.material-dialogs:commons:0.8.5.6@aar') {
48 | transitive = true
49 | }
50 | compile 'com.android.support:appcompat-v7:25.3.1'
51 | compile 'com.android.support:design:25.3.1'
52 | compile 'com.android.support:support-v4:25.3.1'
53 | compile 'com.android.support:recyclerview-v7:25.3.1'
54 | compile 'com.mcxiaoke.volley:library:1.0.19'
55 | compile 'org.ini4j:ini4j:0.5.4'
56 | compile 'commons-io:commons-io:2.5'
57 | compile 'com.melnykov:floatingactionbutton:1.3.0'
58 | compile project(':sub_projects:RootTools')
59 | }
60 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /home/m1cha/Android/Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/org/efidroid/efidroidmanager/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
14 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
28 |
29 |
32 |
35 |
36 |
37 |
40 |
44 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/assets/armeabi-v7a/busybox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/efidroid/android_app_efidroidmanager/9d797ac9d072ac6316e04c341c800f736cfdbbac/app/src/main/assets/armeabi-v7a/busybox
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/AppConstants.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager;
2 |
3 | import android.content.Context;
4 | import android.os.Build;
5 | import android.text.TextUtils;
6 |
7 | import org.efidroid.efidroidmanager.models.DeviceInfo;
8 | import org.efidroid.efidroidmanager.types.SystemPropertiesProxy;
9 |
10 | public final class AppConstants {
11 | private static final String URL_EFIDROID_SERVER = "https://raw.githubusercontent.com/efidroid";
12 |
13 | public static final String DEVICE_NAME = Build.MANUFACTURER.toLowerCase() + "/" + Build.DEVICE.toLowerCase();
14 | public static final String SHAREDPREFS_GLOBAL = "org.efidroid.efidroidmanager";
15 | public static final String SHAREDPREFS_GLOBAL_LAST_DEVICEINFO_UPDATE = "last_deviceinfo_update";
16 | public static final String SHAREDPREFS_GLOBAL_LAST_APP_VERSION = "last_app_version";
17 |
18 | public static final String PATH_INTERNAL_DEVICES = "devices.json";
19 | public static final String PATH_INTERNAL_FSTAB = "fstab.multiboot";
20 |
21 | private static String getUrlServer(Context context) {
22 | String url = SystemPropertiesProxy.get(context, "efidroid.server_url", "");
23 | if (TextUtils.isEmpty(url))
24 | url = URL_EFIDROID_SERVER;
25 |
26 | return url;
27 | }
28 |
29 | public static String getUrlOta(Context context) {
30 | return getUrlServer(context) + "/ota/master";
31 | }
32 |
33 | public static String getUrlDeviceList(Context context) {
34 | return getUrlOta(context) + "/devices.json";
35 | }
36 |
37 | public static String getUrlDeviceRepo(Context context, DeviceInfo deviceInfo) {
38 | return getUrlServer(context) + "/device/" + deviceInfo.getDeviceName();
39 | }
40 |
41 | public static String getUrlDeviceFsTab(Context context, DeviceInfo deviceInfo) {
42 | return getUrlDeviceRepo(context, deviceInfo) + "/fstab.multiboot";
43 | }
44 |
45 | public static String getUrlUpdates(Context context, DeviceInfo deviceInfo) {
46 | return getUrlOta(context) + "/" + deviceInfo.getDeviceName() + "/info.json";
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/activities/AboutActivity.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.activities;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.FloatingActionButton;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.support.v7.widget.Toolbar;
7 | import android.view.MenuItem;
8 | import android.view.View;
9 | import android.widget.TextView;
10 |
11 | import org.efidroid.efidroidmanager.BuildConfig;
12 | import org.efidroid.efidroidmanager.R;
13 |
14 | import java.text.DateFormat;
15 |
16 | public class AboutActivity extends AppCompatActivity {
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_about);
22 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
23 | setSupportActionBar(toolbar);
24 |
25 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
26 | fab.setVisibility(View.GONE);
27 | if (getSupportActionBar() != null)
28 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
29 |
30 | TextView textVersion = (TextView) findViewById(R.id.textVersion);
31 | textVersion.setText(getString(R.string.app_version, BuildConfig.VERSION_NAME));
32 |
33 | DateFormat format = DateFormat.getDateTimeInstance();
34 | TextView textBuildinfo = (TextView) findViewById(R.id.textBuildInfo);
35 | textBuildinfo.setText(getString(R.string.compiled_by, BuildConfig.USERNAME, BuildConfig.HOSTNAME, format.format(BuildConfig.TIMESTAMP)));
36 | }
37 |
38 | @Override
39 | public boolean onOptionsItemSelected(MenuItem item) {
40 | switch (item.getItemId()) {
41 | case android.R.id.home:
42 | finish();
43 | return true;
44 | default:
45 | return super.onOptionsItemSelected(item);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/activities/NotificationReceiverActivity.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.activities;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import org.efidroid.efidroidmanager.services.GenericProgressIntentService;
7 |
8 | public class NotificationReceiverActivity extends AppCompatActivity {
9 |
10 | public static final String ARG_NOTIFICATION_ID = "notification_id";
11 | public static final String ARG_SERVICE_CLASS = "service_class";
12 | public static final int NOTIFICATION_ID_OP_UPDATE_SERVICE = 1;
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 |
18 | switch (getIntent().getIntExtra(ARG_NOTIFICATION_ID, -1)) {
19 | case NOTIFICATION_ID_OP_UPDATE_SERVICE:
20 | GenericProgressIntentService.handleNotificationIntent(this, (Class>) getIntent().getSerializableExtra(ARG_SERVICE_CLASS));
21 | }
22 |
23 | finish();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/fragments/EmptyFragment.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.fragments;
2 |
3 | import android.support.v4.app.Fragment;
4 |
5 | public class EmptyFragment extends Fragment {
6 | public EmptyFragment() {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/fragments/InstallStatusRecyclerViewAdapter.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.fragments;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.drawable.Drawable;
6 | import android.os.AsyncTask;
7 | import android.support.v4.content.res.ResourcesCompat;
8 | import android.support.v7.widget.RecyclerView;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.ImageView;
13 | import android.widget.TextView;
14 |
15 | import org.efidroid.efidroidmanager.R;
16 | import org.efidroid.efidroidmanager.models.OperatingSystem;
17 |
18 | import java.util.List;
19 |
20 | /**
21 | * {@link RecyclerView.Adapter} that can display a {@link OperatingSystem} and makes a call to the
22 | * specified {@link OperatingSystemFragment.OnOperatingSystemFragmentInteractionListener}.
23 | */
24 | public class InstallStatusRecyclerViewAdapter extends RecyclerView.Adapter {
25 |
26 | private final List- mValues;
27 |
28 | public static class Item {
29 | public String title;
30 | public String subtitle;
31 |
32 | public Item(String title, String subtitle) {
33 | this.title = title;
34 | this.subtitle = subtitle;
35 | }
36 | }
37 |
38 | public InstallStatusRecyclerViewAdapter(List
- items) {
39 | mValues = items;
40 | }
41 |
42 | @Override
43 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
44 | View view = LayoutInflater.from(parent.getContext())
45 | .inflate(R.layout.fragment_replacemenitem, parent, false);
46 |
47 | return new ViewHolder(view);
48 | }
49 |
50 | @Override
51 | public void onBindViewHolder(final ViewHolder holder, int position) {
52 | Item item = mValues.get(position);
53 |
54 | holder.mItem = item;
55 | holder.mTitleView.setText(item.title);
56 |
57 | if (item.subtitle != null && item.subtitle.length() > 0) {
58 | holder.mSubtitleView.setText(item.subtitle);
59 | holder.mSubtitleView.setVisibility(View.VISIBLE);
60 | } else {
61 | holder.mSubtitleView.setVisibility(View.GONE);
62 | }
63 | }
64 |
65 | @Override
66 | public int getItemCount() {
67 | return mValues.size();
68 | }
69 |
70 | public class ViewHolder extends RecyclerView.ViewHolder {
71 | public final View mView;
72 | public final TextView mTitleView;
73 | public final TextView mSubtitleView;
74 | public Item mItem;
75 |
76 | public ViewHolder(View view) {
77 | super(view);
78 | mView = view;
79 | mTitleView = (TextView) view.findViewById(R.id.text);
80 | mSubtitleView = (TextView) view.findViewById(R.id.text2);
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/fragments/OperatingSystemFragment.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.fragments;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.annotation.NonNull;
7 | import android.support.design.widget.AppBarLayout;
8 | import android.support.design.widget.CoordinatorLayout;
9 | import android.support.v4.app.Fragment;
10 | import android.support.v4.content.res.ResourcesCompat;
11 | import android.support.v7.widget.LinearLayoutManager;
12 | import android.support.v7.widget.RecyclerView;
13 | import android.view.Gravity;
14 | import android.view.LayoutInflater;
15 | import android.view.View;
16 | import android.view.ViewGroup;
17 |
18 | import com.afollestad.materialdialogs.DialogAction;
19 | import com.afollestad.materialdialogs.MaterialDialog;
20 | import com.melnykov.fab.FloatingActionButton;
21 |
22 | import org.efidroid.efidroidmanager.R;
23 |
24 | import org.efidroid.efidroidmanager.Util;
25 | import org.efidroid.efidroidmanager.activities.GenericProgressActivity;
26 | import org.efidroid.efidroidmanager.activities.OperatingSystemEditActivity;
27 | import org.efidroid.efidroidmanager.models.DeviceInfo;
28 | import org.efidroid.efidroidmanager.models.OperatingSystem;
29 | import org.efidroid.efidroidmanager.tasks.OSRemovalProgressServiceTask;
30 |
31 | import java.util.List;
32 |
33 | /**
34 | * A fragment representing a list of Items.
35 | *
36 | * Activities containing this fragment MUST implement the {@link OnOperatingSystemFragmentInteractionListener}
37 | * interface.
38 | */
39 | public class OperatingSystemFragment extends Fragment implements OperatingSystemRecyclerViewAdapter.OnInteractionListener {
40 | private OnOperatingSystemFragmentInteractionListener mListener;
41 |
42 | // request codes
43 | private static final int REQUEST_EDIT_OS = 0;
44 | private static final int REQUEST_CREATE_OS = 1;
45 | private static final int REQUEST_DELETE_OS = 2;
46 |
47 | /**
48 | * Mandatory empty constructor for the fragment manager to instantiate the
49 | * fragment (e.g. upon screen orientation changes).
50 | */
51 | public OperatingSystemFragment() {
52 | }
53 |
54 | @Override
55 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
56 | Bundle savedInstanceState) {
57 | View view = inflater.inflate(R.layout.fragment_operatingsystem_list, container, false);
58 |
59 | // Set the adapter
60 | if (view instanceof RecyclerView) {
61 | Context context = view.getContext();
62 | RecyclerView recyclerView = (RecyclerView) view;
63 | recyclerView.setLayoutManager(new LinearLayoutManager(context));
64 | recyclerView.setAdapter(new OperatingSystemRecyclerViewAdapter(mListener.getOperatingSystems(), this));
65 | recyclerView.setNestedScrollingEnabled(false);
66 | mListener.getFAB().attachToRecyclerView(recyclerView);
67 | }
68 |
69 | // configure toolbar
70 | AppBarLayout appBarLayout = mListener.getAppBarLayout();
71 | Util.setToolBarHeight(appBarLayout, 0, false);
72 |
73 | // show FAB
74 | FloatingActionButton fab = mListener.getFAB();
75 | fab.setImageDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_dialog_add, getActivity().getTheme()));
76 | fab.setVisibility(View.VISIBLE);
77 | fab.setOnClickListener(new View.OnClickListener() {
78 | @Override
79 | public void onClick(View view) {
80 | Intent intent = new Intent(getContext(), OperatingSystemEditActivity.class);
81 | intent.putExtra(OperatingSystemEditActivity.ARG_OPERATING_SYSTEM, new OperatingSystem());
82 | intent.putExtra(OperatingSystemEditActivity.ARG_DEVICE_INFO, mListener.getDeviceInfo());
83 | startActivityForResult(intent, REQUEST_CREATE_OS);
84 | }
85 | });
86 |
87 | CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
88 | layoutParams.gravity = Gravity.END | Gravity.BOTTOM;
89 | layoutParams.setMargins(layoutParams.leftMargin, 0, layoutParams.rightMargin, layoutParams.bottomMargin);
90 | fab.setLayoutParams(layoutParams);
91 |
92 | return view;
93 | }
94 |
95 | @Override
96 | public void onAttach(Context context) {
97 | super.onAttach(context);
98 | if (context instanceof OnOperatingSystemFragmentInteractionListener) {
99 | mListener = (OnOperatingSystemFragmentInteractionListener) context;
100 | } else {
101 | throw new RuntimeException(context.toString()
102 | + " must implement OnOperatingSystemFragmentInteractionListener");
103 | }
104 | }
105 |
106 | @Override
107 | public void onDetach() {
108 | super.onDetach();
109 | mListener = null;
110 | }
111 |
112 | @Override
113 | public void onOperatingSystemClicked(OperatingSystem item) {
114 | Intent intent = new Intent(getContext(), OperatingSystemEditActivity.class);
115 | intent.putExtra(OperatingSystemEditActivity.ARG_OPERATING_SYSTEM, item);
116 | intent.putExtra(OperatingSystemEditActivity.ARG_DEVICE_INFO, mListener.getDeviceInfo());
117 | startActivityForResult(intent, REQUEST_EDIT_OS);
118 | }
119 |
120 | @Override
121 | public void onOperatingSystemLongClicked(final OperatingSystem item) {
122 | new MaterialDialog.Builder(getContext())
123 | .title(R.string.action_delete)
124 | .content(getString(R.string.os_delete_confirmation, item.getName()))
125 | .positiveText(R.string.action_delete)
126 | .negativeText(R.string.md_cancel_label)
127 | .onPositive(new MaterialDialog.SingleButtonCallback() {
128 | @Override
129 | public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
130 | Bundle extras = new Bundle();
131 | Intent intent = GenericProgressActivity.makeIntent(
132 | getContext(),
133 | OSRemovalProgressServiceTask.class,
134 | extras,
135 | getString(R.string.deleting_system, item.getName()),
136 | R.anim.hold, R.anim.abc_slide_out_right_full,
137 | R.anim.hold, R.anim.abc_slide_out_right_full
138 | );
139 |
140 | extras.putParcelable(OSRemovalProgressServiceTask.ARG_OPERATING_SYSTEM, item);
141 | startActivityForResult(intent, REQUEST_DELETE_OS);
142 | getActivity().overridePendingTransition(R.anim.abc_slide_in_right_full, R.anim.hold);
143 | }
144 | }).show();
145 | }
146 |
147 | @Override
148 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
149 | switch (requestCode) {
150 | case REQUEST_EDIT_OS:
151 | case REQUEST_CREATE_OS:
152 | if (resultCode == OperatingSystemEditActivity.RESULT_UPDATED)
153 | mListener.reloadOperatingSystems();
154 | break;
155 |
156 | case REQUEST_DELETE_OS:
157 | mListener.reloadOperatingSystems();
158 | break;
159 |
160 | default:
161 | super.onActivityResult(requestCode, resultCode, data);
162 | }
163 | }
164 |
165 | public interface OnOperatingSystemFragmentInteractionListener {
166 | DeviceInfo getDeviceInfo();
167 |
168 | FloatingActionButton getFAB();
169 |
170 | AppBarLayout getAppBarLayout();
171 |
172 | List getOperatingSystems();
173 |
174 | void reloadOperatingSystems();
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/fragments/OperatingSystemRecyclerViewAdapter.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.fragments;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.drawable.Drawable;
6 | import android.os.AsyncTask;
7 | import android.support.v4.content.res.ResourcesCompat;
8 | import android.support.v7.widget.RecyclerView;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.ImageView;
13 | import android.widget.TextView;
14 |
15 | import org.efidroid.efidroidmanager.R;
16 | import org.efidroid.efidroidmanager.models.OperatingSystem;
17 |
18 | import java.util.List;
19 |
20 | /**
21 | * {@link RecyclerView.Adapter} that can display a {@link OperatingSystem} and makes a call to the
22 | * specified {@link OperatingSystemFragment.OnOperatingSystemFragmentInteractionListener}.
23 | */
24 | public class OperatingSystemRecyclerViewAdapter extends RecyclerView.Adapter {
25 |
26 | private final List mValues;
27 | private final OnInteractionListener mListener;
28 |
29 | private void loadIconsAsync(final Context context) {
30 | new AsyncTask() {
31 | @Override
32 | protected Void doInBackground(Void... params) {
33 | for (int i = 0; i < mValues.size(); i++) {
34 | OperatingSystem os = mValues.get(i);
35 |
36 | try {
37 | if (!os.hasLoadedIcon()) {
38 | os.getIconBitmap(context);
39 | publishProgress(i);
40 | }
41 | } catch (Exception e) {
42 | e.printStackTrace();
43 | }
44 | }
45 |
46 | return null;
47 | }
48 |
49 | @Override
50 | protected void onProgressUpdate(Integer... values) {
51 | for (int pos : values) {
52 | notifyItemChanged(pos);
53 | }
54 | }
55 | }.execute();
56 | }
57 |
58 | public OperatingSystemRecyclerViewAdapter(List items, OnInteractionListener listener) {
59 | mValues = items;
60 | mListener = listener;
61 | }
62 |
63 | @Override
64 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
65 | View view = LayoutInflater.from(parent.getContext())
66 | .inflate(R.layout.fragment_operatingsystem_item, parent, false);
67 |
68 | loadIconsAsync(view.getContext());
69 |
70 | return new ViewHolder(view);
71 | }
72 |
73 | @Override
74 | public void onBindViewHolder(final ViewHolder holder, int position) {
75 | OperatingSystem os = mValues.get(position);
76 |
77 | holder.mItem = os;
78 | holder.mTitleView.setText(os.getName());
79 |
80 | Bitmap iconBitmap = null;
81 | if (os.hasLoadedIcon()) {
82 | try {
83 | iconBitmap = os.getIconBitmap(holder.mView.getContext());
84 | if (iconBitmap != null)
85 | holder.mImageView.setImageBitmap(iconBitmap);
86 | } catch (Exception e) {
87 | e.printStackTrace();
88 | }
89 | }
90 |
91 | if (iconBitmap == null) {
92 | Drawable icon = ResourcesCompat.getDrawable(
93 | holder.mView.getResources(),
94 | android.R.mipmap.sym_def_app_icon,
95 | holder.mView.getContext().getTheme()
96 | );
97 | holder.mImageView.setImageDrawable(icon);
98 | }
99 |
100 | String desc = os.getDescription();
101 | if (desc != null && desc.length() > 0) {
102 | holder.mSubtitleView.setText(desc);
103 | holder.mSubtitleView.setVisibility(View.VISIBLE);
104 | } else {
105 | holder.mSubtitleView.setVisibility(View.GONE);
106 | }
107 |
108 | holder.mView.setOnClickListener(new View.OnClickListener() {
109 | @Override
110 | public void onClick(View v) {
111 | if (null != mListener) {
112 | // Notify the active callbacks interface (the activity, if the
113 | // fragment is attached to one) that an item has been selected.
114 | mListener.onOperatingSystemClicked(holder.mItem);
115 | }
116 | }
117 | });
118 |
119 | holder.mView.setOnLongClickListener(new View.OnLongClickListener() {
120 | @Override
121 | public boolean onLongClick(View v) {
122 | if (null != mListener) {
123 | // Notify the active callbacks interface (the activity, if the
124 | // fragment is attached to one) that an item has been selected.
125 | mListener.onOperatingSystemLongClicked(holder.mItem);
126 | return true;
127 | }
128 | return false;
129 | }
130 | });
131 | }
132 |
133 | @Override
134 | public int getItemCount() {
135 | return mValues.size();
136 | }
137 |
138 | public class ViewHolder extends RecyclerView.ViewHolder {
139 | public final View mView;
140 | public final TextView mTitleView;
141 | public final TextView mSubtitleView;
142 | public final ImageView mImageView;
143 | public OperatingSystem mItem;
144 |
145 | public ViewHolder(View view) {
146 | super(view);
147 | mView = view;
148 | mTitleView = (TextView) view.findViewById(R.id.text);
149 | mSubtitleView = (TextView) view.findViewById(R.id.text2);
150 | mImageView = (ImageView) view.findViewById(R.id.image);
151 | }
152 | }
153 |
154 | public interface OnInteractionListener {
155 | void onOperatingSystemClicked(OperatingSystem item);
156 |
157 | void onOperatingSystemLongClicked(OperatingSystem item);
158 | }
159 | }
160 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/fragments/operatingsystemedit/PartitionItemRecyclerViewAdapter.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.fragments.operatingsystemedit;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.ImageView;
8 | import android.widget.TextView;
9 |
10 | import org.apache.commons.io.FileUtils;
11 | import org.efidroid.efidroidmanager.R;
12 | import org.efidroid.efidroidmanager.models.OperatingSystem;
13 | import org.efidroid.efidroidmanager.types.OSEditFragmentInteractionListener;
14 |
15 | import java.util.List;
16 |
17 | public class PartitionItemRecyclerViewAdapter extends RecyclerView.Adapter implements OperatingSystem.OperatingSystemChangeListener {
18 | private List mValues;
19 | private final OSEditFragmentInteractionListener mListener;
20 | private final OperatingSystem mOperatingSystem;
21 |
22 | public PartitionItemRecyclerViewAdapter(OperatingSystem os, OSEditFragmentInteractionListener listener) {
23 | mOperatingSystem = os;
24 | mListener = listener;
25 | rebuild();
26 | }
27 |
28 | @Override
29 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
30 | View view = LayoutInflater.from(parent.getContext())
31 | .inflate(R.layout.fragment_partitionitem, parent, false);
32 | return new ViewHolder(view);
33 | }
34 |
35 | @Override
36 | public void onBindViewHolder(final ViewHolder holder, int position) {
37 | OperatingSystem.Partition partition = mValues.get(position);
38 |
39 | // data
40 | holder.mItem = partition;
41 |
42 | // text
43 | holder.mIdView.setText(partition.getPartitionName());
44 |
45 | // description
46 | String description = partition.toIniPath();
47 | if (partition.getType() != OperatingSystem.Partition.TYPE_BIND) {
48 | description += " (" + FileUtils.byteCountToDisplaySize(partition.getSize()) + ")";
49 | }
50 | holder.mContentView.setText(description);
51 |
52 | // icon letter
53 | String letter = "";
54 | switch (partition.getType()) {
55 | case OperatingSystem.Partition.TYPE_BIND:
56 | letter = "B";
57 | break;
58 | case OperatingSystem.Partition.TYPE_LOOP:
59 | letter = "L";
60 | break;
61 | }
62 | holder.mIconLetter.setText(letter);
63 |
64 | // onclick
65 | if(mOperatingSystem.isCreationMode()) {
66 | holder.mView.setOnClickListener(new View.OnClickListener() {
67 | @Override
68 | public void onClick(View v) {
69 | if (null != mListener) {
70 | mListener.onPartitionItemClicked(holder.mItem);
71 | }
72 | }
73 | });
74 | }
75 | }
76 |
77 | @Override
78 | public int getItemCount() {
79 | return mValues.size();
80 | }
81 |
82 | private void rebuild() {
83 | mValues = mOperatingSystem.getPartitions();
84 | }
85 |
86 | @Override
87 | public void onOperatingSystemChanged() {
88 | rebuild();
89 | notifyDataSetChanged();
90 | }
91 |
92 | @Override
93 | public void onAttachedToRecyclerView(RecyclerView recyclerView) {
94 | super.onAttachedToRecyclerView(recyclerView);
95 | mOperatingSystem.addChangeListener(this);
96 | }
97 |
98 | @Override
99 | public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
100 | super.onDetachedFromRecyclerView(recyclerView);
101 | mOperatingSystem.removeChangeListener(this);
102 | }
103 |
104 | public class ViewHolder extends RecyclerView.ViewHolder {
105 | public final View mView;
106 | public final TextView mIdView;
107 | public final TextView mContentView;
108 | public final ImageView mImageView;
109 | public final TextView mIconLetter;
110 | public OperatingSystem.Partition mItem;
111 |
112 | public ViewHolder(View view) {
113 | super(view);
114 | mView = view;
115 | mIdView = (TextView) view.findViewById(android.support.design.R.id.text);
116 | mContentView = (TextView) view.findViewById(android.support.design.R.id.text2);
117 | mImageView = (ImageView) view.findViewById(android.support.design.R.id.image);
118 | mIconLetter = (TextView) view.findViewById(R.id.icon_letter);
119 | }
120 |
121 | @Override
122 | public String toString() {
123 | return super.toString() + " '" + mContentView.getText() + "'";
124 | }
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/models/DeviceInfo.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.models;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import org.efidroid.efidroidmanager.AppConstants;
7 | import org.efidroid.efidroidmanager.RootToolsEx;
8 | import org.efidroid.efidroidmanager.types.FSTabEntry;
9 | import org.efidroid.efidroidmanager.types.MountEntry;
10 | import org.json.JSONException;
11 | import org.json.JSONObject;
12 |
13 | import java.io.IOException;
14 |
15 | public class DeviceInfo implements Parcelable {
16 |
17 | // data
18 | private String mDeviceName = null;
19 | private FSTab mFSTab = null;
20 |
21 | // state
22 | public LoadingState mLoadingState = LoadingState.STATE_LOAD_DEVICEINFO;
23 |
24 | public enum LoadingState {
25 | STATE_LOAD_DEVICEINFO,
26 | STATE_LOAD_FSTAB,
27 | }
28 |
29 | public DeviceInfo() {
30 | }
31 |
32 | protected DeviceInfo(Parcel in) {
33 | mDeviceName = in.readString();
34 | mFSTab = in.readParcelable(FSTab.class.getClassLoader());
35 | }
36 |
37 | public static final Creator CREATOR = new Creator() {
38 | @Override
39 | public DeviceInfo createFromParcel(Parcel in) {
40 | return new DeviceInfo(in);
41 | }
42 |
43 | @Override
44 | public DeviceInfo[] newArray(int size) {
45 | return new DeviceInfo[size];
46 | }
47 | };
48 |
49 | @Override
50 | public int describeContents() {
51 | return 0;
52 | }
53 |
54 | @Override
55 | public void writeToParcel(Parcel dest, int flags) {
56 | dest.writeString(mDeviceName);
57 | dest.writeParcelable(mFSTab, flags);
58 | }
59 |
60 | public void parseDeviceList(String json) throws JSONException {
61 | JSONObject jsonObject = new JSONObject(json);
62 | mDeviceName = jsonObject.getString(AppConstants.DEVICE_NAME);
63 | }
64 |
65 | public void parseFSTab(String data) throws IOException {
66 | mFSTab = new FSTab(data);
67 | }
68 |
69 | public String getDeviceName() {
70 | return mDeviceName;
71 | }
72 |
73 | public FSTab getFSTab() {
74 | return mFSTab;
75 | }
76 |
77 | public String getESPDir(boolean requireUEFIESPDir) {
78 | for (FSTabEntry entry : mFSTab.getFSTabEntries()) {
79 | String espFlag = entry.getESP();
80 | if (espFlag == null)
81 | continue;
82 |
83 | try {
84 | // load mount info
85 | MountInfo mountInfo = RootToolsEx.getMountInfo();
86 |
87 | int[] majmin = RootToolsEx.getDeviceNode(entry.getBlkDevice());
88 | MountEntry mountEntry = mountInfo.getByMajorMinor(majmin[0], majmin[1]);
89 | if (mountEntry == null)
90 | return null;
91 | String mountPoint = mountEntry.getMountPoint();
92 |
93 | // absolute path
94 | if (espFlag.startsWith("/"))
95 | return mountPoint + espFlag;
96 |
97 | if (espFlag.equals("datamedia")) {
98 | String path;
99 |
100 | if (requireUEFIESPDir)
101 | path = mountPoint + "/media/0/UEFIESP";
102 | else
103 | path = mountPoint + "/media/0";
104 | if (RootToolsEx.isDirectory(path))
105 | return path;
106 |
107 | if (requireUEFIESPDir)
108 | path = mountPoint + "/media/UEFIESP";
109 | else
110 | path = mountPoint + "/media";
111 | if (RootToolsEx.isDirectory(path))
112 | return path;
113 | }
114 | } catch (Exception e) {
115 | return null;
116 | }
117 | }
118 |
119 | return null;
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/models/FSTab.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.models;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import org.apache.commons.io.IOUtils;
7 | import org.efidroid.efidroidmanager.types.FSTabEntry;
8 |
9 | import java.io.IOException;
10 | import java.io.StringReader;
11 | import java.util.ArrayList;
12 | import java.util.Arrays;
13 | import java.util.Collections;
14 | import java.util.List;
15 |
16 | public class FSTab implements Parcelable {
17 | // data
18 | private ArrayList mFSTabEntries = new ArrayList<>();
19 |
20 | public FSTab(String data) throws IOException {
21 | List lines = IOUtils.readLines(new StringReader(data));
22 |
23 | for(String line : lines) {
24 | String[] parts = line.split(" ");
25 | ArrayList al = new ArrayList<>(Arrays.asList(parts));
26 | al.removeAll(Collections.singleton(""));
27 | mFSTabEntries.add(new FSTabEntry(al.get(0), al.get(1), al.get(2), al.get(3), al.get(4)));
28 | }
29 | }
30 |
31 | protected FSTab(Parcel in) {
32 | in.readList(mFSTabEntries, FSTabEntry.class.getClassLoader());
33 | }
34 |
35 | public static final Creator CREATOR = new Creator() {
36 | @Override
37 | public FSTab createFromParcel(Parcel in) {
38 | return new FSTab(in);
39 | }
40 |
41 | @Override
42 | public FSTab[] newArray(int size) {
43 | return new FSTab[size];
44 | }
45 | };
46 |
47 | public List getFSTabEntries() {
48 | return mFSTabEntries;
49 | }
50 |
51 | public FSTabEntry getEntryByName(String name) {
52 | for (FSTabEntry entry : getFSTabEntries()) {
53 | if(entry.getName().equals(name))
54 | return entry;
55 | }
56 | return null;
57 | }
58 |
59 | @Override
60 | public int describeContents() {
61 | return 0;
62 | }
63 |
64 | @Override
65 | public void writeToParcel(Parcel dest, int flags) {
66 | dest.writeList(mFSTabEntries);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/models/MountInfo.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.models;
2 |
3 | import org.efidroid.efidroidmanager.types.MountEntry;
4 |
5 | import java.util.List;
6 |
7 | public class MountInfo {
8 | private final List mMountEntries;
9 |
10 | public MountInfo(List mountEntries) {
11 | mMountEntries = mountEntries;
12 | }
13 |
14 | public MountEntry getByMajorMinor(int major, int minor) {
15 | for (MountEntry mountEntry : mMountEntries) {
16 | if (mountEntry.getMajor() == major && mountEntry.getMinor() == minor && mountEntry.getRoot().equals("/")) {
17 | return mountEntry;
18 | }
19 | }
20 |
21 | return null;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/tasks/EFIDroidUninstallServiceTask.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.tasks;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Keep;
5 |
6 | import com.stericson.roottools.RootTools;
7 |
8 | import org.efidroid.efidroidmanager.AppConstants;
9 | import org.efidroid.efidroidmanager.R;
10 | import org.efidroid.efidroidmanager.RootToolsEx;
11 | import org.efidroid.efidroidmanager.models.DeviceInfo;
12 | import org.efidroid.efidroidmanager.services.GenericProgressIntentService;
13 | import org.efidroid.efidroidmanager.types.FSTabEntry;
14 | import org.efidroid.efidroidmanager.types.InstallationEntry;
15 | import org.efidroid.efidroidmanager.types.InstallationStatus;
16 | import org.efidroid.efidroidmanager.types.ProgressServiceTask;
17 | import org.json.JSONArray;
18 | import org.json.JSONObject;
19 |
20 | import java.io.BufferedInputStream;
21 | import java.io.FileOutputStream;
22 | import java.io.InputStream;
23 | import java.io.OutputStream;
24 | import java.net.URL;
25 | import java.net.URLConnection;
26 |
27 | public class EFIDroidUninstallServiceTask extends ProgressServiceTask {
28 | // args
29 | public static final String ARG_DEVICE_INFO = "device_info";
30 | public static final String ARG_INSTALL_STATUS = "installation_status";
31 |
32 | // data
33 | private DeviceInfo mDeviceInfo = null;
34 | private InstallationStatus mInstallationStatus = null;
35 |
36 | // status
37 | private boolean mSuccess = false;
38 | private int mProgress = 0;
39 |
40 |
41 | @Keep
42 | @SuppressWarnings("unused")
43 | public EFIDroidUninstallServiceTask(GenericProgressIntentService service) {
44 | super(service);
45 | }
46 |
47 | private void doUninstall() throws Exception {
48 | // get esp parent directory
49 | String espParent = mDeviceInfo.getESPDir(false);
50 | if (espParent == null)
51 | throw new Exception(getService().getString(R.string.cant_find_esp_partition));
52 |
53 | // create UEFIESP dir
54 | String espDir = espParent + "/UEFIESP";
55 | RootToolsEx.mkdir(espDir, true);
56 |
57 | // restore backups
58 | for (FSTabEntry entry : mDeviceInfo.getFSTab().getFSTabEntries()) {
59 | if (!entry.isUEFI())
60 | continue;
61 |
62 | RootToolsEx.dd(espDir + "/partition_" + entry.getName() + ".img", entry.getBlkDevice());
63 | }
64 |
65 | // remove backups
66 | for (FSTabEntry entry : mDeviceInfo.getFSTab().getFSTabEntries()) {
67 | if (!entry.isUEFI())
68 | continue;
69 |
70 | RootTools.deleteFileOrDirectory(espDir + "/partition_" + entry.getName() + ".img", false);
71 | }
72 | }
73 |
74 | public void onProcess(Bundle extras) {
75 | mDeviceInfo = extras.getParcelable(ARG_DEVICE_INFO);
76 | mInstallationStatus = extras.getParcelable(ARG_INSTALL_STATUS);
77 |
78 | mProgress = 0;
79 | mSuccess = false;
80 | try {
81 | mProgress = publishProgress(50, getService().getString(R.string.uninstalling));
82 | doUninstall();
83 |
84 | mSuccess = true;
85 | } catch (Exception e) {
86 | e.printStackTrace();
87 | mSuccess = false;
88 | publishProgress(mProgress, e.getLocalizedMessage());
89 | }
90 |
91 | // publish status
92 | if (mSuccess)
93 | publishProgress(100, "Done");
94 | publishFinish(mSuccess);
95 | }
96 |
97 | @Override
98 | public String getNotificationProgressTitle() {
99 | return getService().getString(R.string.uninstalling_efidroid);
100 | }
101 |
102 | @Override
103 | public String getNotificationResultTitle() {
104 | if (mSuccess) {
105 | return getService().getString(R.string.uninstalling_efidroid_successful);
106 | } else {
107 | return getService().getString(R.string.error_uninstalliing_efidroid);
108 | }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/tasks/OSRemovalProgressServiceTask.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.tasks;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Keep;
5 |
6 | import com.stericson.roottools.RootTools;
7 |
8 | import org.efidroid.efidroidmanager.R;
9 | import org.efidroid.efidroidmanager.RootToolsEx;
10 | import org.efidroid.efidroidmanager.models.OperatingSystem;
11 | import org.efidroid.efidroidmanager.services.GenericProgressIntentService;
12 | import org.efidroid.efidroidmanager.types.ProgressServiceTask;
13 |
14 | public class OSRemovalProgressServiceTask extends ProgressServiceTask {
15 | // args
16 | public static final String ARG_OPERATING_SYSTEM = "operatingsystem";
17 |
18 | private OperatingSystem mOperatingSystem = null;
19 | private boolean mSuccess = false;
20 |
21 | @Keep
22 | @SuppressWarnings("unused")
23 | public OSRemovalProgressServiceTask(GenericProgressIntentService service) {
24 | super(service);
25 | }
26 |
27 | public void onProcess(Bundle extras) {
28 | OperatingSystem os = extras.getParcelable(ARG_OPERATING_SYSTEM);
29 | if(os==null) {
30 | mSuccess = false;
31 | publishProgress(0, "NULL Operating System");
32 | publishFinish(mSuccess);
33 | return;
34 | }
35 |
36 | mOperatingSystem = os;
37 | mSuccess = false;
38 |
39 | int progress = 0;
40 | try {
41 | String romDir = os.getDirectory();
42 | if(!RootToolsEx.isDirectory(romDir)) {
43 | throw new Exception(getService().getString(R.string.os_does_not_exist));
44 | }
45 |
46 | publishProgress(1, getService().getString(R.string.removing_system, os.getName()));
47 | if(!RootTools.deleteFileOrDirectory(romDir, false)) {
48 | throw new Exception(getService().getString(R.string.cant_delete_os));
49 | }
50 |
51 | mSuccess = true;
52 | }
53 | catch (Exception e) {
54 | mSuccess = false;
55 | publishProgress(progress, e.getLocalizedMessage());
56 | }
57 |
58 | // publish status
59 | if(mSuccess)
60 | publishProgress(100, getService().getString(R.string.md_done_label));
61 | publishFinish(mSuccess);
62 | }
63 |
64 | @Override
65 | public String getNotificationProgressTitle() {
66 | return getService().getString(R.string.removing_system, mOperatingSystem.getName());
67 | }
68 |
69 | @Override
70 | public String getNotificationResultTitle() {
71 | if (mSuccess) {
72 | return getService().getString(R.string.removed_system, mOperatingSystem.getName());
73 | } else {
74 | return getService().getString(R.string.error_removing_system, mOperatingSystem.getName());
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/types/ArgbEvaluator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.efidroid.efidroidmanager.types;
18 |
19 | import android.animation.TypeEvaluator;
20 | import android.animation.ValueAnimator;
21 |
22 | /**
23 | * This evaluator can be used to perform type interpolation between integer
24 | * values that represent ARGB colors.
25 | */
26 | public class ArgbEvaluator implements TypeEvaluator {
27 | private static final ArgbEvaluator sInstance = new ArgbEvaluator();
28 |
29 | /**
30 | * Returns an instance of
ArgbEvaluator
that may be used in
31 | * {@link ValueAnimator#setEvaluator(TypeEvaluator)}. The same instance may
32 | * be used in multiple Animator
s because it holds no state.
33 | *
34 | * @return An instance of ArgbEvalutor
.
35 | * @hide
36 | */
37 | public static ArgbEvaluator getInstance() {
38 | return sInstance;
39 | }
40 |
41 | /**
42 | * This function returns the calculated in-between value for a color
43 | * given integers that represent the start and end values in the four
44 | * bytes of the 32-bit int. Each channel is separately linearly interpolated
45 | * and the resulting calculated values are recombined into the return value.
46 | *
47 | * @param fraction The fraction from the starting to the ending values
48 | * @param startValue A 32-bit int value representing colors in the
49 | * separate bytes of the parameter
50 | * @param endValue A 32-bit int value representing colors in the
51 | * separate bytes of the parameter
52 | * @return A value that is calculated to be the linearly interpolated
53 | * result, derived by separating the start and end values into separate
54 | * color channels and interpolating each one separately, recombining the
55 | * resulting values in the same way.
56 | */
57 | public Object evaluate(float fraction, Object startValue, Object endValue) {
58 | int startInt = (Integer) startValue;
59 | int startA = (startInt >> 24) & 0xff;
60 | int startR = (startInt >> 16) & 0xff;
61 | int startG = (startInt >> 8) & 0xff;
62 | int startB = startInt & 0xff;
63 |
64 | int endInt = (Integer) endValue;
65 | int endA = (endInt >> 24) & 0xff;
66 | int endR = (endInt >> 16) & 0xff;
67 | int endG = (endInt >> 8) & 0xff;
68 | int endB = endInt & 0xff;
69 |
70 | return (int) ((startA + (int) (fraction * (endA - startA))) << 24) |
71 | (int) ((startR + (int) (fraction * (endR - startR))) << 16) |
72 | (int) ((startG + (int) (fraction * (endG - startG))) << 8) |
73 | (int) ((startB + (int) (fraction * (endB - startB))));
74 | }
75 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/types/CommandEx.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.types;
2 |
3 | import com.stericson.rootshell.execution.Command;
4 |
5 | public class CommandEx extends Command {
6 | private StringBuffer mErrorBuffer = new StringBuffer();
7 |
8 | public CommandEx(int id, String... command) {
9 | super(id, command);
10 | }
11 |
12 | public CommandEx(int id, boolean handlerEnabled, String... command) {
13 | super(id, handlerEnabled, command);
14 | }
15 |
16 | public CommandEx(int id, int timeout, String... command) {
17 | super(id, timeout, command);
18 | }
19 |
20 | public CommandEx(int id, boolean handlerEnabled, int timeout, String... command) {
21 | super(id, handlerEnabled, timeout, command);
22 | }
23 |
24 | @Override
25 | public void commandOutput(int id, String line) {
26 | super.commandOutput(id, line);
27 | mErrorBuffer.append(line);
28 | }
29 |
30 | public String getErrorBuffer() {
31 | return mErrorBuffer.toString();
32 | }
33 |
34 | public void checkReturnCode() throws Exception {
35 | if (getExitCode() != 0) {
36 | String s = getErrorBuffer();
37 | if (s.trim().length() == 0)
38 | throw new ReturnCodeException(getExitCode());
39 | else
40 | throw new Exception(s);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/types/FABListener.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.types;
2 |
3 | public interface FABListener {
4 | void onFABClicked();
5 | }
6 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/types/FSTabEntry.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.types;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import org.efidroid.efidroidmanager.RootToolsEx;
7 |
8 | public class FSTabEntry implements Parcelable {
9 | final String mBlkDevice;
10 | final String mMountPoint;
11 | final String mFsType;
12 | final String mMountFlags;
13 | final String mFfMgrFlags;
14 |
15 | public FSTabEntry(String blkDevice, String mountPoint, String fsType, String mountFlags, String fsMgrFlags) {
16 | mMountPoint = mountPoint;
17 | mFsType = fsType;
18 | mMountFlags = mountFlags;
19 | mFfMgrFlags = fsMgrFlags;
20 |
21 | // use backup node if it exists
22 | String new_blkDevice = blkDevice;
23 | try {
24 | String backup = "/multiboot/dev/replacement_backup_" + getName();
25 | if (RootToolsEx.nodeExists(backup)) {
26 | new_blkDevice = backup;
27 | }
28 | } catch (Exception e) {
29 | e.printStackTrace();
30 | }
31 | mBlkDevice = new_blkDevice;
32 | }
33 |
34 | protected FSTabEntry(Parcel in) {
35 | mBlkDevice = in.readString();
36 | mMountPoint = in.readString();
37 | mFsType = in.readString();
38 | mMountFlags = in.readString();
39 | mFfMgrFlags = in.readString();
40 | }
41 |
42 | public static final Creator CREATOR = new Creator() {
43 | @Override
44 | public FSTabEntry createFromParcel(Parcel in) {
45 | return new FSTabEntry(in);
46 | }
47 |
48 | @Override
49 | public FSTabEntry[] newArray(int size) {
50 | return new FSTabEntry[size];
51 | }
52 | };
53 |
54 | @Override
55 | public int describeContents() {
56 | return 0;
57 | }
58 |
59 | @Override
60 | public void writeToParcel(Parcel dest, int flags) {
61 | dest.writeString(mBlkDevice);
62 | dest.writeString(mMountPoint);
63 | dest.writeString(mFsType);
64 | dest.writeString(mMountFlags);
65 | dest.writeString(mFfMgrFlags);
66 | }
67 |
68 | public String getBlkDevice() {
69 | try {
70 | if (RootToolsEx.isDirectory("/multiboot"))
71 | return "/multiboot" + RootToolsEx.realpath(mBlkDevice);
72 | } catch (Exception e) {
73 | }
74 |
75 | return mBlkDevice;
76 | }
77 |
78 | public String getMountPoint() {
79 | return mMountPoint;
80 | }
81 |
82 | public String getName() {
83 | return getMountPoint().substring(1);
84 | }
85 |
86 | public String getFsType() {
87 | return mFsType;
88 | }
89 |
90 | public String getMountFlags() {
91 | return mMountFlags;
92 | }
93 |
94 | public String getFfMgrFlags() {
95 | return mFfMgrFlags;
96 | }
97 |
98 | public boolean isMultiboot() {
99 | String[] parts = mFfMgrFlags.split(",");
100 | for (String part : parts) {
101 | if (part.equals("multiboot"))
102 | return true;
103 | }
104 |
105 | return false;
106 | }
107 |
108 | public boolean isUEFI() {
109 | String[] parts = mFfMgrFlags.split(",");
110 | for (String part : parts) {
111 | if (part.equals("uefi"))
112 | return true;
113 | }
114 |
115 | return false;
116 | }
117 |
118 | public String getESP() {
119 | String[] parts = mFfMgrFlags.split(",");
120 | for (String part : parts) {
121 | if (!part.startsWith("esp"))
122 | continue;
123 |
124 | return part.substring(4);
125 | }
126 |
127 | return null;
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/types/InstallationStatus.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.types;
2 |
3 | import android.content.Context;
4 | import android.os.Parcel;
5 | import android.os.Parcelable;
6 |
7 | import org.efidroid.efidroidmanager.AppConstants;
8 | import org.efidroid.efidroidmanager.models.DeviceInfo;
9 | import org.efidroid.efidroidmanager.models.FSTab;
10 | import org.json.JSONArray;
11 | import org.json.JSONException;
12 | import org.json.JSONObject;
13 |
14 | import java.io.BufferedInputStream;
15 | import java.io.InputStream;
16 | import java.net.URL;
17 | import java.net.URLConnection;
18 | import java.util.ArrayList;
19 | import java.util.Date;
20 |
21 | public class InstallationStatus implements Parcelable {
22 | private ArrayList mInstallationEntries = new ArrayList<>();
23 | private JSONObject mUpdate = null;
24 |
25 | public InstallationStatus() {
26 | }
27 |
28 | private JSONArray getUpdateList(Context context, DeviceInfo deviceInfo) throws Exception {
29 | StringBuilder sb = new StringBuilder();
30 |
31 | // connect
32 | URL url = new URL(AppConstants.getUrlUpdates(context, deviceInfo));
33 | URLConnection connection = url.openConnection();
34 | connection.connect();
35 |
36 | // open stream
37 | InputStream input = new BufferedInputStream(connection.getInputStream());
38 |
39 | // copy data
40 | byte data[] = new byte[1024];
41 | int count;
42 | while ((count = input.read(data)) != -1) {
43 | sb.append(new String(data, 0, count));
44 | }
45 | input.close();
46 |
47 | return new JSONArray(sb.toString());
48 | }
49 |
50 | public void doLoad(Context context, DeviceInfo deviceInfo) {
51 |
52 | // load installation info
53 | FSTab fsTab = deviceInfo.getFSTab();
54 | for (FSTabEntry entry : fsTab.getFSTabEntries()) {
55 | if (!entry.isUEFI())
56 | continue;
57 |
58 | // build entry
59 | InstallationEntry installationEntry = new InstallationEntry(entry, deviceInfo);
60 | mInstallationEntries.add(installationEntry);
61 | }
62 |
63 | // get update list
64 | try {
65 | if (isInstalled() && !isBroken()) {
66 | JSONArray updateList = getUpdateList(context, deviceInfo);
67 | JSONObject latestUpdate = null;
68 | for (int i = 0; i < updateList.length(); i++) {
69 | JSONObject o = updateList.getJSONObject(i);
70 |
71 | if (latestUpdate == null || o.getLong("timestamp") > latestUpdate.getLong("timestamp"))
72 | latestUpdate = o;
73 | }
74 |
75 | if (latestUpdate != null && latestUpdate.getLong("timestamp") > getWorkingEntry().getTimeStamp())
76 | mUpdate = latestUpdate;
77 | }
78 | } catch (Exception e) {
79 | e.printStackTrace();
80 | }
81 | }
82 |
83 | public ArrayList getInstallationEntries() {
84 | return mInstallationEntries;
85 | }
86 |
87 | public InstallationEntry getWorkingEntry() {
88 | for (InstallationEntry entry : mInstallationEntries) {
89 | int status = entry.getStatus();
90 | if (status == InstallationEntry.STATUS_OK)
91 | return entry;
92 | }
93 |
94 | return null;
95 | }
96 |
97 | public InstallationEntry getEntryByName(String name) {
98 | for (InstallationEntry entry : mInstallationEntries) {
99 | if (entry.getFsTabEntry().getName().equals(name))
100 | return entry;
101 | }
102 |
103 | return null;
104 | }
105 |
106 | private int getInstalledCount() {
107 | int installedCount = 0;
108 | for (InstallationEntry entry : mInstallationEntries) {
109 | if (entry.getStatus() == InstallationEntry.STATUS_OK)
110 | installedCount++;
111 | }
112 | return installedCount;
113 | }
114 |
115 | private int getEspOnlyCount() {
116 | int count = 0;
117 | for (InstallationEntry entry : mInstallationEntries) {
118 | int status = entry.getStatus();
119 | if (status == InstallationEntry.STATUS_ESP_ONLY)
120 | count++;
121 | }
122 | return count;
123 | }
124 |
125 | public boolean isInstalled() {
126 | return getInstalledCount() > 0 || getEspOnlyCount() > 0;
127 | }
128 |
129 | public boolean isBroken() {
130 | return getInstalledCount() != mInstallationEntries.size();
131 | }
132 |
133 | public boolean isUpdateAvailable() {
134 | return mUpdate != null;
135 | }
136 |
137 | public Date getUpdateDate() {
138 | try {
139 | return new Date(mUpdate.getLong("timestamp") * 1000l);
140 | } catch (JSONException e) {
141 | e.printStackTrace();
142 | }
143 | return new Date();
144 | }
145 |
146 | protected InstallationStatus(Parcel in) {
147 | in.readList(mInstallationEntries, InstallationEntry.class.getClassLoader());
148 | try {
149 | String jsonString = (String) in.readValue(String.class.getClassLoader());
150 | if (jsonString != null)
151 | mUpdate = new JSONObject(jsonString);
152 | } catch (JSONException e) {
153 | e.printStackTrace();
154 | }
155 | }
156 |
157 | public static final Creator CREATOR = new Creator() {
158 | @Override
159 | public InstallationStatus createFromParcel(Parcel in) {
160 | return new InstallationStatus(in);
161 | }
162 |
163 | @Override
164 | public InstallationStatus[] newArray(int size) {
165 | return new InstallationStatus[size];
166 | }
167 | };
168 |
169 | @Override
170 | public int describeContents() {
171 | return 0;
172 | }
173 |
174 | @Override
175 | public void writeToParcel(Parcel dest, int flags) {
176 | dest.writeList(mInstallationEntries);
177 | dest.writeValue(mUpdate == null ? null : mUpdate.toString());
178 | }
179 | }
180 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/types/MountEntry.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.types;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import java.util.ArrayList;
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | public class MountEntry implements Parcelable {
11 | private final int mMountID;
12 | private final int mParentID;
13 | private final int mMajor;
14 | private final int mMinor;
15 | private final String mRoot;
16 | private final String mMountPoint;
17 | private final String mMountOptions;
18 | private final String mOptionalFields;
19 | private final String mFsType;
20 | private final String mMountSource;
21 | private final String mSuperOptions;
22 |
23 | public MountEntry(int mountID, int parentID, int major, int minor, String root, String mountPoint, String mountOptions, String optionalFields, String fsType, String mountSource, String superOptions) {
24 | mMountID = mountID;
25 | mParentID = parentID;
26 | mMajor = major;
27 | mMinor = minor;
28 | mRoot = root;
29 | mMountPoint = mountPoint;
30 | mMountOptions = mountOptions;
31 | mOptionalFields = optionalFields;
32 | mFsType = fsType;
33 | mMountSource = mountSource;
34 | mSuperOptions = superOptions;
35 | }
36 |
37 | protected MountEntry(Parcel in) {
38 | mMountID = in.readInt();
39 | mParentID = in.readInt();
40 | mMajor = in.readInt();
41 | mMinor = in.readInt();
42 | mRoot = in.readString();
43 | mMountPoint = in.readString();
44 | mMountOptions = in.readString();
45 | mOptionalFields = in.readString();
46 | mFsType = in.readString();
47 | mMountSource = in.readString();
48 | mSuperOptions = in.readString();
49 | }
50 |
51 | public static final Creator CREATOR = new Creator() {
52 | @Override
53 | public MountEntry createFromParcel(Parcel in) {
54 | return new MountEntry(in);
55 | }
56 |
57 | @Override
58 | public MountEntry[] newArray(int size) {
59 | return new MountEntry[size];
60 | }
61 | };
62 |
63 | @Override
64 | public int describeContents() {
65 | return 0;
66 | }
67 |
68 | @Override
69 | public void writeToParcel(Parcel dest, int flags) {
70 | dest.writeInt(mMountID);
71 | dest.writeInt(mParentID);
72 | dest.writeInt(mMajor);
73 | dest.writeInt(mMinor);
74 | dest.writeString(mRoot);
75 | dest.writeString(mMountPoint);
76 | dest.writeString(mMountOptions);
77 | dest.writeString(mOptionalFields);
78 | dest.writeString(mFsType);
79 | dest.writeString(mMountSource);
80 | dest.writeString(mSuperOptions);
81 | }
82 |
83 | public int getMountID() {
84 | return mMountID;
85 | }
86 |
87 | public int getParentID() {
88 | return mParentID;
89 | }
90 |
91 | public int getMajor() {
92 | return mMajor;
93 | }
94 |
95 | public int getMinor() {
96 | return mMinor;
97 | }
98 |
99 | public String getRoot() {
100 | return mRoot;
101 | }
102 |
103 | public String getMountPoint() {
104 | return mMountPoint;
105 | }
106 |
107 | public String getMountOptions() {
108 | return mMountOptions;
109 | }
110 |
111 | public String getOptionalFields() {
112 | return mOptionalFields;
113 | }
114 |
115 | public String getFsType() {
116 | return mFsType;
117 | }
118 |
119 | public String getMountSource() {
120 | return mMountSource;
121 | }
122 |
123 | public String getSuperOptions() {
124 | return mSuperOptions;
125 | }
126 |
127 | public List getMountOptionsList() {
128 | return new ArrayList<>(Arrays.asList(getMountOptions().split(",")));
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/types/OSEditFragmentInteractionListener.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.types;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 | import android.support.design.widget.TabLayout;
6 |
7 | import org.efidroid.efidroidmanager.models.DeviceInfo;
8 | import org.efidroid.efidroidmanager.models.OperatingSystem;
9 | import org.efidroid.efidroidmanager.view.CustomViewPager;
10 |
11 | import java.util.ArrayList;
12 |
13 | public interface OSEditFragmentInteractionListener {
14 | class MultibootPartitionInfo implements Parcelable {
15 | public final String name;
16 | public final long size;
17 |
18 | public MultibootPartitionInfo(String name, long size) {
19 | this.name = name;
20 | this.size = size;
21 | }
22 |
23 | protected MultibootPartitionInfo(Parcel in) {
24 | this.name = in.readString();
25 | this.size = in.readLong();
26 | }
27 |
28 | public static final Creator CREATOR = new Creator() {
29 | @Override
30 | public MultibootPartitionInfo createFromParcel(Parcel in) {
31 | return new MultibootPartitionInfo(in);
32 | }
33 |
34 | @Override
35 | public MultibootPartitionInfo[] newArray(int size) {
36 | return new MultibootPartitionInfo[size];
37 | }
38 | };
39 |
40 | @Override
41 | public int describeContents() {
42 | return 0;
43 | }
44 |
45 | @Override
46 | public void writeToParcel(Parcel dest, int flags) {
47 | dest.writeString(name);
48 | dest.writeLong(size);
49 | }
50 | }
51 |
52 | class MultibootDir implements Parcelable {
53 | public static final Creator CREATOR = new Creator() {
54 | @Override
55 | public MultibootDir createFromParcel(Parcel in) {
56 | return new MultibootDir(in);
57 | }
58 |
59 | @Override
60 | public MultibootDir[] newArray(int size) {
61 | return new MultibootDir[size];
62 | }
63 | };
64 | public final String path;
65 | public final MountEntry mountEntry;
66 |
67 | public MultibootDir(String path, MountEntry mountEntry) {
68 | this.path = path;
69 | this.mountEntry = mountEntry;
70 | }
71 |
72 | protected MultibootDir(Parcel in) {
73 | this.path = in.readString();
74 | this.mountEntry = in.readParcelable(MountEntry.class.getClassLoader());
75 | }
76 |
77 | @Override
78 | public int describeContents() {
79 | return 0;
80 | }
81 |
82 | @Override
83 | public void writeToParcel(Parcel dest, int flags) {
84 | dest.writeString(path);
85 | dest.writeParcelable(mountEntry, flags);
86 | }
87 |
88 | @Override
89 | public String toString() {
90 | return path + " (" + mountEntry.getFsType() + ")";
91 | }
92 | }
93 |
94 | interface CommitListener {
95 | boolean onCommit();
96 | }
97 |
98 | // data methods
99 | DeviceInfo getDeviceInfo();
100 |
101 | OperatingSystem getOperatingSystem();
102 |
103 | ArrayList getMultibootDirectories();
104 |
105 | ArrayList getMultibootPartitionInfo();
106 |
107 | // callbacks
108 | void onPartitionItemClicked(OperatingSystem.Partition item);
109 |
110 | // listeners
111 | void addOnCommitListener(CommitListener listener);
112 |
113 | void removeOnCommitListener(CommitListener listener);
114 |
115 | // UI
116 | CustomViewPager getViewPager();
117 |
118 | TabLayout getTabLayout();
119 |
120 | void setFabVisible(final boolean visible);
121 | }
122 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/types/Pointer.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.types;
2 |
3 | public class Pointer {
4 | public T value;
5 |
6 | public Pointer(T value) {
7 | this.value = value;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/types/ProgressReceiver.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.types;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.IntentFilter;
7 | import android.os.Bundle;
8 |
9 | import org.efidroid.efidroidmanager.services.GenericProgressIntentService;
10 |
11 | public class ProgressReceiver {
12 | // argument values
13 | private Class> mServiceClass = null;
14 | private Bundle mServiceBundle = null;
15 | private Class> mServiceHandler = null;
16 |
17 | // broadcast actions
18 | public static final String ACTION_OPUPDATE_PROGRESS = "progressreceiver_action_opupdate_progress";
19 | public static final String ARG_OPUPDATE_PROGRESS = "progressreceiver_arg_opupdate_progress";
20 | public static final String ARG_OPUPDATE_TEXT = "progressreceiver_arg_opupdate_text";
21 | public static final String ACTION_OPUPDATE_FINISH = "progressreceiver_action_opupdate_finish";
22 | public static final String ARG_OPUPDATE_SUCCESS = "progressreceiver_arg_opupdate_success";
23 |
24 | // private argument names
25 | private static final String ARG_PROGRESS = "progressreceiver_progress";
26 | private static final String ARG_PROGRESS_TEXT = "progressreceiver_progress_text";
27 | private static final String ARG_SUCCESS = "progressreceiver_success";
28 | private static final String ARG_FINISHED = "progressreceiver_finished";
29 | private static final String ARG_RUNNING = "progressreceiver_running";
30 | private static final String ARG_SERVICE_CLASS = "progressreceiver_service_class";
31 | private static final String ARG_SERVICE_HANDLER = "progressreceiver_service_handler";
32 |
33 | // status
34 | private int mProgress = 0;
35 | private String mProgressText = "";
36 | private boolean mSuccess = false;
37 | private boolean mFinished = false;
38 | private boolean mIsRunning = false;
39 |
40 | // context, listener
41 | private Context mContext;
42 | private OnStatusChangeListener mListener;
43 |
44 | public void reset() {
45 | if (mIsRunning)
46 | throw new RuntimeException("service is still running");
47 |
48 | mProgress = 0;
49 | mProgressText = "";
50 | mSuccess = false;
51 | mFinished = false;
52 | }
53 |
54 | public interface OnStatusChangeListener {
55 | void onStatusUpdate(int progress, String text);
56 |
57 | void onCompleted(boolean success);
58 | }
59 |
60 | private BroadcastReceiver receiver = new BroadcastReceiver() {
61 | @Override
62 | public void onReceive(Context context, Intent intent) {
63 | switch (intent.getAction()) {
64 | case ACTION_OPUPDATE_PROGRESS:
65 | if (!mFinished) {
66 | mProgress = intent.getIntExtra(ARG_OPUPDATE_PROGRESS, -1);
67 | mProgressText = intent.getStringExtra(ARG_OPUPDATE_TEXT);
68 |
69 | mListener.onStatusUpdate(mProgress, mProgressText);
70 | }
71 | break;
72 |
73 | case ACTION_OPUPDATE_FINISH:
74 | mSuccess = intent.getBooleanExtra(ARG_OPUPDATE_SUCCESS, false);
75 | mFinished = true;
76 | mIsRunning = false;
77 |
78 | mListener.onCompleted(mSuccess);
79 | break;
80 | }
81 | }
82 | };
83 |
84 | public ProgressReceiver(Context context, OnStatusChangeListener listener, Class> serviceClass, Class> serviceHandler, Bundle serviceBundle) {
85 | // initialize variables
86 | mFinished = false;
87 | mSuccess = false;
88 | mIsRunning = false;
89 | mContext = context;
90 | mListener = listener;
91 |
92 | // get data
93 | mServiceClass = serviceClass;
94 | mServiceBundle = serviceBundle;
95 | mServiceHandler = serviceHandler;
96 |
97 | if (mServiceClass == null)
98 | mServiceClass = GenericProgressIntentService.class;
99 | if (mServiceBundle == null)
100 | mServiceBundle = new Bundle();
101 |
102 | // register broadcast receiver
103 | IntentFilter filter = new IntentFilter();
104 | filter.addAction(ACTION_OPUPDATE_PROGRESS);
105 | filter.addAction(ACTION_OPUPDATE_FINISH);
106 | mContext.registerReceiver(receiver, filter);
107 | }
108 |
109 | public void notifyDestroy() {
110 | mContext.unregisterReceiver(receiver);
111 | }
112 |
113 | public void notifyPause() {
114 | // show notification
115 | if (!mFinished)
116 | GenericProgressIntentService.showNotification(mContext, mServiceClass, true);
117 | }
118 |
119 | public void notifyResume() {
120 | // hide notification
121 | if (!mFinished)
122 | GenericProgressIntentService.showNotification(mContext, mServiceClass, false);
123 | }
124 |
125 | public void setServiceClass(Class> serviceClass) {
126 | if (mIsRunning)
127 | throw new RuntimeException("service is still running");
128 |
129 | mServiceClass = serviceClass;
130 | }
131 |
132 | public void setServiceHandler(Class> serviceHandler) {
133 | if (mIsRunning)
134 | throw new RuntimeException("service is still running");
135 |
136 | mServiceHandler = serviceHandler;
137 | }
138 |
139 | public void setServiceBundle(Bundle bundle) {
140 | if (mIsRunning)
141 | throw new RuntimeException("service is still running");
142 |
143 | mServiceBundle = bundle;
144 | }
145 |
146 | public void onSaveInstanceState(Bundle outState) {
147 | // store private data
148 | outState.putInt(ARG_PROGRESS, mProgress);
149 | outState.putString(ARG_PROGRESS_TEXT, mProgressText);
150 | outState.putBoolean(ARG_SUCCESS, mSuccess);
151 | outState.putBoolean(ARG_FINISHED, mFinished);
152 | outState.putBoolean(ARG_RUNNING, mIsRunning);
153 |
154 | outState.putSerializable(ARG_SERVICE_CLASS, mServiceClass);
155 | outState.putSerializable(ARG_SERVICE_HANDLER, mServiceHandler);
156 | }
157 |
158 | public void onRestoreInstanceState(Bundle savedInstanceState) {
159 | // restore private data
160 | mProgress = savedInstanceState.getInt(ARG_PROGRESS);
161 | mProgressText = savedInstanceState.getString(ARG_PROGRESS_TEXT);
162 | mSuccess = savedInstanceState.getBoolean(ARG_SUCCESS);
163 | mFinished = savedInstanceState.getBoolean(ARG_FINISHED);
164 | mIsRunning = savedInstanceState.getBoolean(ARG_RUNNING);
165 |
166 | mServiceClass = (Class>) savedInstanceState.getSerializable(ARG_SERVICE_CLASS);
167 | mServiceHandler = (Class>) savedInstanceState.getSerializable(ARG_SERVICE_HANDLER);
168 |
169 | mListener.onStatusUpdate(mProgress, mProgressText);
170 | if (mFinished)
171 | mListener.onCompleted(mSuccess);
172 | }
173 |
174 | public void startService() {
175 | if (mIsRunning)
176 | throw new RuntimeException("service is still running");
177 |
178 | // start service
179 | Intent serviceIntent = new Intent(mContext, mServiceClass);
180 | serviceIntent.putExtra(GenericProgressIntentService.ARG_BUNDLE, mServiceBundle);
181 | serviceIntent.putExtra(GenericProgressIntentService.ARG_HANDLER, mServiceHandler);
182 | mIsRunning = true;
183 | mContext.startService(serviceIntent);
184 | }
185 |
186 | public boolean wasSuccessful() {
187 | return mSuccess;
188 | }
189 |
190 | public boolean isFinished() {
191 | return mFinished;
192 | }
193 |
194 | public int getProgress() {
195 | return mProgress;
196 | }
197 |
198 | public String getProgressText() {
199 | return mProgressText;
200 | }
201 | }
202 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/types/ProgressServiceTask.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.types;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 |
6 | import org.efidroid.efidroidmanager.activities.GenericProgressActivity;
7 | import org.efidroid.efidroidmanager.services.GenericProgressIntentService;
8 |
9 | public abstract class ProgressServiceTask {
10 | private GenericProgressIntentService mService;
11 |
12 | public ProgressServiceTask(GenericProgressIntentService service) {
13 | mService = service;
14 | }
15 |
16 | protected GenericProgressIntentService getService() {
17 | return mService;
18 | }
19 |
20 | public int publishProgress(int percent, String text) {
21 | return mService.publishProgress(percent, text);
22 | }
23 |
24 | public void publishFinish(boolean success) {
25 | mService.publishFinish(success);
26 | }
27 |
28 | public boolean shouldStop() {
29 | return mService.shouldStop();
30 | }
31 |
32 | abstract public void onProcess(Bundle extras);
33 |
34 | abstract public String getNotificationProgressTitle();
35 |
36 | abstract public String getNotificationResultTitle();
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/types/ReturnCodeException.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.types;
2 |
3 | public class ReturnCodeException extends Exception {
4 | public ReturnCodeException(int code) {
5 | super("return code was non zero: " + code);
6 | }
7 |
8 | public static void check(int code) throws ReturnCodeException {
9 | if (code != 0)
10 | throw new ReturnCodeException(code);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/java/org/efidroid/efidroidmanager/view/CustomViewPager.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager.view;
2 |
3 | import android.content.Context;
4 | import android.support.v4.view.ViewPager;
5 | import android.util.AttributeSet;
6 | import android.view.MotionEvent;
7 |
8 | public class CustomViewPager extends ViewPager {
9 |
10 | private boolean enabled;
11 |
12 | public CustomViewPager(Context context, AttributeSet attrs) {
13 | super(context, attrs);
14 | this.enabled = true;
15 | }
16 |
17 | @Override
18 | public boolean onTouchEvent(MotionEvent event) {
19 | return this.enabled && super.onTouchEvent(event);
20 |
21 | }
22 |
23 | @Override
24 | public boolean onInterceptTouchEvent(MotionEvent event) {
25 | return this.enabled && super.onInterceptTouchEvent(event);
26 |
27 | }
28 |
29 | public void setPagingEnabled(boolean enabled) {
30 | this.enabled = enabled;
31 | }
32 | }
--------------------------------------------------------------------------------
/app/src/main/res/anim/abc_slide_in_bottom_full.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/abc_slide_in_left_full.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/abc_slide_in_right_full.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/abc_slide_out_bottom_full.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/abc_slide_out_left_full.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/abc_slide_out_right_full.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/hold.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ripple.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/activatable_item_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/efidroid.xml:
--------------------------------------------------------------------------------
1 |
3 |
5 |
7 |
9 |
11 |
13 |
15 |
17 |
19 |
21 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_cancel.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_delete.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_done.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_refresh.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_dialog_add.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_archive.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_bug_report.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_color_lens.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_extension.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_hospital.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_info.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_info_outline.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_memory.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_settings.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/md_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tablayout_background_transition.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
19 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_operating_system_edit.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
21 |
22 |
28 |
29 |
30 |
31 |
36 |
37 |
38 |
39 |
44 |
45 |
46 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_osupdate_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
22 |
23 |
29 |
30 |
42 |
43 |
50 |
51 |
52 |
53 |
59 |
60 |
65 |
66 |
70 |
71 |
80 |
81 |
90 |
91 |
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
15 |
16 |
23 |
24 |
29 |
30 |
40 |
41 |
49 |
50 |
60 |
61 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
15 |
16 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_edit_partition.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
19 |
20 |
28 |
29 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_new_cmdline.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/divider.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/efidroid_simple_spinner_dropdown_item.xml:
--------------------------------------------------------------------------------
1 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_general.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
15 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
44 |
45 |
51 |
52 |
53 |
54 |
55 |
61 |
62 |
69 |
70 |
75 |
76 |
85 |
86 |
87 |
88 |
94 |
95 |
102 |
103 |
108 |
109 |
118 |
119 |
120 |
121 |
122 |
123 |
130 |
131 |
136 |
137 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
161 |
162 |
167 |
168 |
179 |
180 |
181 |
182 |
183 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_install.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_operating_system_edit.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_operatingsystem_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
23 |
24 |
25 |
30 |
31 |
36 |
37 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_operatingsystem_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_partitionitem.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
23 |
31 |
32 |
33 |
38 |
39 |
44 |
45 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_partitionitem_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
19 |
20 |
27 |
28 |
33 |
34 |
35 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_replacemenitem.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
21 |
22 |
27 |
28 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_replacemenitem_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_replacemenitem_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
20 |
21 |
27 |
28 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/toolbar_layout_install.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
27 |
28 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/actionmode_operatingsystemedit.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_operatingsystemedit.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/fragment_install.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/efidroid/android_app_efidroidmanager/9d797ac9d072ac6316e04c341c800f736cfdbbac/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/efidroid/android_app_efidroidmanager/9d797ac9d072ac6316e04c341c800f736cfdbbac/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/efidroid/android_app_efidroidmanager/9d797ac9d072ac6316e04c341c800f736cfdbbac/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/efidroid/android_app_efidroidmanager/9d797ac9d072ac6316e04c341c800f736cfdbbac/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/efidroid/android_app_efidroidmanager/9d797ac9d072ac6316e04c341c800f736cfdbbac/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - B
5 | - KB
6 | - MB
7 | - GB
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #4CAF50
4 | #388E3C
5 | #FF4081
6 | #C2185B
7 | #F06292
8 |
9 | #757575
10 | #616161
11 |
12 | #455A64
13 | #374850
14 |
15 | #0288D1
16 |
17 | #FF5722
18 | #4CAF50
19 | #FFC107
20 | #9E9E9E
21 |
22 | #FFAB91
23 | #E6EE9C
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 160dp
5 |
6 | 16dp
7 | 16dp
8 | 180dp
9 | 16dp
10 | 16dp
11 | 8dp
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | EFIDroid Manager
3 |
4 | Open navigation drawer
5 | Close navigation drawer
6 |
7 | Settings
8 |
9 | Android
10 | Ubuntu
11 |
12 | LoopSystem + BindOther
13 | BindAll
14 | LoopAll
15 | About
16 | OK
17 | Name
18 | Size
19 | Description
20 | Icon
21 | Scheme
22 | https://efidroid.org
23 | Operating Systems
24 | Recovery Tools
25 | UEFI Apps
26 | Plugins
27 | Themes
28 | Install/Update
29 | Share
30 | Get help
31 | Report bug
32 | About EFIDroid
33 | Delete
34 | Done
35 | Refresh
36 |
37 | App Version %1$s
38 | Compiled by %1$s@%2$s on %3$s
39 |
40 | Reloading info
41 | Reloading
42 | Can\'t reload installation status
43 | Error
44 |
45 | EFIDroid version
46 | Build time
47 | EFI Specification
48 | Uninstall
49 | Install
50 | Reinstall
51 | Repair
52 | Update
53 | and
54 | has an ESP backup only
55 | has no ESP backup
56 | is for another device
57 | is not installed
58 |
59 | Installed and updated
60 | Save
61 | Edit partition
62 | Creating system %1$s
63 | Updating system %1$s
64 | Deleting system %1$s
65 | Create Operating System
66 | Loading device info
67 | Please wait
68 | Cancelled loading system information.
69 | "Can\'t load system information: "
70 | GENERAL
71 | PARTITIONS
72 | REPLACEMENTS
73 | PLUGINS
74 | "Can\'t load operating systems. "
75 | "Can\'t load installation info. "
76 | Can\'t load device info. Please check your connection.\n\n
77 | Try again
78 | You need Root access to use this app.
79 | I\'m running EFIDroid on my %1$s!\nMore info: http://efidroid.org
80 | Do you want to delete \'%1$s\'?
81 | Name must not be empty
82 | New cmdline override
83 | Edit cmdline override
84 | Invalid characters
85 | Binaries
86 | kernel
87 | ramdisk
88 | dt
89 | Commandline
90 | (disabled)
91 | Stop
92 | Aborted
93 | Downloading
94 | Can\'t extract update
95 | Can\'t find ESP partition
96 | can\'t create UEFIESP directory
97 | Invalid update
98 | search for update
99 | No update available
100 | downloading update
101 | installing
102 | Installing EFIDroid
103 | Installing EFIDroid successful
104 | Error installing EFIDroid
105 | uninstalling
106 | Uninstalling EFIDroid
107 | Uninstalling EFIDroid successful
108 | Error uninstalling EFIDroid
109 | Operating System does not exist
110 | Removing system %1$s
111 | Removed system %1$s
112 | Error removing system %1$s
113 | Can\'t delete Operating system
114 | Creating OS directory
115 | Can\'t create multiboot directory
116 | ROM directory does already exist
117 | Can\'t create ROM directory
118 | Can\'t create ROM directory
119 | Can\'t delete old icon
120 | setup partition \'%1$s\'
121 | Can\'t create directory \'%1$s\'
122 | Can\'t create loop image \'%1$s\':
123 | created system %s
124 | updated system %s
125 | Error creating system %1$s
126 | Error updating system %1$s
127 | Encrypted devices are not supported
128 |
129 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
17 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/test/java/org/efidroid/efidroidmanager/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package org.efidroid.efidroidmanager;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | maven { url "https://jitpack.io" }
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/efidroid/android_app_efidroidmanager/9d797ac9d072ac6316e04c341c800f736cfdbbac/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Mar 29 21:16:02 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | include ':sub_projects:RootTools', ':sub_projects:RootShell'
--------------------------------------------------------------------------------
/sub_projects/RootShell/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io/api/android,java,intellij
2 |
3 | ### Android ###
4 | # Built application files
5 | *.apk
6 | *.ap_
7 |
8 | # Files for the Dalvik VM
9 | *.dex
10 |
11 | # Java class files
12 | *.class
13 |
14 | # Generated files
15 | bin/
16 | gen/
17 |
18 | # Gradle files
19 | .gradle/
20 | build/
21 |
22 | # Local configuration file (sdk path, etc)
23 | local.properties
24 |
25 | # Proguard folder generated by Eclipse
26 | proguard/
27 |
28 | xactmobile/class_files.txt
29 | xactmobile/mapping.txt
30 | xactmobile/seeds.txt
31 |
32 | # Log Files
33 | *.log
34 |
35 | # Android Studio Navigation editor temp files
36 | .navigation/
37 |
38 | ### Android Patch ###
39 | gen-external-apklibs
40 |
41 |
42 | ### Java ###
43 | *.class
44 |
45 | # Mobile Tools for Java (J2ME)
46 | .mtj.tmp/
47 |
48 | # Package Files #
49 | #*.jar
50 | *.war
51 | *.ear
52 |
53 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
54 | hs_err_pid*
55 |
56 |
57 | ### Intellij ###
58 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
59 |
60 | *.iml
61 |
62 | ## Directory-based project format:
63 | .idea/
64 | # if you remove the above rule, at least ignore the following:
65 |
66 | # User-specific stuff:
67 | .idea/workspace.xml
68 | .idea/tasks.xml
69 | .idea/dictionaries
70 |
71 | # Sensitive or high-churn files:
72 | .idea/dataSources.ids
73 | .idea/dataSources.xml
74 | .idea/sqlDataSources.xml
75 | .idea/dynamic.xml
76 | .idea/uiDesigner.xml
77 |
78 | # Gradle:
79 | .idea/gradle.xml
80 | .idea/libraries
81 |
82 | # Mongo Explorer plugin:
83 | .idea/mongoSettings.xml
84 |
85 | ## File-based project format:
86 | *.ipr
87 | *.iws
88 |
89 | ## Plugin-specific files:
90 |
91 | # IntelliJ
92 | /out/
93 |
94 | # mpeltonen/sbt-idea plugin
95 | .idea_modules/
96 |
97 | # JIRA plugin
98 | atlassian-ide-plugin.xml
99 |
100 | # Crashlytics plugin (for Android Studio and IntelliJ)
101 | com_crashlytics_export_strings.xml
102 | crashlytics.properties
103 | crashlytics-build.properties
104 |
105 | xactmobile/.DS_Store~64be78fe3602626c61b52bcbfd09e09a6107b50a
106 | xactmobile/.DS_Store~HEAD
107 | oslab-viewpager/._.DS_Store
108 | oslab-viewpager/src/main/.DS_Store
109 | oslab-viewpager/src/main/._.DS_Store
110 | oslab-viewpager/src/main/res/.DS_Store
111 | oslab-viewpager/src/main/res/._.DS_Store
112 | oslab-viewpager/.gitignore
113 | oslab-materialdesign/.DS_Store
114 | oslab-materialdesign/._.DS_Store
115 | oslab-materialdesign/src/.DS_Store
116 | oslab-materialdesign/src/._.DS_Store
117 | oslab-materialdesign/src/main/.DS_Store
118 | oslab-materialdesign/src/main/._.DS_Store
119 | oslab-materialdesign/src/main/res/.DS_Store
120 | oslab-materialdesign/src/main/res/._.DS_Store
121 |
--------------------------------------------------------------------------------
/sub_projects/RootShell/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 11
9 | targetSdkVersion 25
10 | }
11 |
12 | buildTypes {
13 | release {
14 | minifyEnabled false
15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
16 | }
17 | }
18 | }
19 |
20 | dependencies {
21 | compile fileTree(dir: 'libs', include: ['*.jar'])
22 | testCompile 'junit:junit:4.12'
23 | compile 'com.android.support:appcompat-v7:25.3.1'
24 | }
25 |
--------------------------------------------------------------------------------
/sub_projects/RootShell/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/demollol/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/sub_projects/RootShell/src/androidTest/java/com/example/rootshell/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.example.rootshell;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/sub_projects/RootShell/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/sub_projects/RootShell/src/main/java/com/stericson/rootshell/NativeJavaClass.java:
--------------------------------------------------------------------------------
1 | package com.stericson.rootshell;
2 |
3 | import com.stericson.rootshell.containers.RootClass;
4 |
5 | import java.io.BufferedWriter;
6 | import java.io.File;
7 | import java.io.FileWriter;
8 | import java.io.IOException;
9 |
10 | @RootClass.Candidate
11 | public class NativeJavaClass
12 | {
13 |
14 | public NativeJavaClass(RootClass.RootArgs args)
15 | {
16 | System.out.println("NativeJavaClass says: oh hi there.");
17 | String p = "/data/data/com.android.browser/cache";
18 | File f = new File(p);
19 | String[] fl = f.list();
20 | if (fl != null)
21 | {
22 | System.out.println("Look at all the stuff in your browser's cache:");
23 | for (String af : fl)
24 | {
25 | System.out.println("-" + af);
26 | }
27 | System.out.println("Leaving my mark for posterity...");
28 | File f2 = new File(p + "/rootshell_was_here");
29 | try
30 | {
31 | FileWriter filewriter = new FileWriter(f2);
32 | BufferedWriter out = new BufferedWriter(filewriter);
33 | out.write("This is just a file created using RootShell's Sanity check tools..\n");
34 | out.close();
35 | System.out.println("Done!");
36 | }
37 | catch (IOException e)
38 | {
39 | System.out.println("...and I failed miserably.");
40 | e.printStackTrace();
41 | }
42 |
43 | }
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/sub_projects/RootShell/src/main/java/com/stericson/rootshell/exceptions/RootDeniedException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the RootShell Project: https://github.com/Stericson/RootShell
3 | *
4 | * Copyright (c) 2014 Stephen Erickson, Chris Ravenscroft
5 | *
6 | * This code is dual-licensed under the terms of the Apache License Version 2.0 and
7 | * the terms of the General Public License (GPL) Version 2.
8 | * You may use this code according to either of these licenses as is most appropriate
9 | * for your project on a case-by-case basis.
10 | *
11 | * The terms of each license can be found in the root directory of this project's repository as well as at:
12 | *
13 | * * http://www.apache.org/licenses/LICENSE-2.0
14 | * * http://www.gnu.org/licenses/gpl-2.0.txt
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under these Licenses is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See each License for the specific language governing permissions and
20 | * limitations under that License.
21 | */
22 |
23 | package com.stericson.rootshell.exceptions;
24 |
25 | public class RootDeniedException extends Exception {
26 |
27 | private static final long serialVersionUID = -8713947214162841310L;
28 |
29 | public RootDeniedException(String error) {
30 | super(error);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/sub_projects/RootShell/src/main/java/com/stericson/rootshell/execution/JavaCommand.java:
--------------------------------------------------------------------------------
1 | package com.stericson.rootshell.execution;
2 |
3 | import android.content.Context;
4 |
5 | public class JavaCommand extends Command
6 | {
7 | /**
8 | * Constructor for executing Java commands rather than binaries
9 | *
10 | * @param context needed to execute java command.
11 | */
12 | public JavaCommand(int id, Context context, String... command) {
13 | super(id, command);
14 | this.context = context;
15 | this.javaCommand = true;
16 | }
17 |
18 | /**
19 | * Constructor for executing Java commands rather than binaries
20 | *
21 | * @param context needed to execute java command.
22 | */
23 | public JavaCommand(int id, boolean handlerEnabled, Context context, String... command) {
24 | super(id, handlerEnabled, command);
25 | this.context = context;
26 | this.javaCommand = true;
27 | }
28 |
29 | /**
30 | * Constructor for executing Java commands rather than binaries
31 | *
32 | * @param context needed to execute java command.
33 | */
34 | public JavaCommand(int id, int timeout, Context context, String... command) {
35 | super(id, timeout, command);
36 | this.context = context;
37 | this.javaCommand = true;
38 | }
39 |
40 |
41 | @Override
42 | public void commandOutput(int id, String line)
43 | {
44 | super.commandOutput(id, line);
45 | }
46 |
47 | @Override
48 | public void commandTerminated(int id, String reason)
49 | {
50 | // pass
51 | }
52 |
53 | @Override
54 | public void commandCompleted(int id, int exitCode)
55 | {
56 | // pass
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/sub_projects/RootShell/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RootShell
3 |
4 |
--------------------------------------------------------------------------------
/sub_projects/RootShell/src/test/java/com/example/rootshell/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.rootshell;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/sub_projects/RootTools/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io/api/android,java,intellij
2 |
3 | ### Android ###
4 | # Built application files
5 | *.apk
6 | *.ap_
7 |
8 | # Files for the Dalvik VM
9 | *.dex
10 |
11 | # Java class files
12 | *.class
13 |
14 | # Generated files
15 | bin/
16 | gen/
17 |
18 | # Gradle files
19 | .gradle/
20 | build/
21 |
22 | # Local configuration file (sdk path, etc)
23 | local.properties
24 |
25 | # Proguard folder generated by Eclipse
26 | proguard/
27 |
28 | xactmobile/class_files.txt
29 | xactmobile/mapping.txt
30 | xactmobile/seeds.txt
31 |
32 | # Log Files
33 | *.log
34 |
35 | # Android Studio Navigation editor temp files
36 | .navigation/
37 |
38 | ### Android Patch ###
39 | gen-external-apklibs
40 |
41 |
42 | ### Java ###
43 | *.class
44 |
45 | # Mobile Tools for Java (J2ME)
46 | .mtj.tmp/
47 |
48 | # Package Files #
49 | #*.jar
50 | *.war
51 | *.ear
52 |
53 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
54 | hs_err_pid*
55 |
56 |
57 | ### Intellij ###
58 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
59 |
60 | *.iml
61 |
62 | ## Directory-based project format:
63 | .idea/
64 | # if you remove the above rule, at least ignore the following:
65 |
66 | # User-specific stuff:
67 | .idea/workspace.xml
68 | .idea/tasks.xml
69 | .idea/dictionaries
70 |
71 | # Sensitive or high-churn files:
72 | .idea/dataSources.ids
73 | .idea/dataSources.xml
74 | .idea/sqlDataSources.xml
75 | .idea/dynamic.xml
76 | .idea/uiDesigner.xml
77 |
78 | # Gradle:
79 | .idea/gradle.xml
80 | .idea/libraries
81 |
82 | # Mongo Explorer plugin:
83 | .idea/mongoSettings.xml
84 |
85 | ## File-based project format:
86 | *.ipr
87 | *.iws
88 |
89 | ## Plugin-specific files:
90 |
91 | # IntelliJ
92 | /out/
93 |
94 | # mpeltonen/sbt-idea plugin
95 | .idea_modules/
96 |
97 | # JIRA plugin
98 | atlassian-ide-plugin.xml
99 |
100 | # Crashlytics plugin (for Android Studio and IntelliJ)
101 | com_crashlytics_export_strings.xml
102 | crashlytics.properties
103 | crashlytics-build.properties
104 |
105 | xactmobile/.DS_Store~64be78fe3602626c61b52bcbfd09e09a6107b50a
106 | xactmobile/.DS_Store~HEAD
107 | oslab-viewpager/._.DS_Store
108 | oslab-viewpager/src/main/.DS_Store
109 | oslab-viewpager/src/main/._.DS_Store
110 | oslab-viewpager/src/main/res/.DS_Store
111 | oslab-viewpager/src/main/res/._.DS_Store
112 | oslab-viewpager/.gitignore
113 | oslab-materialdesign/.DS_Store
114 | oslab-materialdesign/._.DS_Store
115 | oslab-materialdesign/src/.DS_Store
116 | oslab-materialdesign/src/._.DS_Store
117 | oslab-materialdesign/src/main/.DS_Store
118 | oslab-materialdesign/src/main/._.DS_Store
119 | oslab-materialdesign/src/main/res/.DS_Store
120 | oslab-materialdesign/src/main/res/._.DS_Store
121 |
--------------------------------------------------------------------------------
/sub_projects/RootTools/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 11
9 | targetSdkVersion 25
10 | }
11 |
12 | buildTypes {
13 | release {
14 | minifyEnabled false
15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
16 | }
17 | }
18 | }
19 |
20 | dependencies {
21 | compile project(':sub_projects:RootShell')
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | testCompile 'junit:junit:4.12'
24 | compile 'com.android.support:appcompat-v7:25.3.1'
25 | }
26 |
--------------------------------------------------------------------------------
/sub_projects/RootTools/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/demollol/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/sub_projects/RootTools/src/androidTest/java/com/example/roottools/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.example.roottools;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/sub_projects/RootTools/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/sub_projects/RootTools/src/main/java/com/stericson/roottools/Constants.java:
--------------------------------------------------------------------------------
1 | package com.stericson.roottools;
2 |
3 | public class Constants
4 | {
5 | public static final String TAG = "RootTools v4.2";
6 | public static final int FPS = 1;
7 | public static final int BBA = 3;
8 | public static final int BBV = 4;
9 | public static final int GI = 5;
10 | public static final int GS = 6;
11 | public static final int GSYM = 7;
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/sub_projects/RootTools/src/main/java/com/stericson/roottools/containers/Mount.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the RootTools Project: http://code.google.com/p/roottools/
3 | *
4 | * Copyright (c) 2012 Stephen Erickson, Chris Ravenscroft, Dominik Schuermann, Adam Shanks
5 | *
6 | * This code is dual-licensed under the terms of the Apache License Version 2.0 and
7 | * the terms of the General Public License (GPL) Version 2.
8 | * You may use this code according to either of these licenses as is most appropriate
9 | * for your project on a case-by-case basis.
10 | *
11 | * The terms of each license can be found in the root directory of this project's repository as well as at:
12 | *
13 | * * http://www.apache.org/licenses/LICENSE-2.0
14 | * * http://www.gnu.org/licenses/gpl-2.0.txt
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under these Licenses is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See each License for the specific language governing permissions and
20 | * limitations under that License.
21 | */
22 |
23 | package com.stericson.roottools.containers;
24 |
25 | import java.io.File;
26 | import java.util.Arrays;
27 | import java.util.LinkedHashSet;
28 | import java.util.Set;
29 |
30 | public class Mount
31 | {
32 | final File mDevice;
33 | final File mMountPoint;
34 | final String mType;
35 | final Set mFlags;
36 |
37 | public Mount(File device, File path, String type, String flagsStr)
38 | {
39 | mDevice = device;
40 | mMountPoint = path;
41 | mType = type;
42 | mFlags = new LinkedHashSet(Arrays.asList(flagsStr.split(",")));
43 | }
44 |
45 | public File getDevice()
46 | {
47 | return mDevice;
48 | }
49 |
50 | public File getMountPoint()
51 | {
52 | return mMountPoint;
53 | }
54 |
55 | public String getType()
56 | {
57 | return mType;
58 | }
59 |
60 | public Set getFlags()
61 | {
62 | return mFlags;
63 | }
64 |
65 | @Override
66 | public String toString()
67 | {
68 | return String.format("%s on %s type %s %s", mDevice, mMountPoint, mType, mFlags);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/sub_projects/RootTools/src/main/java/com/stericson/roottools/containers/Permissions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the RootTools Project: http://code.google.com/p/roottools/
3 | *
4 | * Copyright (c) 2012 Stephen Erickson, Chris Ravenscroft, Dominik Schuermann, Adam Shanks
5 | *
6 | * This code is dual-licensed under the terms of the Apache License Version 2.0 and
7 | * the terms of the General Public License (GPL) Version 2.
8 | * You may use this code according to either of these licenses as is most appropriate
9 | * for your project on a case-by-case basis.
10 | *
11 | * The terms of each license can be found in the root directory of this project's repository as well as at:
12 | *
13 | * * http://www.apache.org/licenses/LICENSE-2.0
14 | * * http://www.gnu.org/licenses/gpl-2.0.txt
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under these Licenses is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See each License for the specific language governing permissions and
20 | * limitations under that License.
21 | */
22 |
23 | package com.stericson.roottools.containers;
24 |
25 | public class Permissions
26 | {
27 | String type;
28 | String user;
29 | String group;
30 | String other;
31 | String symlink;
32 | int permissions;
33 |
34 | public String getSymlink()
35 | {
36 | return this.symlink;
37 | }
38 |
39 | public String getType()
40 | {
41 | return type;
42 | }
43 |
44 | public int getPermissions()
45 | {
46 | return this.permissions;
47 | }
48 |
49 | public String getUserPermissions()
50 | {
51 | return this.user;
52 | }
53 |
54 | public String getGroupPermissions()
55 | {
56 | return this.group;
57 | }
58 |
59 | public String getOtherPermissions()
60 | {
61 | return this.other;
62 | }
63 |
64 | public void setSymlink(String symlink)
65 | {
66 | this.symlink = symlink;
67 | }
68 |
69 | public void setType(String type)
70 | {
71 | this.type = type;
72 | }
73 |
74 | public void setPermissions(int permissions)
75 | {
76 | this.permissions = permissions;
77 | }
78 |
79 | public void setUserPermissions(String user)
80 | {
81 | this.user = user;
82 | }
83 |
84 | public void setGroupPermissions(String group)
85 | {
86 | this.group = group;
87 | }
88 |
89 | public void setOtherPermissions(String other)
90 | {
91 | this.other = other;
92 | }
93 |
94 | public String getUser()
95 | {
96 | return user;
97 | }
98 |
99 | public void setUser(String user)
100 | {
101 | this.user = user;
102 | }
103 |
104 | public String getGroup()
105 | {
106 | return group;
107 | }
108 |
109 | public void setGroup(String group)
110 | {
111 | this.group = group;
112 | }
113 |
114 | public String getOther()
115 | {
116 | return other;
117 | }
118 |
119 | public void setOther(String other)
120 | {
121 | this.other = other;
122 | }
123 |
124 |
125 | }
126 |
--------------------------------------------------------------------------------
/sub_projects/RootTools/src/main/java/com/stericson/roottools/containers/Symlink.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the RootTools Project: http://code.google.com/p/roottools/
3 | *
4 | * Copyright (c) 2012 Stephen Erickson, Chris Ravenscroft, Dominik Schuermann, Adam Shanks
5 | *
6 | * This code is dual-licensed under the terms of the Apache License Version 2.0 and
7 | * the terms of the General Public License (GPL) Version 2.
8 | * You may use this code according to either of these licenses as is most appropriate
9 | * for your project on a case-by-case basis.
10 | *
11 | * The terms of each license can be found in the root directory of this project's repository as well as at:
12 | *
13 | * * http://www.apache.org/licenses/LICENSE-2.0
14 | * * http://www.gnu.org/licenses/gpl-2.0.txt
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under these Licenses is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See each License for the specific language governing permissions and
20 | * limitations under that License.
21 | */
22 |
23 | package com.stericson.roottools.containers;
24 |
25 | import java.io.File;
26 |
27 | public class Symlink
28 | {
29 | protected final File file;
30 | protected final File symlinkPath;
31 |
32 | public Symlink(File file, File path)
33 | {
34 | this.file = file;
35 | symlinkPath = path;
36 | }
37 |
38 | public File getFile()
39 | {
40 | return this.file;
41 | }
42 |
43 | public File getSymlinkPath()
44 | {
45 | return symlinkPath;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sub_projects/RootTools/src/main/java/com/stericson/roottools/internal/InternalVariables.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the RootTools Project: http://code.google.com/p/roottools/
3 | *
4 | * Copyright (c) 2012 Stephen Erickson, Chris Ravenscroft, Dominik Schuermann, Adam Shanks
5 | *
6 | * This code is dual-licensed under the terms of the Apache License Version 2.0 and
7 | * the terms of the General Public License (GPL) Version 2.
8 | * You may use this code according to either of these licenses as is most appropriate
9 | * for your project on a case-by-case basis.
10 | *
11 | * The terms of each license can be found in the root directory of this project's repository as well as at:
12 | *
13 | * * http://www.apache.org/licenses/LICENSE-2.0
14 | * * http://www.gnu.org/licenses/gpl-2.0.txt
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under these Licenses is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See each License for the specific language governing permissions and
20 | * limitations under that License.
21 | */
22 |
23 | package com.stericson.roottools.internal;
24 |
25 | import java.util.ArrayList;
26 | import java.util.regex.Pattern;
27 |
28 | import com.stericson.roottools.containers.Mount;
29 | import com.stericson.roottools.containers.Permissions;
30 | import com.stericson.roottools.containers.Symlink;
31 |
32 | public class InternalVariables
33 | {
34 |
35 | // ----------------------
36 | // # Internal Variables #
37 | // ----------------------
38 |
39 |
40 | protected static boolean nativeToolsReady = false;
41 | protected static boolean found = false;
42 | protected static boolean processRunning = false;
43 |
44 | protected static String[] space;
45 | protected static String getSpaceFor;
46 | protected static String busyboxVersion;
47 | protected static String pid_list = "";
48 | protected static ArrayList mounts;
49 | protected static ArrayList symlinks;
50 | protected static String inode = "";
51 | protected static Permissions permissions;
52 |
53 | // regex to get pid out of ps line, example:
54 | // root 2611 0.0 0.0 19408 2104 pts/2 S 13:41 0:00 bash
55 | protected static final String PS_REGEX = "^\\S+\\s+([0-9]+).*$";
56 | protected static Pattern psPattern;
57 |
58 | static
59 | {
60 | psPattern = Pattern.compile(PS_REGEX);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/sub_projects/RootTools/src/main/java/com/stericson/roottools/internal/Runner.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the RootTools Project: http://code.google.com/p/roottools/
3 | *
4 | * Copyright (c) 2012 Stephen Erickson, Chris Ravenscroft, Dominik Schuermann, Adam Shanks
5 | *
6 | * This code is dual-licensed under the terms of the Apache License Version 2.0 and
7 | * the terms of the General Public License (GPL) Version 2.
8 | * You may use this code according to either of these licenses as is most appropriate
9 | * for your project on a case-by-case basis.
10 | *
11 | * The terms of each license can be found in the root directory of this project's repository as well as at:
12 | *
13 | * * http://www.apache.org/licenses/LICENSE-2.0
14 | * * http://www.gnu.org/licenses/gpl-2.0.txt
15 | *
16 | * Unless required by applicable law or agreed to in writing, software
17 | * distributed under these Licenses is distributed on an "AS IS" BASIS,
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | * See each License for the specific language governing permissions and
20 | * limitations under that License.
21 | */
22 |
23 | package com.stericson.roottools.internal;
24 |
25 | import java.io.IOException;
26 |
27 | import com.stericson.rootshell.execution.Command;
28 | import com.stericson.rootshell.execution.Shell;
29 | import com.stericson.roottools.RootTools;
30 |
31 | import android.content.Context;
32 | import android.util.Log;
33 |
34 | public class Runner extends Thread
35 | {
36 |
37 | private static final String LOG_TAG = "RootTools::Runner";
38 |
39 | Context context;
40 | String binaryName;
41 | String parameter;
42 |
43 | public Runner(Context context, String binaryName, String parameter)
44 | {
45 | this.context = context;
46 | this.binaryName = binaryName;
47 | this.parameter = parameter;
48 | }
49 |
50 | public void run()
51 | {
52 | String privateFilesPath = null;
53 | try
54 | {
55 | privateFilesPath = context.getFilesDir().getCanonicalPath();
56 | }
57 | catch (IOException e)
58 | {
59 | if (RootTools.debugMode)
60 | {
61 | Log.e(LOG_TAG, "Problem occured while trying to locate private files directory!");
62 | }
63 | e.printStackTrace();
64 | }
65 | if (privateFilesPath != null)
66 | {
67 | try
68 | {
69 | Command command = new Command(0, false, privateFilesPath + "/" + binaryName + " " + parameter);
70 | Shell.startRootShell().add(command);
71 | commandWait(command);
72 |
73 | }
74 | catch (Exception e)
75 | {
76 | }
77 | }
78 | }
79 |
80 | private void commandWait(Command cmd)
81 | {
82 | synchronized (cmd)
83 | {
84 | try
85 | {
86 | if (!cmd.isFinished())
87 | {
88 | cmd.wait(2000);
89 | }
90 | }
91 | catch (InterruptedException e)
92 | {
93 | e.printStackTrace();
94 | }
95 | }
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/sub_projects/RootTools/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RootTools
3 |
4 |
--------------------------------------------------------------------------------
/sub_projects/RootTools/src/test/java/com/example/roottools/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.roottools;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------