Skip to content

Commit

Permalink
Generalized remount, removed some file handles
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy Caraballo committed Mar 6, 2010
1 parent 436a587 commit 9534550
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="10"
android:versionCode="11"
android:versionName="0.8" package="net.pixelpod.typefresh">
<supports-screens
android:largeScreens="true"
Expand Down
2 changes: 2 additions & 0 deletions src/net/pixelpod/typefresh/FileCopier.java
Expand Up @@ -63,6 +63,8 @@ protected Void doInBackground(Object... params) {
needReboot = true;
}
}
// clear up references, since we're done
su.destroy();
}

if (!TypeFresh.remount(TypeFresh.READ_ONLY)) {
Expand Down
11 changes: 8 additions & 3 deletions src/net/pixelpod/typefresh/TypeFresh.java
Expand Up @@ -68,6 +68,9 @@ public void onCreate(Bundle savedInstanceState) {

File fontsDir = new File("/system/fonts");
fonts = fontsDir.list();
// remove all file references for the sake of remounting
fontsDir = null;

Arrays.sort(fonts);
sysFontPaths = new String[fonts.length];

Expand Down Expand Up @@ -174,10 +177,12 @@ public boolean onCreateOptionsMenu(Menu menu) {

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// if the user hasn't selected any fonts, the next two menu items are useless
boolean pathsSet = !Arrays.equals(sysFontPaths, adapter.getPaths());
menu.findItem(MENU_APPLY).setEnabled(pathsSet);
menu.findItem(MENU_RESET).setEnabled(pathsSet);
// TODO: Is there somewhere else I could do this?

// Check for a backup to see if we should enable the restore option
backupExists = true;
for (int i = 0; i < adapter.getFonts().length; i++) {
// check if any existing fonts are not backed up
Expand Down Expand Up @@ -440,7 +445,7 @@ public static boolean remount(int readwrite) {
try {
Process su = Runtime.getRuntime().exec("/system/bin/su");
Log.i(TAG,"Remounting /system " + type);
String cmd = "mount -o remount," + type + " -t yaffs2 /dev/block/mtdblock3 /system\nexit\n";
String cmd = "mount -o " + type + ",remount /system\nexit\n";
su.getOutputStream().write(cmd.getBytes());

if (su.waitFor() != 0) {
Expand All @@ -459,4 +464,4 @@ public static boolean remount(int readwrite) {
}
return true;
}
}
}

0 comments on commit 9534550

Please sign in to comment.