aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/filemanager/console/java/JavaConsole.java
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2014-10-28 03:26:42 +0100
committerJorge Ruesga <jorge@ruesga.com>2014-11-10 23:16:25 +0000
commit877d4660622ebcaa992f05396237169c289470c4 (patch)
treeb254cb04803096aa9695f42e1bcc914ba09e12fd /src/com/cyanogenmod/filemanager/console/java/JavaConsole.java
parentfcb4908c2c949f55ec966e09a0a91210dff2ca3f (diff)
downloadandroid_packages_apps_CMFileManager-877d4660622ebcaa992f05396237169c289470c4.tar.gz
android_packages_apps_CMFileManager-877d4660622ebcaa992f05396237169c289470c4.tar.bz2
android_packages_apps_CMFileManager-877d4660622ebcaa992f05396237169c289470c4.zip
cmfm: secure storage and other improvements
This patch adds support for virtual filesystems and implements a SecureStorage filesystem (a password protected area) mounted in /storage or /sdcard/storage (in chrooted environments). Also includes a better print support and a cleanup of the code and design of the menu drawer. Bump version to 2.0.0 Required: https://github.com/jruesga/android_external_libtruezip located in external/libtruezip Patchset 4: Fix selection of unmounted virtual storages. Fix actions on virtual mount points folders. Fix strings and typos. Change drop for delete secure storage. Patchset 5: Move actionbar buttons to navigation drawer Remove history position Patchset 6: Update theme preview images Fix filesystem status image on theme change Patchset 7: Fix binary file detection in editor (including unicode files) Patchset 8: Fix unsafe operations in virtual mountpoint logic Patchset 9: Rebase Change-Id: I65511352ca649dcbf238c8b07cf8c22465296e8e Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/com/cyanogenmod/filemanager/console/java/JavaConsole.java')
-rw-r--r--src/com/cyanogenmod/filemanager/console/java/JavaConsole.java122
1 files changed, 10 insertions, 112 deletions
diff --git a/src/com/cyanogenmod/filemanager/console/java/JavaConsole.java b/src/com/cyanogenmod/filemanager/console/java/JavaConsole.java
index daf30525..f59f7461 100644
--- a/src/com/cyanogenmod/filemanager/console/java/JavaConsole.java
+++ b/src/com/cyanogenmod/filemanager/console/java/JavaConsole.java
@@ -17,43 +17,31 @@
package com.cyanogenmod.filemanager.console.java;
import android.content.Context;
-import android.os.Process;
import android.util.Log;
import com.cyanogenmod.filemanager.commands.Executable;
import com.cyanogenmod.filemanager.commands.ExecutableFactory;
-import com.cyanogenmod.filemanager.commands.SIGNAL;
import com.cyanogenmod.filemanager.commands.java.JavaExecutableFactory;
import com.cyanogenmod.filemanager.commands.java.Program;
import com.cyanogenmod.filemanager.console.CommandNotFoundException;
-import com.cyanogenmod.filemanager.console.Console;
import com.cyanogenmod.filemanager.console.ConsoleAllocException;
import com.cyanogenmod.filemanager.console.ExecutionException;
import com.cyanogenmod.filemanager.console.InsufficientPermissionsException;
import com.cyanogenmod.filemanager.console.NoSuchFileOrDirectory;
import com.cyanogenmod.filemanager.console.OperationTimeoutException;
import com.cyanogenmod.filemanager.console.ReadOnlyFilesystemException;
-import com.cyanogenmod.filemanager.model.AID;
-import com.cyanogenmod.filemanager.model.Group;
-import com.cyanogenmod.filemanager.model.Identity;
-import com.cyanogenmod.filemanager.model.User;
-import com.cyanogenmod.filemanager.util.AIDHelper;
-
-import java.util.ArrayList;
+import com.cyanogenmod.filemanager.console.VirtualConsole;
/**
- * An implementation of a {@link Console} based on a java implementation.<br/>
+ * An implementation of a {@link VirtualConsole} based on a java implementation.<br/>
* <br/>
* This console is a non-privileged console an many of the functionality is not implemented
* because can't be obtain from java api.
*/
-public final class JavaConsole extends Console {
+public final class JavaConsole extends VirtualConsole {
private static final String TAG = "JavaConsole"; //$NON-NLS-1$
- private boolean mActive;
-
- private final Context mCtx;
private final int mBufferSize;
/**
@@ -63,45 +51,17 @@ public final class JavaConsole extends Console {
* @param bufferSize The buffer size
*/
public JavaConsole(Context ctx, int bufferSize) {
- super();
- this.mCtx = ctx;
+ super(ctx);
this.mBufferSize = bufferSize;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public void alloc() throws ConsoleAllocException {
- try {
- if (isTrace()) {
- Log.v(TAG, "Allocating Java console"); //$NON-NLS-1$
- }
- this.mActive = true;
- } catch (Exception e) {
- Log.e(TAG, "Failed to allocate Java console", e); //$NON-NLS-1$
- throw new ConsoleAllocException("failed to build console", e); //$NON-NLS-1$
- }
- }
/**
* {@inheritDoc}
*/
@Override
- public void dealloc() {
- if (isTrace()) {
- Log.v(TAG, "Deallocating Java console"); //$NON-NLS-1$
- }
- this.mActive = true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void realloc() throws ConsoleAllocException {
- dealloc();
- alloc();
+ public String getName() {
+ return "Java";
}
/**
@@ -116,48 +76,10 @@ public final class JavaConsole extends Console {
* {@inheritDoc}
*/
@Override
- public Identity getIdentity() {
- AID aid = AIDHelper.getAID(Process.myUid());
- if (aid == null) return null;
- return new Identity(
- new User(aid.getId(), aid.getName()),
- new Group(aid.getId(), aid.getName()),
- new ArrayList<Group>());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isPrivileged() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isActive() {
- return this.mActive;
- }
-
- /**
- * Method that returns the current context
- *
- * @return Context The current context
- */
- public Context getCtx() {
- return this.mCtx;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public synchronized void execute(Executable executable) throws ConsoleAllocException,
- InsufficientPermissionsException, NoSuchFileOrDirectory,
- OperationTimeoutException, ExecutionException,
- CommandNotFoundException, ReadOnlyFilesystemException {
+ public synchronized void execute(Executable executable, Context ctx)
+ throws ConsoleAllocException, InsufficientPermissionsException, NoSuchFileOrDirectory,
+ OperationTimeoutException, ExecutionException, CommandNotFoundException,
+ ReadOnlyFilesystemException {
// Check that the program is a java program
try {
Program p = (Program)executable;
@@ -201,28 +123,4 @@ public final class JavaConsole extends Console {
}
}
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onCancel() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onSendSignal(SIGNAL signal) {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onEnd() {
- return false;
- }
-
} \ No newline at end of file