Skip to content

Commit

Permalink
Merge branch 'release-1.4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteckler committed Oct 20, 2014
2 parents 09738b9 + 4c795a6 commit 907ea39
Show file tree
Hide file tree
Showing 12 changed files with 625 additions and 206 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId 'com.ryansteckler.nlpunbounce'
minSdkVersion 16
targetSdkVersion 20
versionCode 31
versionName '1.4'
versionCode 32
versionName '1.4.1'
}
buildTypes {
release {
Expand Down
49 changes: 33 additions & 16 deletions app/src/main/java/com/ryansteckler/nlpunbounce/HomeFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.LinearLayout;
Expand All @@ -50,8 +49,6 @@
import com.ryansteckler.nlpunbounce.models.UnbounceStatsCollection;


import org.w3c.dom.Text;

import java.io.File;


Expand Down Expand Up @@ -141,15 +138,15 @@ private void handleSetup(final View view) {
//Let's find out why the service isn't running:
if (!isUnbounceServiceRunning()) {
mSetupFailureStep = SETUP_FAILURE_SERVICE;
}
if (!isXposedRunning()) {
mSetupFailureStep = SETUP_FAILURE_XPOSED_RUNNING;
}
if (!isXposedInstalled()) {
mSetupFailureStep = SETUP_FAILURE_XPOSED_INSTALL;
}
if (!RootHelper.isDeviceRooted()) {
mSetupFailureStep = SETUP_FAILURE_ROOT;
if (!isXposedRunning()) {
mSetupFailureStep = SETUP_FAILURE_XPOSED_RUNNING;
if (!isXposedInstalled()) {
mSetupFailureStep = SETUP_FAILURE_XPOSED_INSTALL;
if (!RootHelper.isDeviceRooted()) {
mSetupFailureStep = SETUP_FAILURE_ROOT;
}
}
}
}

//Disable navigation away from the welcome banner. //TODO: Fade the home bar?
Expand Down Expand Up @@ -647,7 +644,7 @@ private void updatePremiumUi() {
private void loadStatsFromSource(final View view) {
final UnbounceStatsCollection stats = UnbounceStatsCollection.getInstance();
final Context c = getActivity();
String duration = stats.getDurationAllowedFormatted(c, UnbounceStatsCollection.STAT_CURRENT);
String duration = stats.getWakelockDurationAllowedFormatted(c, UnbounceStatsCollection.STAT_CURRENT);
//Wakelocks
TextView textView = (TextView)view.findViewById(R.id.textLocalWakeTimeAllowed);
textView.setText(duration);
Expand All @@ -658,7 +655,13 @@ private void loadStatsFromSource(final View view) {
textView = (TextView)view.findViewById(R.id.textLocalWakeBlocked);
textView.setText(String.valueOf(stats.getTotalBlockWakelockCount(c, UnbounceStatsCollection.STAT_CURRENT)));
textView = (TextView)view.findViewById(R.id.textLocalWakeTimeBlocked);
textView.setText(stats.getDurationBlockedFormatted(c, UnbounceStatsCollection.STAT_CURRENT));
textView.setText(stats.getWakelockDurationBlockedFormatted(c, UnbounceStatsCollection.STAT_CURRENT));

//Services
textView = (TextView)view.findViewById(R.id.textLocalServiceAcquired);
textView.setText(String.valueOf(stats.getTotalAllowedServiceCount(c, UnbounceStatsCollection.STAT_CURRENT)));
textView = (TextView)view.findViewById(R.id.textLocalServiceBlocked);
textView.setText(String.valueOf(stats.getTotalBlockServiceCount(c, UnbounceStatsCollection.STAT_CURRENT)));

//Alarms
textView = (TextView)view.findViewById(R.id.textLocalAlarmsAcquired);
Expand All @@ -674,14 +677,21 @@ private void loadStatsFromSource(final View view) {
stats.getStatsFromNetwork(c, new Handler() {
@Override
public void handleMessage(Message msg) {
//Global wakelocks
TextView textView = (TextView)view.findViewById(R.id.textGlobalWakelockDurationAllowed);
textView.setText(stats.getDurationAllowedFormatted(c, UnbounceStatsCollection.STAT_GLOBAL));
textView.setText(stats.getWakelockDurationAllowedFormatted(c, UnbounceStatsCollection.STAT_GLOBAL));
textView = (TextView)view.findViewById(R.id.textGlobalWakelockAllowed);
textView.setText(String.valueOf(stats.getTotalAllowedWakelockCount(c, UnbounceStatsCollection.STAT_GLOBAL)));
textView = (TextView)view.findViewById(R.id.textGlobalWakelockBlocked);
textView.setText(String.valueOf(stats.getTotalBlockWakelockCount(c, UnbounceStatsCollection.STAT_GLOBAL)));
textView = (TextView)view.findViewById(R.id.textGlobalWakelockDurationBlocked);
textView.setText(stats.getDurationBlockedFormatted(c, UnbounceStatsCollection.STAT_GLOBAL));
textView.setText(stats.getWakelockDurationBlockedFormatted(c, UnbounceStatsCollection.STAT_GLOBAL));

//Global services
textView = (TextView)view.findViewById(R.id.textGlobalServiceAllowed);
textView.setText(String.valueOf(stats.getTotalAllowedServiceCount(c, UnbounceStatsCollection.STAT_GLOBAL)));
textView = (TextView)view.findViewById(R.id.textGlobalServiceBlocked);
textView.setText(String.valueOf(stats.getTotalBlockServiceCount(c, UnbounceStatsCollection.STAT_GLOBAL)));

//Global Alarms
textView = (TextView)view.findViewById(R.id.textGlobalAlarmAllowed);
Expand All @@ -692,6 +702,7 @@ public void handleMessage(Message msg) {
}
});
} else {
//Global wakelocks
textView = (TextView)view.findViewById(R.id.textGlobalWakelockDurationAllowed);
textView.setText(getResources().getString(R.string.stat_disabled));
textView = (TextView)view.findViewById(R.id.textGlobalWakelockAllowed);
Expand All @@ -701,6 +712,12 @@ public void handleMessage(Message msg) {
textView = (TextView)view.findViewById(R.id.textGlobalWakelockDurationBlocked);
textView.setText(getResources().getString(R.string.stat_disabled));

//Global services
textView = (TextView)view.findViewById(R.id.textGlobalServiceAllowed);
textView.setText(getResources().getString(R.string.stat_disabled));
textView = (TextView)view.findViewById(R.id.textGlobalServiceBlocked);
textView.setText(getResources().getString(R.string.stat_disabled));

//Global Alarms
textView = (TextView)view.findViewById(R.id.textGlobalAlarmAllowed);
textView.setText(getResources().getString(R.string.stat_disabled));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.ryansteckler.nlpunbounce.models.BaseStats;
import com.ryansteckler.nlpunbounce.models.InterimWakelock;
import com.ryansteckler.nlpunbounce.models.UnbounceStatsCollection;
import com.ryansteckler.nlpunbounce.models.WakelockStats;

import java.util.HashMap;

public class XposedReceiver extends BroadcastReceiver {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,29 @@ public class RootHelper {
/** @author Kevin Kowalewski */

public static boolean isDeviceRooted() {
return checkRootMethod1() || checkRootMethod2() || checkRootMethod3();
return checkRootMethod1() || checkRootMethod2() || checkRootMethod3() || checkRootMethod4();
}

public static boolean checkRootMethod1() {
String buildTags = android.os.Build.TAGS;
return buildTags != null && buildTags.contains("test-keys");
}

public static boolean checkRootMethod2() {
try {
File file = new File("/system/app/Superuser.apk");
return file.exists();
} catch (Exception e) {return false;}
}
public static boolean checkRootMethod2() {
try {
File file = new File("/system/app/Superuser.apk");
return file.exists();
} catch (Exception e) {return false;}
}

public static boolean checkRootMethod4() {
try {
File file = new File("/system/xbin/su");
return file.exists();
} catch (Exception e) {return false;}
}

public static boolean checkRootMethod3() {
public static boolean checkRootMethod3() {
return new ExecShell().executeCommand(ExecShell.SHELL_CMD.check_su_binary)!=null;
}
}
Expand Down
Loading

0 comments on commit 907ea39

Please sign in to comment.