Skip to content

Commit

Permalink
Update [2.3.11]
Browse files Browse the repository at this point in the history
-Error while creating backups fixed on more devices
-Restore on wrong partition fixed (sorry)
-CyanogenMod Recoveries added to Rashr :)
-TWRP images updated!!
-Licences added
-Some other bugs fixed
  • Loading branch information
Aschot Mkrtchyan committed Mar 29, 2016
1 parent c4be421 commit 2f4ba27
Show file tree
Hide file tree
Showing 26 changed files with 5,148 additions and 3,741 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
CHANGELOG
====================
=========

Update [2.3.11]

-Error while creating backups fixed on more devices
-Restore on wrong partition fixed (sorry)
-CyanogenMod Recoveries added to Rashr :)
-TWRP images updated!!
-Licences added
-Some other bugs fixed

Update [2.3.10]

Expand Down
Binary file modified RashrApp/RashrApp-release.apk
Binary file not shown.
15 changes: 8 additions & 7 deletions RashrApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 8
versionCode 107
versionName '2.3.10'
versionCode 108
versionName '2.3.11'
}
lintOptions {
abortOnError false
Expand All @@ -19,8 +19,9 @@ dependencies {
compile project(':Utils-Library')
compile project(':CardsUILib')
compile project(':Donations')
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'de.psdev.licensesdialog:licensesdialog:1.8.0'
}
75 changes: 50 additions & 25 deletions RashrApp/src/main/java/de/mkrtchyan/recoverytools/FlashUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,26 +127,33 @@ protected void onPreExecute() {

@Override
protected Boolean doInBackground(Void... params) {
try {
if (!Common.getBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SKIP_IMAGE_CHECK)) {
if (!isJobBackup()) {
if (mCustomIMG.toString().endsWith(Device.EXT_IMG)) {
if (!isImageValid(mCustomIMG)) {
throw new ImageNotValidException(mCustomIMG);
}
if (!Common.getBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SKIP_IMAGE_CHECK)) {
if (!isJobBackup()) {
if (mCustomIMG.toString().endsWith(Device.EXT_IMG)) {
if (!isImageValid(mCustomIMG)) {
mException = new ImageNotValidException(mCustomIMG);
return false;
}
}
}
if (isJobXZDual()) {
}
if (isJobXZDual()) {
try {
installXZDual();
return true;
}
int PartitionType = 0;
if (isJobRecovery()) {
PartitionType = RashrApp.DEVICE.getRecoveryType();
} else if (isJobKernel()) {
PartitionType = RashrApp.DEVICE.getKernelType();
} catch (FailedExecuteCommand failedExecuteCommand) {
failedExecuteCommand.printStackTrace();
mException = failedExecuteCommand;
return false;
}
return true;
}
int PartitionType = 0;
if (isJobRecovery()) {
PartitionType = RashrApp.DEVICE.getRecoveryType();
} else if (isJobKernel()) {
PartitionType = RashrApp.DEVICE.getKernelType();
}
try {
switch (PartitionType) {
case Device.PARTITION_TYPE_MTD:
MTD();
Expand All @@ -160,12 +167,12 @@ protected Boolean doInBackground(Void... params) {
default:
return false;
}
saveHistory();
return true;
} catch (final Exception e) {
} catch (FailedExecuteCommand | IOException | ImageToBigException e) {
mException = e;
return false;
}
saveHistory();
/** If there is not any exception everything was ok */
return mException == null;
}

protected void onPostExecute(Boolean success) {
Expand Down Expand Up @@ -198,7 +205,7 @@ public void run() {
}
}

public void DD() throws FailedExecuteCommand, IOException {
public void DD() throws FailedExecuteCommand, IOException, ImageToBigException {
Thread observer;

if (isJobBackup() && (isJobRecovery() ? RashrApp.DEVICE.isRecoveryDD() : RashrApp.DEVICE.isKernelDD())) {
Expand Down Expand Up @@ -227,16 +234,14 @@ public void run() {
});
observer.start();
}
if (Common.getBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SKIP_SIZE_CHECK)) {
if (!Common.getBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SKIP_SIZE_CHECK)) {
if (isJobFlash()) {
int customSize = getSizeOfFile(mCustomIMG);
int partitionSize = getSizeOfFile(mPartition);
/** ERROR on some chinese devices. Partition size always 0 */
if (partitionSize != 0) {
if (customSize > partitionSize) {
throw new IOException("IMG is to big for your device! IMG Size: " +
customSize / (1024 * 1024) + "MB Partition Size: " +
partitionSize / (1024 * 1024) + "MB");
throw new ImageToBigException(customSize, partitionSize);
}
}
}
Expand Down Expand Up @@ -360,7 +365,7 @@ public void onCancel(DialogInterface dialogInterface) {
.show();
}

private void placeImgBack() throws IOException, FailedExecuteCommand {
private void placeImgBack() throws FailedExecuteCommand {
RashrApp.SHELL.execCommand(Const.Busybox + " chmod 777 \"" + tmpFile + "\"");
RashrApp.SHELL.execCommand(Const.Busybox + " mv \"" + tmpFile + "\" \"" + mCustomIMG + "\"");
}
Expand Down Expand Up @@ -494,4 +499,24 @@ public String getPath() {
}
}

public class ImageToBigException extends Exception {
private int mCustomSize;
private int mPartitionSize;
public ImageToBigException(int customSize, int partitionSize) {
super("IMG is to big for your device! IMG Size: " +
customSize / (1024 * 1024) + "MB Partition Size: " +
partitionSize / (1024 * 1024) + "MB");
mCustomSize = customSize;
mPartitionSize = partitionSize;
}

public int getCustomSize() {
return mCustomSize;
}

public int getPartitionSize() {
return mPartitionSize;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

public class InformationFragment extends Fragment {

//private OnListFragmentInteractionListener mListener;

/**
* Mandatory empty constructor for the fragment manager to instantiate the
* fragment (e.g. upon screen orientation changes).
Expand Down Expand Up @@ -79,7 +77,7 @@ public View onCreateView(LayoutInflater inflater, final ViewGroup container,
kernelType = "Not supported";
}

items.add(new InformationItem("Recovery Partition Type", recoveryType));
items.add(new InformationItem(getString(R.string.recovery_type), recoveryType));
if (recoveryWithPath)
items.add(new InformationItem("Recovery Path", RashrApp.DEVICE.getRecoveryPath()));
if (recoveryWithBS)
Expand All @@ -94,7 +92,7 @@ public View onCreateView(LayoutInflater inflater, final ViewGroup container,
int total = 0;
if (RashrApp.DEVICE.isCwmRecoverySupported()) {
int tmp = RashrApp.DEVICE.getCwmRecoveryVersions().size();
items.add(new InformationItem("CWM Images", String.valueOf(tmp)));
items.add(new InformationItem(getString(R.string.sCWM), String.valueOf(tmp)));
total += tmp;
}
if (RashrApp.DEVICE.isTwrpRecoverySupported()) {
Expand All @@ -114,55 +112,23 @@ public View onCreateView(LayoutInflater inflater, final ViewGroup container,
}
if (RashrApp.DEVICE.isStockRecoverySupported()){
int tmp = RashrApp.DEVICE.getStockRecoveryVersions().size();
items.add(new InformationItem("Stock Recovery Images", String.valueOf(tmp)));
items.add(new InformationItem(getString(R.string.stock_recovery), String.valueOf(tmp)));
total += tmp;
}
if (RashrApp.DEVICE.isStockKernelSupported()){
int tmp = RashrApp.DEVICE.getStockKernelVersions().size();
items.add(new InformationItem("Stock Kernel Images", String.valueOf(tmp)));
items.add(new InformationItem(getString(R.string.stock_kernel), String.valueOf(tmp)));
total += tmp;
}

items.add(new InformationItem("Total images avaiable", String.valueOf(total)));
items.add(new InformationItem(getString(R.string.total_images), String.valueOf(total)));

for (String err : RashrApp.ERRORS) {
items.add(new InformationItem("Err", err));
items.add(new InformationItem("Error:", err));
}

recyclerView.setAdapter(new InformationRecyclerViewAdapter(items));
}
return view;
}


@Override
public void onAttach(Context context) {
super.onAttach(context);
//mListener = new OnListFragmentInteractionListener() {
// @Override
// public void onListFragmentInteraction(InformationItem item) {
//
// }
//};
}

@Override
public void onDetach() {
super.onDetach();
//mListener = null;
}

/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p/>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
//public interface OnListFragmentInteractionListener {
// void onListFragmentInteraction(InformationItem item);
//}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void run() {
try {
extractFiles();
} catch (IOException e) {
RashrApp.ERRORS.add(Const.RASHR_TAG + " Failed to extract files. Error: " + e);
RashrApp.ERRORS.add("Failed to extract files. Error: " + e);
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
Expand Down Expand Up @@ -248,7 +248,7 @@ public void run() {
}
} catch (NullPointerException e) {
setContentView(R.layout.err_layout);
RashrApp.ERRORS.add(Const.RASHR_TAG + " Error while inflating layout:" + e);
RashrApp.ERRORS.add("Error while inflating layout:" + e);
AppCompatTextView tv = (AppCompatTextView) findViewById(R.id.tvErr);
try {
if (tv != null) {
Expand Down Expand Up @@ -338,6 +338,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
try {
RashrApp.TOOLBOX.reboot(Toolbox.REBOOT_RECOVERY);
} catch (Exception e) {
Toast.makeText(mContext, R.string.reboot_failed, Toast.LENGTH_SHORT).show();
RashrApp.ERRORS.add(Const.RASHR_TAG + " Device could not be rebooted");
}
}
Expand Down Expand Up @@ -500,6 +501,7 @@ private Shell startShell() throws IOException {
try {
shell = Shell.startRootShell();
} catch (IOException e) {
RashrApp.ERRORS.add("Root-Shell could not be started " + e);
if (BuildConfig.DEBUG) {
/** ignore root access error on Debug Rashr, use normal shell*/
shell = Shell.startShell();
Expand Down
Loading

0 comments on commit 2f4ba27

Please sign in to comment.