OSDN Git Service

Better way and explanations for hacks kitkat-x86 lollipop-x86 marshmallow-x86 nougat-x86 oreo-x86 android-x86-6.0-r1 android-x86-6.0-r2 android-x86-6.0-r3
authorJorge Ruesga <jorge@ruesga.com>
Thu, 30 Oct 2014 00:57:46 +0000 (01:57 +0100)
committerJorge Ruesga <jorge@ruesga.com>
Thu, 30 Oct 2014 00:57:46 +0000 (01:57 +0100)
Change-Id: I1bfae7d137a4a43de2fe538cd0b5146a93a5cccb
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
src/de/schlichtherle/truezip/file/TFile.java
src/de/schlichtherle/truezip/key/PromptingKeyProvider.java

index 7df732e..7c3e571 100644 (file)
@@ -1791,8 +1791,9 @@ public final class TFile extends File {
 
     /**
      * {@hide}
+     * DO NOT CALL ON FILES DIFFERENT FROM THE FILESYSTEM ROOT
      */
-    public void open() throws IOException {
+    public void mount() throws IOException {
         if (null != innerArchive) {
             try {
                 innerArchive.getController().mknod(
index 34460b3..1306da3 100644 (file)
@@ -28,10 +28,12 @@ extends SafeKeyProvider<K> {
     /** The resource identifier for the protected resource. */
     private volatile URI resource;
 
+    private boolean askAlwaysForWriteKey;
     private volatile boolean changeRequested;
 
     PromptingKeyProvider(PromptingKeyManager<K> manager) {
         this.view = manager.getView();
+        this.askAlwaysForWriteKey = false;
     }
 
     private View<K> getView() {
@@ -48,6 +50,13 @@ extends SafeKeyProvider<K> {
     }
 
     /**
+     * {@hide}
+     */
+    public void setAskAlwaysForWriteKey(boolean askAlwaysForWriteKey) {
+        this.askAlwaysForWriteKey = askAlwaysForWriteKey;
+    }
+
+    /**
      * Returns the unique resource identifier (resource ID) of the protected
      * resource for which this key provider is used.
      * May be {@code null}.
@@ -194,9 +203,7 @@ extends SafeKeyProvider<K> {
                 if (provider.isChangeRequested()) {
                     provider.setChangeRequested(false);
                     RESET.retrieveWriteKey(provider); // DON'T change state!
-                } else {
-                    // FIXME -- CMFM -- Always ask for password. Caching is the view side.
-                    // This allow to reset the password (a bad way)
+                } else if (provider.askAlwaysForWriteKey) {
                     PromptingKeyProvider<K>.BaseController controller
                             = provider.new WriteController(this);
                     try {