Merge branch 'master' of github.com:open-keychain/open-keychain
This commit is contained in:
@@ -32,15 +32,14 @@ import org.junit.runner.RunWith;
|
|||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||||
|
import org.sufficientlysecure.keychain.util.FileHelper;
|
||||||
|
|
||||||
import static android.support.test.espresso.Espresso.onData;
|
import static android.support.test.espresso.Espresso.onData;
|
||||||
import static android.support.test.espresso.Espresso.onView;
|
import static android.support.test.espresso.Espresso.onView;
|
||||||
import static android.support.test.espresso.Espresso.pressBack;
|
import static android.support.test.espresso.Espresso.pressBack;
|
||||||
import static android.support.test.espresso.action.ViewActions.click;
|
import static android.support.test.espresso.action.ViewActions.click;
|
||||||
import static android.support.test.espresso.action.ViewActions.typeText;
|
import static android.support.test.espresso.action.ViewActions.typeText;
|
||||||
import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
|
|
||||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
||||||
import static android.support.test.espresso.contrib.DrawerActions.openDrawer;
|
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
|
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA;
|
import static android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA;
|
||||||
@@ -115,33 +114,13 @@ public class AsymmetricTextOperationTests {
|
|||||||
onView(withId(R.id.passphrase_passphrase)).perform(typeText("x"));
|
onView(withId(R.id.passphrase_passphrase)).perform(typeText("x"));
|
||||||
onView(withText(R.string.btn_unlock)).perform(click());
|
onView(withText(R.string.btn_unlock)).perform(click());
|
||||||
|
|
||||||
|
|
||||||
onView(isRecyclerItemView(R.id.decrypted_files_list,
|
onView(isRecyclerItemView(R.id.decrypted_files_list,
|
||||||
hasDescendant(withText(R.string.filename_unknown_text))))
|
hasDescendant(withText(R.string.filename_unknown_text))))
|
||||||
.check(matches(allOf(withEncryptionStatus(true), withSignatureNone())));
|
.check(matches(allOf(
|
||||||
|
hasDescendant(withText(FileHelper.readableFileSize(cleartext.length()))),
|
||||||
}
|
withEncryptionStatus(true),
|
||||||
|
withSignatureNone()
|
||||||
}
|
)));
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testTextEncryptDecryptFromKeyView() throws Exception {
|
|
||||||
|
|
||||||
String cleartext = randomString(10, 30);
|
|
||||||
|
|
||||||
pressBack();
|
|
||||||
|
|
||||||
{ // encrypt
|
|
||||||
|
|
||||||
// navigate to edit key dialog
|
|
||||||
onData(withKeyItemId(0x9D604D2F310716A3L))
|
|
||||||
.inAdapterView(allOf(isAssignableFrom(AdapterView.class),
|
|
||||||
isDescendantOfA(withId(R.id.key_list_list))))
|
|
||||||
.perform(click());
|
|
||||||
onView(withId(R.id.view_key_action_encrypt_text)).perform(click());
|
|
||||||
|
|
||||||
// make sure the encrypt is correctly set
|
|
||||||
onView(withId(R.id.result_encryption_icon)).check(matches(withDisplayedChild(1)));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -459,11 +459,16 @@ public class PassphraseCacheService extends Service {
|
|||||||
* Called when one specific passphrase for keyId timed out
|
* Called when one specific passphrase for keyId timed out
|
||||||
*/
|
*/
|
||||||
private void timeout(long keyId) {
|
private void timeout(long keyId) {
|
||||||
|
|
||||||
CachedPassphrase cPass = mPassphraseCache.get(keyId);
|
CachedPassphrase cPass = mPassphraseCache.get(keyId);
|
||||||
// clean internal char[] from memory!
|
if (cPass != null) {
|
||||||
cPass.getPassphrase().removeFromMemory();
|
if (cPass.getPassphrase() != null) {
|
||||||
// remove passphrase object
|
// clean internal char[] from memory!
|
||||||
mPassphraseCache.remove(keyId);
|
cPass.getPassphrase().removeFromMemory();
|
||||||
|
}
|
||||||
|
// remove passphrase object
|
||||||
|
mPassphraseCache.remove(keyId);
|
||||||
|
}
|
||||||
|
|
||||||
Log.d(Constants.TAG, "PassphraseCacheService Timeout of keyId " + keyId + ", removed from memory!");
|
Log.d(Constants.TAG, "PassphraseCacheService Timeout of keyId " + keyId + ", removed from memory!");
|
||||||
|
|
||||||
|
|||||||
@@ -6,15 +6,16 @@
|
|||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
android:fillViewport="true">
|
android:fillViewport="true">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/encrypt_text_text"
|
android:id="@+id/encrypt_text_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:gravity="top"
|
android:gravity="top"
|
||||||
android:inputType="text|textCapSentences|textMultiLine|textLongMessage"
|
android:inputType="text|textCapSentences|textMultiLine|textLongMessage"
|
||||||
android:hint="@string/encrypt_content_edit_text_hint" />
|
android:hint="@string/encrypt_content_edit_text_hint" />
|
||||||
|
|||||||
Reference in New Issue
Block a user