Skip to content

Commit

Permalink
handle mounting safely
Browse files Browse the repository at this point in the history
  • Loading branch information
JBirdVegas committed Jan 16, 2012
1 parent 92adb54 commit 1c26ab1
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/com/liquid/settings/switches/BootAnimSwitch.java
Expand Up @@ -78,18 +78,17 @@ public int establishState() {

public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (mStateMachineEvent) {
Log.d(TAG, "mStateMachineEvent is true returning");
Log.d(TAG, "onCheckedChanged mStateMachineEvent is true returning");
return;
} else {
Log.d(TAG, "onCheckedChanged mStateMachienEvent is false not returning");
}

boolean success_0 = false;
boolean success_1 = false;
//TODO handle mounting for killing and appending prop

//we can only dyanically set android:id to an int so we parce our real name and use an variable for reference
try {
int bootanimation_android_id = Integer.parseInt("bootanimations_preference_screen");
} catch(NumberFormatException nfe) {
Log.d(TAG, "Could not parse " + nfe);
if (!RootHelper.remountRW()) {
throw new RuntimeException("we couldn't mount /system");
}

if (isChecked) {
Expand All @@ -101,8 +100,18 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
success_1 = RootHelper.killProp(String.format(KILL_PROP_CMD, "debug.sf.nobootanimation"));
Global.bootanimations_switch_on = false;
}
if (!success_0 && ! success_1) {

if (!success_0) {
//TODO do something when we fail
Log.d(TAG, "ro.kernel.android.bootanim failed");
} else if (!success_1) {
//TODO find a way to handle these failures gracefully
Log.d(TAG, "debug.sf.nobootanimation failed");
}

if (!RootHelper.remountRO()) {
Log.d(TAG, "Couldn't remount /system as read only");
//TODO notify user of failure
}
return;
}
Expand Down

0 comments on commit 1c26ab1

Please sign in to comment.