diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml
index b45cbb25b..365c5d350 100644
--- a/res/values-hu/strings.xml
+++ b/res/values-hu/strings.xml
@@ -100,7 +100,7 @@
A művelet nem engedélyezett, mert következetlenséget okozna.
- A művelet nem engedélyezett a jelenlegi mappában.
+ A művelet nem engedélyezett a jelenlegi mappában.\n\nA célmappa nem lehet azonos a forrásmappával, és nem lehet annak almappája.
Nyomja meg mégegyszer a kilépéshez.
@@ -237,6 +237,12 @@
Méret:
Tartalmaz:
+
+ Elérés ideje:
+
+ Módosítás ideje:
+
+ Adatváltozás ideje:
Tulajdonos:
@@ -331,7 +337,7 @@
Kezdőkönyvtár
- Válasszon kezdőkonyvtárat:
+ Válasszon kezdőkönyvtárat:
Relatív útvonalak nem használhatóak.
@@ -401,9 +407,9 @@
Elvet
- Kijelöltek beillesztése
+ Kijelöltek beillesztése ide
- Kijelöltek mozgatása
+ Kijelöltek mozgatása ide
Kijelöltek törlése
diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml
index 6309451ea..7b345bb38 100644
--- a/res/values-nl/strings.xml
+++ b/res/values-nl/strings.xml
@@ -242,6 +242,12 @@
Grootte:
Inhoud:
+
+ Geopend:
+
+ Bewerkt:
+
+ Gewijzigd:
Eigenaar:
diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml
index 9a52a18f9..058a11378 100644
--- a/res/values-ro/strings.xml
+++ b/res/values-ro/strings.xml
@@ -269,7 +269,7 @@
Mod interogare
Mod interogare\n\nAplicaţia se execută cu acces total la fişierele de sistem, dar va solicita permisiuni pentru a efectua operaţiuni privelegiate
Mod acces Root
- Mod cccess Root\n\nAvertizare! Acest mod permite operaţiuni ce pot duce la defectarea dispozitivului Dvs. Este responsabilitatea Dvs. să vă asigurați ce operațiune este sigură
+ Mod acces Root\n\nAvertizare! Acest mod permite operaţiuni ce pot duce la defectarea dispozitivului Dvs. Este responsabilitatea Dvs. să vă asigurați ce operațiune este sigură
Rezultate
Afişare widget relevanţă
Evidenţiere termeni de căutare
diff --git a/res/xml/command_list.xml b/res/xml/command_list.xml
index 5d27be545..1e42cdc79 100644
--- a/res/xml/command_list.xml
+++ b/res/xml/command_list.xml
@@ -39,10 +39,6 @@
-
-
-
-
@@ -52,7 +48,7 @@
-
+
diff --git a/src/com/cyanogenmod/filemanager/FileManagerApplication.java b/src/com/cyanogenmod/filemanager/FileManagerApplication.java
index a25126fb3..0e3ac357b 100644
--- a/src/com/cyanogenmod/filemanager/FileManagerApplication.java
+++ b/src/com/cyanogenmod/filemanager/FileManagerApplication.java
@@ -36,7 +36,6 @@
import com.cyanogenmod.filemanager.ui.ThemeManager;
import com.cyanogenmod.filemanager.ui.ThemeManager.Theme;
import com.cyanogenmod.filemanager.util.AIDHelper;
-import com.cyanogenmod.filemanager.util.FileHelper;
import com.cyanogenmod.filemanager.util.MimeTypeHelper;
import java.io.File;
@@ -354,13 +353,11 @@ private static synchronized void allocBackgroundConsole(Context ctx) {
if (ConsoleBuilder.isPrivileged()) {
sBackgroundConsole =
new ConsoleHolder(
- ConsoleBuilder.createPrivilegedConsole(
- ctx, FileHelper.ROOT_DIRECTORY));
+ ConsoleBuilder.createPrivilegedConsole(ctx));
} else {
sBackgroundConsole =
new ConsoleHolder(
- ConsoleBuilder.createNonPrivilegedConsole(
- ctx, FileHelper.ROOT_DIRECTORY));
+ ConsoleBuilder.createNonPrivilegedConsole(ctx));
}
} catch (Exception e) {
Log.e(TAG,
@@ -389,8 +386,7 @@ public static void changeBackgroundConsoleToPriviligedConsole()
sBackgroundConsole =
new ConsoleHolder(
ConsoleBuilder.createPrivilegedConsole(
- getInstance().getApplicationContext(),
- FileHelper.ROOT_DIRECTORY));
+ getInstance().getApplicationContext()));
} catch (Exception e) {
try {
if (sBackgroundConsole != null) {
@@ -410,6 +406,9 @@ public static void changeBackgroundConsoleToPriviligedConsole()
* @return boolean If the access mode of the application
*/
public static AccessMode getAccessMode() {
+ if (!sIsDeviceRooted) {
+ return AccessMode.SAFE;
+ }
String defaultValue =
((ObjectStringIdentifier)FileManagerSettings.
SETTINGS_ACCESS_MODE.getDefaultValue()).getId();
diff --git a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
index 39182c463..f3cae1c28 100644
--- a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
+++ b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
@@ -582,10 +582,10 @@ public void run() {
}
} catch (Throwable ex) {
if (!NavigationActivity.this.mChRooted) {
- //Show exception and exists
+ //Show exception and exit
Log.e(TAG, getString(R.string.msgs_cant_create_console), ex);
// We don't have any console
- // Show exception and exists
+ // Show exception and exit
DialogHelper.showToast(
NavigationActivity.this,
R.string.msgs_cant_create_console, Toast.LENGTH_LONG);
@@ -614,6 +614,13 @@ public void run() {
StorageHelper.getStorageVolumes(NavigationActivity.this);
if (volumes != null && volumes.length > 0) {
initialDir = volumes[0].getPath();
+ } else {
+ // Show exception and exit
+ DialogHelper.showToast(
+ NavigationActivity.this,
+ R.string.msgs_cant_create_console, Toast.LENGTH_LONG);
+ exit();
+ return;
}
}
@@ -1422,7 +1429,7 @@ void askOrExit() {
public void onClick(DialogInterface alertDialog, int which) {
if (which == DialogInterface.BUTTON_NEGATIVE) {
// We don't have any console
- // Show exception and exists
+ // Show exception and exit
DialogHelper.showToast(
NavigationActivity.this,
R.string.msgs_cant_create_console, Toast.LENGTH_LONG);
diff --git a/src/com/cyanogenmod/filemanager/commands/ChangeCurrentDirExecutable.java b/src/com/cyanogenmod/filemanager/commands/ChangeCurrentDirExecutable.java
deleted file mode 100644
index 5999cfc7b..000000000
--- a/src/com/cyanogenmod/filemanager/commands/ChangeCurrentDirExecutable.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.cyanogenmod.filemanager.commands;
-
-/**
- * An interface that represents an executable for retrieve the current directory.
- */
-public interface ChangeCurrentDirExecutable extends SyncResultExecutable {
-
- /**
- * {@inheritDoc}
- */
- @Override
- Boolean getResult();
-}
diff --git a/src/com/cyanogenmod/filemanager/commands/CurrentDirExecutable.java b/src/com/cyanogenmod/filemanager/commands/CurrentDirExecutable.java
deleted file mode 100644
index 1d951f88f..000000000
--- a/src/com/cyanogenmod/filemanager/commands/CurrentDirExecutable.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.cyanogenmod.filemanager.commands;
-
-/**
- * An interface that represents an executable for retrieve the current directory.
- */
-public interface CurrentDirExecutable extends SyncResultExecutable {
-
- /**
- * {@inheritDoc}
- */
- @Override
- String getResult();
-}
diff --git a/src/com/cyanogenmod/filemanager/commands/ExecutableCreator.java b/src/com/cyanogenmod/filemanager/commands/ExecutableCreator.java
index a0fd6f94b..5d537a9b0 100644
--- a/src/com/cyanogenmod/filemanager/commands/ExecutableCreator.java
+++ b/src/com/cyanogenmod/filemanager/commands/ExecutableCreator.java
@@ -32,20 +32,6 @@
*/
public interface ExecutableCreator {
- /**
- * Method that creates an executable for change the current directory.
- *
- * @param dir The absolute path of the new directory to establish as current directory
- * @return ChangeCurrentDirExecutable A {@link ChangeCurrentDirExecutable} executable
- * implementation reference
- * @throws CommandNotFoundException If the executable can't be created
- * @throws NoSuchFileOrDirectory If the file or directory was not found
- * @throws InsufficientPermissionsException If an operation requires elevated permissions
- */
- ChangeCurrentDirExecutable createChangeCurrentDirExecutable(
- String dir) throws CommandNotFoundException,
- NoSuchFileOrDirectory, InsufficientPermissionsException;
-
/**
* Method that creates an executable for change the owner of a file system object.
*
@@ -118,18 +104,6 @@ CreateDirExecutable createCreateDirectoryExecutable(String dir)
CreateFileExecutable createCreateFileExecutable(String file) throws CommandNotFoundException,
NoSuchFileOrDirectory, InsufficientPermissionsException;
- /**
- * Method that creates an executable for retrieve the current directory.
- *
- * @return CurrentDirExecutable A {@link CurrentDirExecutable} executable
- * implementation reference
- * @throws CommandNotFoundException If the executable can't be created
- * @throws NoSuchFileOrDirectory If the file or directory was not found
- * @throws InsufficientPermissionsException If an operation requires elevated permissions
- */
- CurrentDirExecutable createCurrentDirExecutable() throws CommandNotFoundException,
- NoSuchFileOrDirectory, InsufficientPermissionsException;
-
/**
* Method that creates an executable for delete a directory.
*
diff --git a/src/com/cyanogenmod/filemanager/commands/java/ChangeCurrentDirCommand.java b/src/com/cyanogenmod/filemanager/commands/java/ChangeCurrentDirCommand.java
deleted file mode 100644
index 476d40412..000000000
--- a/src/com/cyanogenmod/filemanager/commands/java/ChangeCurrentDirCommand.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.cyanogenmod.filemanager.commands.java;
-
-import android.util.Log;
-
-import com.cyanogenmod.filemanager.commands.ChangeCurrentDirExecutable;
-import com.cyanogenmod.filemanager.console.ExecutionException;
-import com.cyanogenmod.filemanager.console.InsufficientPermissionsException;
-import com.cyanogenmod.filemanager.console.NoSuchFileOrDirectory;
-import com.cyanogenmod.filemanager.console.java.JavaConsole;
-
-import java.io.File;
-
-
-/**
- * A class for change the current directory.
- */
-public class ChangeCurrentDirCommand extends Program implements ChangeCurrentDirExecutable {
-
- private static final String TAG = "ChangeCurrentDirCommand"; //$NON-NLS-1$
-
- private final JavaConsole mConsole;
- private final String mNewDir;
-
- /**
- * Constructor of ChangeCurrentDirCommand
.
- *
- * @param console The console
- * @param newDir The new directory to which to change
- */
- public ChangeCurrentDirCommand(JavaConsole console, String newDir) {
- super();
- this.mNewDir = newDir;
- this.mConsole = console;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Boolean getResult() {
- return Boolean.TRUE;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void execute()
- throws InsufficientPermissionsException, NoSuchFileOrDirectory, ExecutionException {
- if (isTrace()) {
- Log.v(TAG,
- String.format("Changing current directory to %s", this.mNewDir)); //$NON-NLS-1$
- }
-
- // Check that the file exists and is a directory
- File f = new File(this.mNewDir);
- if (!f.exists() || !f.isDirectory()) {
- if (isTrace()) {
- Log.v(TAG, "Result: FAIL. NoSuchFileOrDirectory"); //$NON-NLS-1$
- }
- throw new NoSuchFileOrDirectory(this.mNewDir);
- }
-
- // Check that we have the access to the directory
- if (!f.canRead() || !f.canExecute()) {
- if (isTrace()) {
- Log.v(TAG, "Result: FAIL. InsufficientPermissionsException"); //$NON-NLS-1$
- }
- throw new InsufficientPermissionsException();
- }
-
- // Set the new current directory
- this.mConsole.setCurrentDir(this.mNewDir);
-
- if (isTrace()) {
- Log.v(TAG, "Result: OK"); //$NON-NLS-1$
- }
- }
-
-}
diff --git a/src/com/cyanogenmod/filemanager/commands/java/CurrentDirCommand.java b/src/com/cyanogenmod/filemanager/commands/java/CurrentDirCommand.java
deleted file mode 100644
index 8ba8dd8f5..000000000
--- a/src/com/cyanogenmod/filemanager/commands/java/CurrentDirCommand.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.cyanogenmod.filemanager.commands.java;
-
-import android.util.Log;
-
-import com.cyanogenmod.filemanager.commands.CurrentDirExecutable;
-import com.cyanogenmod.filemanager.console.ExecutionException;
-import com.cyanogenmod.filemanager.console.InsufficientPermissionsException;
-import com.cyanogenmod.filemanager.console.NoSuchFileOrDirectory;
-import com.cyanogenmod.filemanager.console.java.JavaConsole;
-
-
-/**
- * A class for returns the current directory.
- */
-public class CurrentDirCommand extends Program implements CurrentDirExecutable {
-
- private static final String TAG = "CurrentDirCommand"; //$NON-NLS-1$
-
- private final JavaConsole mConsole;
- private String mCurrentDir;
-
- /**
- * Constructor of CurrentDirCommand
.
- *
- * @param console The console
- */
- public CurrentDirCommand(JavaConsole console) {
- super();
- this.mConsole = console;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getResult() {
- return this.mCurrentDir;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void execute()
- throws InsufficientPermissionsException, NoSuchFileOrDirectory, ExecutionException {
- if (isTrace()) {
- Log.v(TAG, "Obtaing current directory"); //$NON-NLS-1$
- }
-
- this.mCurrentDir = this.mConsole.getCurrentDir();
-
- if (isTrace()) {
- Log.v(TAG,
- String.format(
- "Result: OK. Current directory: %s", this.mCurrentDir)); //$NON-NLS-1$
- }
- }
-
-}
diff --git a/src/com/cyanogenmod/filemanager/commands/java/JavaExecutableCreator.java b/src/com/cyanogenmod/filemanager/commands/java/JavaExecutableCreator.java
index 875544efe..1186515d0 100644
--- a/src/com/cyanogenmod/filemanager/commands/java/JavaExecutableCreator.java
+++ b/src/com/cyanogenmod/filemanager/commands/java/JavaExecutableCreator.java
@@ -18,14 +18,12 @@
import com.cyanogenmod.filemanager.R;
import com.cyanogenmod.filemanager.commands.AsyncResultListener;
-import com.cyanogenmod.filemanager.commands.ChangeCurrentDirExecutable;
import com.cyanogenmod.filemanager.commands.ChangeOwnerExecutable;
import com.cyanogenmod.filemanager.commands.ChangePermissionsExecutable;
import com.cyanogenmod.filemanager.commands.CompressExecutable;
import com.cyanogenmod.filemanager.commands.CopyExecutable;
import com.cyanogenmod.filemanager.commands.CreateDirExecutable;
import com.cyanogenmod.filemanager.commands.CreateFileExecutable;
-import com.cyanogenmod.filemanager.commands.CurrentDirExecutable;
import com.cyanogenmod.filemanager.commands.DeleteDirExecutable;
import com.cyanogenmod.filemanager.commands.DeleteFileExecutable;
import com.cyanogenmod.filemanager.commands.DiskUsageExecutable;
@@ -77,15 +75,6 @@ public class JavaExecutableCreator implements ExecutableCreator {
this.mConsole = console;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public ChangeCurrentDirExecutable createChangeCurrentDirExecutable(String dir)
- throws CommandNotFoundException {
- return new ChangeCurrentDirCommand(this.mConsole, dir);
- }
-
/**
* {@inheritDoc}
*/
@@ -131,14 +120,6 @@ public CreateFileExecutable createCreateFileExecutable(String file)
return new CreateFileCommand(file);
}
- /**
- * {@inheritDoc}
- */
- @Override
- public CurrentDirExecutable createCurrentDirExecutable() throws CommandNotFoundException {
- return new CurrentDirCommand(this.mConsole);
- }
-
/**
* {@inheritDoc}
*/
diff --git a/src/com/cyanogenmod/filemanager/commands/shell/AsyncResultProgram.java b/src/com/cyanogenmod/filemanager/commands/shell/AsyncResultProgram.java
index 94d0498ff..922de7b0b 100644
--- a/src/com/cyanogenmod/filemanager/commands/shell/AsyncResultProgram.java
+++ b/src/com/cyanogenmod/filemanager/commands/shell/AsyncResultProgram.java
@@ -131,17 +131,12 @@ public final void onRequestEndParsePartialResult(boolean cancelled) {
this.mSync.notify();
}
synchronized (this.mTerminateSync) {
- try {
- this.mTerminateSync.wait();
- } catch (Exception e) {
- /**NON BLOCK**/
- }
- try {
- if (this.mWorkerThread.isAlive()) {
- this.mWorkerThread.interrupt();
+ if (this.mWorkerThread.isAlive()) {
+ try {
+ this.mTerminateSync.wait();
+ } catch (Exception e) {
+ /**NON BLOCK**/
}
- } catch (Exception e) {
- /**NON BLOCK**/
}
}
@@ -372,9 +367,6 @@ public void run() {
synchronized (AsyncResultProgram.this.mSync) {
AsyncResultProgram.this.mSync.wait();
while (AsyncResultProgram.this.mPartialData.size() > 0) {
- if (!this.mAlive) {
- return;
- }
Byte type = AsyncResultProgram.this.mPartialDataType.remove(0);
String data = AsyncResultProgram.this.mPartialData.remove(0);
try {
diff --git a/src/com/cyanogenmod/filemanager/commands/shell/ChangeCurrentDirCommand.java b/src/com/cyanogenmod/filemanager/commands/shell/ChangeCurrentDirCommand.java
deleted file mode 100644
index 443e1f446..000000000
--- a/src/com/cyanogenmod/filemanager/commands/shell/ChangeCurrentDirCommand.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.cyanogenmod.filemanager.commands.shell;
-
-import com.cyanogenmod.filemanager.commands.ChangeCurrentDirExecutable;
-import com.cyanogenmod.filemanager.console.CommandNotFoundException;
-import com.cyanogenmod.filemanager.console.ExecutionException;
-import com.cyanogenmod.filemanager.console.InsufficientPermissionsException;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.text.ParseException;
-
-
-/**
- * A class for change the current directory of the shell.
- *
- * {@link "http://unixhelp.ed.ac.uk/CGI/man-cgi?cd"}
- */
-public class ChangeCurrentDirCommand
- extends SyncResultProgram implements ChangeCurrentDirExecutable {
-
- private static final String ID = "cd"; //$NON-NLS-1$
- private Boolean mRet;
-
- /**
- * Constructor of ChangeCurrentDirCommand
.
- *
- * @param newDir The new directory to which to change
- * @throws InvalidCommandDefinitionException If the command has an invalid definition
- */
- public ChangeCurrentDirCommand(String newDir) throws InvalidCommandDefinitionException {
- super(ID, newDir);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void parse(String in, String err) throws ParseException {
- //Release the return object
- this.mRet = Boolean.TRUE;
-
- // Check the in and err buffer to extract information
- BufferedReader br = null;
- try {
- br = new BufferedReader(new StringReader(err));
- String szLine = br.readLine();
- if (szLine != null) {
- if (szLine.indexOf("No such file or directory") != -1) { //$NON-NLS-1$
- this.mRet = Boolean.FALSE;
- }
- }
- br.close();
- br = new BufferedReader(new StringReader(in));
- szLine = br.readLine();
- if (szLine != null) {
- if (szLine.indexOf("No such file or directory") != -1) { //$NON-NLS-1$
- this.mRet = Boolean.FALSE;
- }
- }
-
- } catch (IOException ioEx) {
- throw new ParseException(ioEx.getMessage(), 0);
-
- } catch (Exception ex) {
- throw new ParseException(ex.getMessage(), 0);
-
- } finally {
- try {
- if (br != null) {
- br.close();
- }
- } catch (Throwable ex) {
- /**NON BLOCK**/
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Boolean getResult() {
- return this.mRet;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void checkExitCode(int exitCode)
- throws InsufficientPermissionsException, CommandNotFoundException, ExecutionException {
- if (exitCode != 0) {
- throw new ExecutionException("exitcode != 0"); //$NON-NLS-1$
- }
- }
-}
diff --git a/src/com/cyanogenmod/filemanager/commands/shell/CurrentDirCommand.java b/src/com/cyanogenmod/filemanager/commands/shell/CurrentDirCommand.java
deleted file mode 100644
index 9c106a682..000000000
--- a/src/com/cyanogenmod/filemanager/commands/shell/CurrentDirCommand.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.cyanogenmod.filemanager.commands.shell;
-
-import com.cyanogenmod.filemanager.commands.CurrentDirExecutable;
-import com.cyanogenmod.filemanager.console.CommandNotFoundException;
-import com.cyanogenmod.filemanager.console.ExecutionException;
-import com.cyanogenmod.filemanager.console.InsufficientPermissionsException;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.text.ParseException;
-
-
-/**
- * A class for retrieve the current directory of the shell.
- *
- * {@link "http://unixhelp.ed.ac.uk/CGI/man-cgi?pwd"}
- */
-public class CurrentDirCommand extends SyncResultProgram implements CurrentDirExecutable {
-
- private static final String ID = "pwd"; //$NON-NLS-1$
- private String mPwd;
-
- /**
- * Constructor of CurrentDirCommand
.
- *
- * @throws InvalidCommandDefinitionException If the command has an invalid definition
- */
- public CurrentDirCommand() throws InvalidCommandDefinitionException {
- super(ID);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void parse(String in, String err) throws ParseException {
- //Release the return object
- this.mPwd = ""; //$NON-NLS-1$
-
- // Check the in buffer to extract information
- BufferedReader br = null;
- try {
- br = new BufferedReader(new StringReader(in));
- String szLine = br.readLine();
- if (szLine == null) {
- throw new ParseException("no information", 0); //$NON-NLS-1$
- }
- this.mPwd = szLine;
-
- } catch (IOException ioEx) {
- throw new ParseException(ioEx.getMessage(), 0);
-
- } catch (Exception ex) {
- throw new ParseException(ex.getMessage(), 0);
-
- } finally {
- try {
- if (br != null) {
- br.close();
- }
- } catch (Throwable ex) {
- /**NON BLOCK**/
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getResult() {
- return this.mPwd;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void checkExitCode(int exitCode)
- throws InsufficientPermissionsException, CommandNotFoundException, ExecutionException {
- if (exitCode != 0) {
- throw new ExecutionException("exitcode != 0"); //$NON-NLS-1$
- }
- }
-}
diff --git a/src/com/cyanogenmod/filemanager/commands/shell/ShellExecutableCreator.java b/src/com/cyanogenmod/filemanager/commands/shell/ShellExecutableCreator.java
index adc2ea68b..e47418455 100644
--- a/src/com/cyanogenmod/filemanager/commands/shell/ShellExecutableCreator.java
+++ b/src/com/cyanogenmod/filemanager/commands/shell/ShellExecutableCreator.java
@@ -17,14 +17,12 @@
package com.cyanogenmod.filemanager.commands.shell;
import com.cyanogenmod.filemanager.commands.AsyncResultListener;
-import com.cyanogenmod.filemanager.commands.ChangeCurrentDirExecutable;
import com.cyanogenmod.filemanager.commands.ChangeOwnerExecutable;
import com.cyanogenmod.filemanager.commands.ChangePermissionsExecutable;
import com.cyanogenmod.filemanager.commands.CompressExecutable;
import com.cyanogenmod.filemanager.commands.CopyExecutable;
import com.cyanogenmod.filemanager.commands.CreateDirExecutable;
import com.cyanogenmod.filemanager.commands.CreateFileExecutable;
-import com.cyanogenmod.filemanager.commands.CurrentDirExecutable;
import com.cyanogenmod.filemanager.commands.DeleteDirExecutable;
import com.cyanogenmod.filemanager.commands.DeleteFileExecutable;
import com.cyanogenmod.filemanager.commands.DiskUsageExecutable;
@@ -75,19 +73,6 @@ public class ShellExecutableCreator implements ExecutableCreator {
this.mConsole = console;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public ChangeCurrentDirExecutable createChangeCurrentDirExecutable(String dir)
- throws CommandNotFoundException {
- try {
- return new ChangeCurrentDirCommand(dir);
- } catch (InvalidCommandDefinitionException icdEx) {
- throw new CommandNotFoundException("ChangeCurrentDirCommand", icdEx); //$NON-NLS-1$
- }
- }
-
/**
* {@inheritDoc}
*/
@@ -153,18 +138,6 @@ public CreateFileExecutable createCreateFileExecutable(String file)
}
}
- /**
- * {@inheritDoc}
- */
- @Override
- public CurrentDirExecutable createCurrentDirExecutable() throws CommandNotFoundException {
- try {
- return new CurrentDirCommand();
- } catch (InvalidCommandDefinitionException icdEx) {
- throw new CommandNotFoundException("CurrentDirCommand", icdEx); //$NON-NLS-1$
- }
- }
-
/**
* {@inheritDoc}
*/
diff --git a/src/com/cyanogenmod/filemanager/commands/shell/WriteCommand.java b/src/com/cyanogenmod/filemanager/commands/shell/WriteCommand.java
index 08968305d..51c0800cd 100644
--- a/src/com/cyanogenmod/filemanager/commands/shell/WriteCommand.java
+++ b/src/com/cyanogenmod/filemanager/commands/shell/WriteCommand.java
@@ -44,7 +44,7 @@ public class WriteCommand extends AsyncResultProgram implements WriteExecutable
/**
* @hide
*/
- final Object mSync = new Object();
+ final Object mWriteSync = new Object();
private boolean mReady;
/**
* @hide
@@ -81,10 +81,10 @@ public boolean isExpectEnd() {
public OutputStream createOutputStream() throws IOException {
// Wait until command is ready
- synchronized (this.mSync) {
+ synchronized (this.mWriteSync) {
if (!this.mReady) {
try {
- this.mSync.wait(TIMEOUT);
+ this.mWriteSync.wait(TIMEOUT);
} catch (Exception e) {/**NON BLOCK**/}
}
}
@@ -96,9 +96,9 @@ public OutputStream createOutputStream() throws IOException {
*/
@Override
public void onStartParsePartialResult() {
- synchronized (this.mSync) {
+ synchronized (this.mWriteSync) {
this.mReady = true;
- this.mSync.notify();
+ this.mWriteSync.notify();
}
}
diff --git a/src/com/cyanogenmod/filemanager/console/ConsoleBuilder.java b/src/com/cyanogenmod/filemanager/console/ConsoleBuilder.java
index 1552abd95..179146932 100644
--- a/src/com/cyanogenmod/filemanager/console/ConsoleBuilder.java
+++ b/src/com/cyanogenmod/filemanager/console/ConsoleBuilder.java
@@ -30,7 +30,6 @@
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.Preferences;
import com.cyanogenmod.filemanager.util.DialogHelper;
-import com.cyanogenmod.filemanager.util.FileHelper;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -125,7 +124,7 @@ public static boolean changeToNonPrivilegedConsole(Context context) {
try {
//Create the console, destroy the current console, and marks as current
holder = new ConsoleHolder(
- createNonPrivilegedConsole(context, FileHelper.ROOT_DIRECTORY));
+ createNonPrivilegedConsole(context));
destroyConsole();
sHolder = holder;
return true;
@@ -157,7 +156,7 @@ public static boolean changeToPrivilegedConsole(Context context) {
try {
//Create the console, destroy the current console, and marks as current
holder = new ConsoleHolder(
- createAndCheckPrivilegedConsole(context, FileHelper.ROOT_DIRECTORY));
+ createAndCheckPrivilegedConsole(context));
destroyConsole();
sHolder = holder;
@@ -243,11 +242,8 @@ public static Console createDefaultConsole(Context context,
//Is there a console allocated
if (sHolder == null) {
sHolder = (superuserMode)
- ? new ConsoleHolder(
- createAndCheckPrivilegedConsole(
- context, FileHelper.ROOT_DIRECTORY))
- : new ConsoleHolder(
- createNonPrivilegedConsole(context, FileHelper.ROOT_DIRECTORY));
+ ? new ConsoleHolder(createAndCheckPrivilegedConsole(context))
+ : new ConsoleHolder(createNonPrivilegedConsole(context));
if (superuserMode) {
// Change also the background console to privileged
FileManagerApplication.changeBackgroundConsoleToPriviligedConsole();
@@ -275,7 +271,6 @@ public static void destroyConsole() {
* Method that creates a new non privileged console.
*
* @param context The current context
- * @param initialDirectory The initial directory of the console
* @return Console The non privileged console
* @throws FileNotFoundException If the initial directory not exists
* @throws IOException If initial directory couldn't be checked
@@ -283,7 +278,7 @@ public static void destroyConsole() {
* @throws ConsoleAllocException If the console can't be allocated
* @see NonPriviledgeConsole
*/
- public static Console createNonPrivilegedConsole(Context context, String initialDirectory)
+ public static Console createNonPrivilegedConsole(Context context)
throws FileNotFoundException, IOException,
InvalidCommandDefinitionException, ConsoleAllocException {
@@ -291,14 +286,14 @@ public static Console createNonPrivilegedConsole(Context context, String initial
// Is rooted? Then create a shell console
if (FileManagerApplication.isDeviceRooted()) {
- NonPriviledgeConsole console = new NonPriviledgeConsole(initialDirectory);
+ NonPriviledgeConsole console = new NonPriviledgeConsole();
console.setBufferSize(bufferSize);
console.alloc();
return console;
}
// No rooted. Then create a java console
- JavaConsole console = new JavaConsole(context, initialDirectory, bufferSize);
+ JavaConsole console = new JavaConsole(context, bufferSize);
console.alloc();
return console;
}
@@ -308,7 +303,6 @@ public static Console createNonPrivilegedConsole(Context context, String initial
* privileged console fails, the a non privileged console
*
* @param context The current context
- * @param initialDirectory The initial directory of the console
* @return Console The privileged console
* @throws FileNotFoundException If the initial directory not exists
* @throws IOException If initial directory couldn't be checked
@@ -317,10 +311,10 @@ public static Console createNonPrivilegedConsole(Context context, String initial
* @throws InsufficientPermissionsException If the console created is not a privileged console
* @see PrivilegedConsole
*/
- public static Console createPrivilegedConsole(Context context, String initialDirectory)
+ public static Console createPrivilegedConsole(Context context)
throws FileNotFoundException, IOException, InvalidCommandDefinitionException,
ConsoleAllocException, InsufficientPermissionsException {
- PrivilegedConsole console = new PrivilegedConsole(initialDirectory);
+ PrivilegedConsole console = new PrivilegedConsole();
console.setBufferSize(context.getResources().getInteger(R.integer.buffer_size));
console.alloc();
if (console.getIdentity().getUser().getId() != ROOT_UID) {
@@ -340,7 +334,6 @@ public static Console createPrivilegedConsole(Context context, String initialDir
* privileged console fails, the a non privileged console
*
* @param context The current context
- * @param initialDirectory The initial directory of the console
* @return Console The privileged console
* @throws FileNotFoundException If the initial directory not exists
* @throws IOException If initial directory couldn't be checked
@@ -349,10 +342,10 @@ public static Console createPrivilegedConsole(Context context, String initialDir
* @throws InsufficientPermissionsException If the console created is not a privileged console
* @see PrivilegedConsole
*/
- public static Console createAndCheckPrivilegedConsole(Context context, String initialDirectory)
+ public static Console createAndCheckPrivilegedConsole(Context context)
throws FileNotFoundException, IOException, InvalidCommandDefinitionException,
ConsoleAllocException, InsufficientPermissionsException {
- return createAndCheckPrivilegedConsole(context, initialDirectory, true);
+ return createAndCheckPrivilegedConsole(context, true);
}
/**
@@ -360,7 +353,6 @@ public static Console createAndCheckPrivilegedConsole(Context context, String in
* privileged console fails, the a non privileged console
*
* @param context The current context
- * @param initialDirectory The initial directory of the console
* @param silent Indicates that no message have to be displayed
* @return Console The privileged console
* @throws FileNotFoundException If the initial directory not exists
@@ -371,12 +363,12 @@ public static Console createAndCheckPrivilegedConsole(Context context, String in
* @see PrivilegedConsole
*/
public static Console createAndCheckPrivilegedConsole(
- Context context, String initialDirectory, boolean silent)
+ Context context, boolean silent)
throws FileNotFoundException, IOException, InvalidCommandDefinitionException,
ConsoleAllocException, InsufficientPermissionsException {
try {
// Create the privileged console
- return createPrivilegedConsole(context, initialDirectory);
+ return createPrivilegedConsole(context);
} catch (ConsoleAllocException caEx) {
//Show a message with the problem?
@@ -404,7 +396,7 @@ public static Console createAndCheckPrivilegedConsole(
}
//Create the non-privileged console
- return createNonPrivilegedConsole(context, initialDirectory);
+ return createNonPrivilegedConsole(context);
}
// Rethrow the exception
diff --git a/src/com/cyanogenmod/filemanager/console/java/JavaConsole.java b/src/com/cyanogenmod/filemanager/console/java/JavaConsole.java
index df04d4a5f..2edb42a9c 100644
--- a/src/com/cyanogenmod/filemanager/console/java/JavaConsole.java
+++ b/src/com/cyanogenmod/filemanager/console/java/JavaConsole.java
@@ -17,10 +17,8 @@
package com.cyanogenmod.filemanager.console.java;
import android.content.Context;
-import android.os.storage.StorageVolume;
import android.util.Log;
-import com.cyanogenmod.filemanager.commands.ChangeCurrentDirExecutable;
import com.cyanogenmod.filemanager.commands.Executable;
import com.cyanogenmod.filemanager.commands.ExecutableFactory;
import com.cyanogenmod.filemanager.commands.SIGNAL;
@@ -35,7 +33,6 @@
import com.cyanogenmod.filemanager.console.OperationTimeoutException;
import com.cyanogenmod.filemanager.console.ReadOnlyFilesystemException;
import com.cyanogenmod.filemanager.model.Identity;
-import com.cyanogenmod.filemanager.util.StorageHelper;
/**
* An implementation of a {@link Console} based on a java implementation.
@@ -48,7 +45,6 @@ public final class JavaConsole extends Console {
private static final String TAG = "JavaConsole"; //$NON-NLS-1$
private boolean mActive;
- private String mCurrentDir;
private final Context mCtx;
private final int mBufferSize;
@@ -57,14 +53,12 @@ public final class JavaConsole extends Console {
* Constructor of JavaConsole
*
* @param ctx The current context
- * @param initialDir The initial directory
* @param bufferSize The buffer size
*/
- public JavaConsole(Context ctx, String initialDir, int bufferSize) {
+ public JavaConsole(Context ctx, int bufferSize) {
super();
this.mCtx = ctx;
this.mBufferSize = bufferSize;
- this.mCurrentDir = initialDir;
}
/**
@@ -76,21 +70,6 @@ public void alloc() throws ConsoleAllocException {
if (isTrace()) {
Log.v(TAG, "Allocating Java console"); //$NON-NLS-1$
}
-
- //Retrieve the current directory from the first storage volume
- StorageVolume[] vols = StorageHelper.getStorageVolumes(this.mCtx);
- if (vols == null || vols.length == 0) {
- throw new ConsoleAllocException("Can't stat any directory"); //$NON-NLS-1$
- }
-
- // Test to change to current directory
- ChangeCurrentDirExecutable currentDirCmd =
- getExecutableFactory().
- newCreator().createChangeCurrentDirExecutable(this.mCurrentDir);
- execute(currentDirCmd);
-
- // Tested. Is not active
- this.mCurrentDir = vols[0].getPath();
this.mActive = true;
} catch (Exception e) {
Log.e(TAG, "Failed to allocate Java console", e); //$NON-NLS-1$
@@ -150,24 +129,6 @@ public boolean isActive() {
return this.mActive;
}
- /**
- * Method that returns the current directory of the console
- *
- * @return String The current directory
- */
- public String getCurrentDir() {
- return this.mCurrentDir;
- }
-
- /**
- * Method that sets the current directory of the console
- *
- * @param currentDir The current directory
- */
- public void setCurrentDir(String currentDir) {
- this.mCurrentDir = currentDir;
- }
-
/**
* Method that returns the current context
*
diff --git a/src/com/cyanogenmod/filemanager/console/shell/NonPriviledgeConsole.java b/src/com/cyanogenmod/filemanager/console/shell/NonPriviledgeConsole.java
index aec764f81..7673bbf06 100644
--- a/src/com/cyanogenmod/filemanager/console/shell/NonPriviledgeConsole.java
+++ b/src/com/cyanogenmod/filemanager/console/shell/NonPriviledgeConsole.java
@@ -30,19 +30,6 @@
*/
public class NonPriviledgeConsole extends ShellConsole {
- /**
- * Constructor of NonPriviledgeConsole
.
- *
- * @param initialDirectory The initial directory of the shell
- * @throws FileNotFoundException If the initial directory not exists
- * @throws IOException If initial directory couldn't be checked
- * @throws InvalidCommandDefinitionException If the command has an invalid definition
- */
- public NonPriviledgeConsole(String initialDirectory)
- throws FileNotFoundException, IOException, InvalidCommandDefinitionException {
- super(new BashShell(), initialDirectory);
- }
-
/**
* Constructor of NonPriviledgeConsole
.
*
diff --git a/src/com/cyanogenmod/filemanager/console/shell/PrivilegedConsole.java b/src/com/cyanogenmod/filemanager/console/shell/PrivilegedConsole.java
index 4e5d30889..cc4413147 100644
--- a/src/com/cyanogenmod/filemanager/console/shell/PrivilegedConsole.java
+++ b/src/com/cyanogenmod/filemanager/console/shell/PrivilegedConsole.java
@@ -31,19 +31,6 @@
*/
public class PrivilegedConsole extends ShellConsole {
- /**
- * Constructor of PrivilegedConsole
.
- *
- * @param initialDirectory The initial directory of the shell
- * @throws FileNotFoundException If the initial directory not exists
- * @throws IOException If initial directory couldn't be checked
- * @throws InvalidCommandDefinitionException If the command has an invalid definition
- */
- public PrivilegedConsole(String initialDirectory)
- throws FileNotFoundException, IOException, InvalidCommandDefinitionException {
- super(new SuperuserShell(), initialDirectory);
- }
-
/**
* Constructor of PrivilegedConsole
.
*
diff --git a/src/com/cyanogenmod/filemanager/console/shell/ShellConsole.java b/src/com/cyanogenmod/filemanager/console/shell/ShellConsole.java
index e7de2fbf0..12b7fe262 100644
--- a/src/com/cyanogenmod/filemanager/console/shell/ShellConsole.java
+++ b/src/com/cyanogenmod/filemanager/console/shell/ShellConsole.java
@@ -42,8 +42,6 @@
import com.cyanogenmod.filemanager.console.OperationTimeoutException;
import com.cyanogenmod.filemanager.console.ReadOnlyFilesystemException;
import com.cyanogenmod.filemanager.model.Identity;
-import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
-import com.cyanogenmod.filemanager.preferences.Preferences;
import com.cyanogenmod.filemanager.util.CommandHelper;
import com.cyanogenmod.filemanager.util.FileHelper;
@@ -78,7 +76,6 @@ public abstract class ShellConsole extends Console implements Program.ProgramLis
//Shell References
private final Shell mShell;
- private final String mInitialDirectory;
private Identity mIdentity;
//Process References
@@ -134,24 +131,10 @@ public abstract class ShellConsole extends Console implements Program.ProgramLis
* Constructor of ShellConsole
.
*
* @param shell The shell used to execute commands
- * @throws FileNotFoundException If the default initial directory not exists
- * @throws IOException If initial directory couldn't be resolved
- */
- public ShellConsole(Shell shell) throws FileNotFoundException, IOException {
- this(shell, Preferences.getSharedPreferences().getString(
- FileManagerSettings.SETTINGS_INITIAL_DIR.getId(),
- (String)FileManagerSettings.SETTINGS_INITIAL_DIR.getDefaultValue()));
- }
-
- /**
- * Constructor of ShellConsole
.
- *
- * @param shell The shell used to execute commands
- * @param initialDirectory The initial directory of the shell
* @throws FileNotFoundException If the initial directory not exists
* @throws IOException If initial directory couldn't be resolved
*/
- public ShellConsole(Shell shell, String initialDirectory)
+ public ShellConsole(Shell shell)
throws FileNotFoundException, IOException {
super();
this.mShell = shell;
@@ -159,16 +142,6 @@ public ShellConsole(Shell shell, String initialDirectory)
this.mBufferSize = DEFAULT_BUFFER;
- //Resolve and checks the initial directory
- File f = new File(initialDirectory);
- while (FileHelper.isSymlink(f)) {
- f = FileHelper.resolveSymlink(f);
- }
- if (!f.exists() || !f.isDirectory()) {
- throw new FileNotFoundException(f.toString());
- }
- this.mInitialDirectory = initialDirectory;
-
//Restart the buffers
this.mSbIn = new StringBuffer();
this.mSbErr = new StringBuffer();
@@ -242,7 +215,7 @@ public final void alloc() throws ConsoleAllocException {
rt.exec(
cmd.toArray(new String[cmd.size()]),
null,
- new File(this.mInitialDirectory));
+ new File(FileHelper.ROOT_DIRECTORY).getCanonicalFile());
synchronized (this.mSync) {
this.mActive = true;
}
@@ -1135,28 +1108,32 @@ private boolean killCurrentCommand() {
if (program.getCommand() != null) {
try {
if (program.isCancellable()) {
- //Get the PID in background
- Integer pid =
- CommandHelper.getProcessId(
+ try {
+ //Get the PID in background
+ Integer pid =
+ CommandHelper.getProcessId(
+ null,
+ this.mShell.getPid(),
+ program.getCommand(),
+ FileManagerApplication.getBackgroundConsole());
+ if (pid != null) {
+ CommandHelper.sendSignal(
null,
- this.mShell.getPid(),
- program.getCommand(),
+ pid.intValue(),
FileManagerApplication.getBackgroundConsole());
- if (pid != null) {
- CommandHelper.sendSignal(
- null,
- pid.intValue(),
- FileManagerApplication.getBackgroundConsole());
- try {
- //Wait for process kill
- Thread.sleep(100L);
- } catch (Throwable ex) {
- /**NON BLOCK**/
+ try {
+ //Wait for process kill
+ Thread.sleep(100L);
+ } catch (Throwable ex) {
+ /**NON BLOCK**/
+ }
+ return true;
}
+ } finally {
+ // It's finished
this.mCancelled = true;
notifyProcessFinished();
this.mSync.notify();
- return this.mCancelled;
}
}
} catch (Throwable ex) {
diff --git a/src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java b/src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java
index afcf45701..69746693c 100644
--- a/src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java
+++ b/src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java
@@ -906,14 +906,20 @@ protected void onPostExecute(List files) {
*
* @param out Fade out (true); Fade in (false)
*/
- void fadeEfect(boolean out) {
- Animation fadeAnim = out ?
- new AlphaAnimation(1, 0) :
- new AlphaAnimation(0, 1);
- fadeAnim.setDuration(50L);
- fadeAnim.setFillAfter(true);
- fadeAnim.setInterpolator(new AccelerateInterpolator());
- NavigationView.this.startAnimation(fadeAnim);
+ void fadeEfect(final boolean out) {
+ Activity activity = (Activity)getContext();
+ activity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Animation fadeAnim = out ?
+ new AlphaAnimation(1, 0) :
+ new AlphaAnimation(0, 1);
+ fadeAnim.setDuration(50L);
+ fadeAnim.setFillAfter(true);
+ fadeAnim.setInterpolator(new AccelerateInterpolator());
+ NavigationView.this.startAnimation(fadeAnim);
+ }
+ });
}
};
task.execute(fNewDir);
diff --git a/src/com/cyanogenmod/filemanager/util/CommandHelper.java b/src/com/cyanogenmod/filemanager/util/CommandHelper.java
index f79cb9e99..932e219c9 100644
--- a/src/com/cyanogenmod/filemanager/util/CommandHelper.java
+++ b/src/com/cyanogenmod/filemanager/util/CommandHelper.java
@@ -19,14 +19,12 @@
import android.content.Context;
import com.cyanogenmod.filemanager.commands.AsyncResultListener;
-import com.cyanogenmod.filemanager.commands.ChangeCurrentDirExecutable;
import com.cyanogenmod.filemanager.commands.ChangeOwnerExecutable;
import com.cyanogenmod.filemanager.commands.ChangePermissionsExecutable;
import com.cyanogenmod.filemanager.commands.CompressExecutable;
import com.cyanogenmod.filemanager.commands.CopyExecutable;
import com.cyanogenmod.filemanager.commands.CreateDirExecutable;
import com.cyanogenmod.filemanager.commands.CreateFileExecutable;
-import com.cyanogenmod.filemanager.commands.CurrentDirExecutable;
import com.cyanogenmod.filemanager.commands.DeleteDirExecutable;
import com.cyanogenmod.filemanager.commands.DeleteFileExecutable;
import com.cyanogenmod.filemanager.commands.DiskUsageExecutable;
@@ -189,37 +187,6 @@ private CommandHelper() {
super();
}
- /**
- * Method that changes the current directory of the shell.
- *
- * @param context The current context (needed if console == null)
- * @param dst The new directory
- * @return boolean The operation result
- * @param console The console in which execute the program. null
- * to attach to the default console
- * @throws FileNotFoundException If the initial directory not exists
- * @throws IOException If initial directory couldn't be checked
- * @throws InvalidCommandDefinitionException If the command has an invalid definition
- * @throws NoSuchFileOrDirectory If the file or directory was not found
- * @throws ConsoleAllocException If the console can't be allocated
- * @throws InsufficientPermissionsException If an operation requires elevated permissions
- * @throws CommandNotFoundException If the command was not found
- * @throws OperationTimeoutException If the operation exceeded the maximum time of wait
- * @throws ExecutionException If the operation returns a invalid exit code
- * @see ChangeCurrentDirExecutable
- */
- public static boolean changeCurrentDir(Context context, String dst, Console console)
- throws FileNotFoundException, IOException, ConsoleAllocException,
- NoSuchFileOrDirectory, InsufficientPermissionsException,
- CommandNotFoundException, OperationTimeoutException,
- ExecutionException, InvalidCommandDefinitionException {
- Console c = ensureConsole(context, console);
- ChangeCurrentDirExecutable executable =
- c.getExecutableFactory().newCreator().createChangeCurrentDirExecutable(dst);
- execute(context, executable, c);
- return executable.getResult().booleanValue();
- }
-
/**
* Method that changes the owner of a file system object.
*
@@ -450,36 +417,6 @@ public static FileSystemObject resolveSymlink(Context context, String symlink, C
return executable.getResult();
}
- /**
- * Method that retrieves the current directory of the shell.
- *
- * @param context The current context (needed if console == null)
- * @param console The console in which execute the program. null
- * to attach to the default console
- * @return String The current directory
- * @throws FileNotFoundException If the initial directory not exists
- * @throws IOException If initial directory couldn't be checked
- * @throws InvalidCommandDefinitionException If the command has an invalid definition
- * @throws NoSuchFileOrDirectory If the file or directory was not found
- * @throws ConsoleAllocException If the console can't be allocated
- * @throws InsufficientPermissionsException If an operation requires elevated permissions
- * @throws CommandNotFoundException If the command was not found
- * @throws OperationTimeoutException If the operation exceeded the maximum time of wait
- * @throws ExecutionException If the operation returns a invalid exit code
- * @see CurrentDirExecutable
- */
- public static String getCurrentDir(Context context, Console console)
- throws FileNotFoundException, IOException, ConsoleAllocException,
- NoSuchFileOrDirectory, InsufficientPermissionsException,
- CommandNotFoundException, OperationTimeoutException,
- ExecutionException, InvalidCommandDefinitionException {
- Console c = ensureConsole(context, console);
- CurrentDirExecutable executable =
- c.getExecutableFactory().newCreator().createCurrentDirExecutable();
- execute(context, executable, c);
- return executable.getResult();
- }
-
/**
* Method that retrieves the information of a file system object.
*
diff --git a/src/com/cyanogenmod/filemanager/util/ExceptionUtil.java b/src/com/cyanogenmod/filemanager/util/ExceptionUtil.java
index 658a28ccf..e7d6074d0 100644
--- a/src/com/cyanogenmod/filemanager/util/ExceptionUtil.java
+++ b/src/com/cyanogenmod/filemanager/util/ExceptionUtil.java
@@ -293,6 +293,7 @@ public void onClick(DialogInterface dialog, int which) {
Object result = CommandHelper.reexecute(
context, executable, null);
if (relaunchable.getTask() != null) {
+ relaunchable.getTask().cancel(true);
relaunchable.getTask().execute(result);
}
}
diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/AbstractConsoleTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/AbstractConsoleTest.java
index fa1b09089..202c07d7d 100644
--- a/tests/src/com/cyanogenmod/filemanager/commands/shell/AbstractConsoleTest.java
+++ b/tests/src/com/cyanogenmod/filemanager/commands/shell/AbstractConsoleTest.java
@@ -20,15 +20,12 @@
import com.cyanogenmod.filemanager.console.Console;
import com.cyanogenmod.filemanager.console.ConsoleBuilder;
import com.cyanogenmod.filemanager.console.shell.ShellConsole;
-import com.cyanogenmod.filemanager.util.FileHelper;
/**
* An abstract class that manages tests that needs a console.
*/
public abstract class AbstractConsoleTest extends android.test.AndroidTestCase {
- private static final String INITIAL_DIR = FileHelper.ROOT_DIRECTORY;
-
private Console mConsole;
/**
@@ -46,9 +43,9 @@ protected void setUp() throws Exception {
//Setup the console
if (isRootConsoleNeeded()) {
FileManagerApplication.changeBackgroundConsoleToPriviligedConsole();
- this.mConsole = ConsoleBuilder.createPrivilegedConsole(getContext(), INITIAL_DIR);
+ this.mConsole = ConsoleBuilder.createPrivilegedConsole(getContext());
} else {
- this.mConsole = ConsoleBuilder.createNonPrivilegedConsole(getContext(), INITIAL_DIR);
+ this.mConsole = ConsoleBuilder.createNonPrivilegedConsole(getContext());
}
super.setUp();
diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/ChangeCurrentDirCommandTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/ChangeCurrentDirCommandTest.java
deleted file mode 100644
index 2ef12a474..000000000
--- a/tests/src/com/cyanogenmod/filemanager/commands/shell/ChangeCurrentDirCommandTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.cyanogenmod.filemanager.commands.shell;
-
-import android.test.suitebuilder.annotation.SmallTest;
-
-import com.cyanogenmod.filemanager.console.NoSuchFileOrDirectory;
-import com.cyanogenmod.filemanager.util.CommandHelper;
-import com.cyanogenmod.filemanager.util.FileHelper;
-
-/**
- * A class for testing the {@link ChangeCurrentDirCommand} command.
- *
- * @see ChangeCurrentDirCommand
- */
-public class ChangeCurrentDirCommandTest extends AbstractConsoleTest {
-
- private static final String PATH_OK = FileHelper.ROOT_DIRECTORY;
- private static final String PATH_ERROR = "/foo/foo121212"; //$NON-NLS-1$
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isRootConsoleNeeded() {
- return false;
- }
-
- /**
- * Method that performs a test to change the directory.
- *
- * @throws Exception If test failed
- */
- @SmallTest
- public void testChangeDirOk() throws Exception {
- boolean ret = CommandHelper.changeCurrentDir(getContext(), PATH_OK, getConsole());
- assertTrue("response==false", ret); //$NON-NLS-1$
-
- //Verify that current directory is PATH_OK
- String curDir = CommandHelper.getCurrentDir(getContext(), getConsole());
- assertTrue(
- String.format(
- "curDir!=%s", PATH_OK), curDir.compareTo(PATH_OK) == 0); //$NON-NLS-1$
- }
-
- /**
- * Method that performs a test to change the fake directory.
- *
- * @throws Exception If test failed
- */
- @SmallTest
- public void testChangeDirFail() throws Exception {
- String oldPwd = CommandHelper.getCurrentDir(getContext(), getConsole());
- try {
- CommandHelper.changeCurrentDir(getContext(), PATH_ERROR, getConsole());
- assertTrue("exit code==0", false); //$NON-NLS-1$
- } catch (NoSuchFileOrDirectory error) {
- //This command must failed. exit code !=0
- }
-
- //Verify that current directory is PATH_OK
- String newPwd = CommandHelper.getCurrentDir(getContext(), getConsole());
- assertTrue(
- String.format(
- "curDir!=%s", oldPwd), newPwd.compareTo(oldPwd) == 0); //$NON-NLS-1$
- }
-
-
-}
diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/CurrentDirCommandTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/CurrentDirCommandTest.java
deleted file mode 100644
index 5cd5f3ba2..000000000
--- a/tests/src/com/cyanogenmod/filemanager/commands/shell/CurrentDirCommandTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.cyanogenmod.filemanager.commands.shell;
-
-import android.os.Environment;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import com.cyanogenmod.filemanager.util.CommandHelper;
-
-/**
- * A class for testing the {@link CurrentDirCommand} command.
- *
- * @see CurrentDirCommand
- */
-public class CurrentDirCommandTest extends AbstractConsoleTest {
-
- private static final String PATH =
- Environment.getExternalStorageDirectory().getAbsolutePath();
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isRootConsoleNeeded() {
- return false;
- }
-
- /**
- * Method that performs a test for retrieve current directory.
- *
- * @throws Exception If test failed
- */
- @SmallTest
- public void testCurrentDir() throws Exception {
- CommandHelper.changeCurrentDir(getContext(), PATH, getConsole());
- String curDir = CommandHelper.getCurrentDir(getContext(), getConsole());
- assertTrue(
- String.format(
- "current directory!=%s; %s", PATH, curDir), //$NON-NLS-1$
- curDir.compareTo(PATH) == 0);
- }
-
-
-}
diff --git a/tests/src/com/cyanogenmod/filemanager/console/ConsoleBuilderTest.java b/tests/src/com/cyanogenmod/filemanager/console/ConsoleBuilderTest.java
index 7d1630953..6cfe481a5 100644
--- a/tests/src/com/cyanogenmod/filemanager/console/ConsoleBuilderTest.java
+++ b/tests/src/com/cyanogenmod/filemanager/console/ConsoleBuilderTest.java
@@ -16,7 +16,6 @@
package com.cyanogenmod.filemanager.console;
-import android.os.Environment;
import android.test.suitebuilder.annotation.SmallTest;
@@ -27,9 +26,6 @@
*/
public class ConsoleBuilderTest extends android.test.AndroidTestCase {
- private static final String PATH =
- Environment.getExternalStorageDirectory().getAbsolutePath();
-
/**
* {@inheritDoc}
*/
@@ -50,11 +46,11 @@ protected void tearDown() throws Exception {
* Method that performs a test over creating a privileged console.
*
* @throws Exception If test failed
- * @{link {@link ConsoleBuilder#createPrivilegedConsole(android.content.Context, String)}
+ * @{link {@link ConsoleBuilder#createPrivilegedConsole(android.content.Context)}
*/
@SmallTest
public void testCreatePrivilegedConsole() throws Exception {
- Console console = ConsoleBuilder.createPrivilegedConsole(getContext(), PATH);
+ Console console = ConsoleBuilder.createPrivilegedConsole(getContext());
try {
assertNotNull("console==null", console); //$NON-NLS-1$
} finally {
@@ -70,11 +66,11 @@ public void testCreatePrivilegedConsole() throws Exception {
* Method that performs a test over creating a non privileged console.
*
* @throws Exception If test failed
- * @{link {@link ConsoleBuilder#createNonPrivilegedConsole(android.content.Context, String)}
+ * @{link {@link ConsoleBuilder#createNonPrivilegedConsole(android.content.Context)}
*/
@SmallTest
public void testCreateNonPrivilegedConsole() throws Exception {
- Console console = ConsoleBuilder.createNonPrivilegedConsole(getContext(), PATH);
+ Console console = ConsoleBuilder.createNonPrivilegedConsole(getContext());
try {
assertNotNull("console==null", console); //$NON-NLS-1$
} finally {