mActivityRule = new ActivityTestRule<>(
45 | EditHostActivity.class, false, false);
46 |
47 | @Before
48 | public void makeDatabasePristine() {
49 | Context testContext = getTargetContext();
50 | PubkeyDatabase.resetInMemoryInstance(testContext);
51 |
52 | mActivityRule.launchActivity(new Intent());
53 | }
54 |
55 | @Test
56 | public void checkFontSizeEntry() throws Exception {
57 | onView(withId(R.id.font_size_text)).perform(scrollTo(), clearText());
58 | onView(withId(R.id.nickname_field)).perform(click());
59 | }
60 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/connectbot/service/BackupAgent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ConnectBot: simple, powerful, open-source SSH client for Android
3 | * Copyright 2010 Kenny Root, Jeffrey Sharkey
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.connectbot.service;
19 |
20 | import org.connectbot.util.HostDatabase;
21 | import org.connectbot.util.PreferenceConstants;
22 | import org.connectbot.util.PubkeyDatabase;
23 |
24 | import android.app.backup.BackupAgentHelper;
25 | import android.app.backup.FileBackupHelper;
26 | import android.app.backup.SharedPreferencesBackupHelper;
27 | import android.content.SharedPreferences;
28 | import android.preference.PreferenceManager;
29 | import android.util.Log;
30 |
31 | /**
32 | * ConnectBot's backup agent. This is only loaded on API 8 and later by
33 | * reading the AndroidManifest.xml, so it shouldn't affect any minimum
34 | * SDK level.
35 | */
36 | public class BackupAgent extends BackupAgentHelper {
37 | @Override
38 | public void onCreate() {
39 | Log.d("ConnectBot.BackupAgent", "onCreate called");
40 |
41 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
42 |
43 | SharedPreferencesBackupHelper prefsHelper = new SharedPreferencesBackupHelper(this, getPackageName() + "_preferences");
44 | addHelper(PreferenceConstants.BACKUP_PREF_KEY, prefsHelper);
45 |
46 | FileBackupHelper hosts = new FileBackupHelper(this, "../databases/" + HostDatabase.DB_NAME);
47 | addHelper(HostDatabase.DB_NAME, hosts);
48 |
49 | if (prefs.getBoolean(PreferenceConstants.BACKUP_KEYS, PreferenceConstants.BACKUP_KEYS_DEFAULT)) {
50 | FileBackupHelper pubkeys = new FileBackupHelper(this, "../databases/" + PubkeyDatabase.DB_NAME);
51 | addHelper(PubkeyDatabase.DB_NAME, pubkeys);
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/volume_preference_dialog_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
26 |
27 |
39 |
40 |
49 |
50 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/act_portforwardlist.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
27 |
28 |
30 |
37 |
38 |
48 |
49 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/app/src/main/java/com/google/ase/Exec.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.ase;
18 |
19 | import java.io.FileDescriptor;
20 |
21 | /**
22 | * Tools for executing commands.
23 | */
24 | public class Exec {
25 | /**
26 | * @param cmd
27 | * The command to execute
28 | * @param arg0
29 | * The first argument to the command, may be null
30 | * @param arg1
31 | * the second argument to the command, may be null
32 | * @return the file descriptor of the started process.
33 | *
34 | */
35 | public static FileDescriptor createSubprocess(String cmd, String arg0, String arg1) {
36 | return createSubprocess(cmd, arg0, arg1, null);
37 | }
38 |
39 | /**
40 | * @param cmd
41 | * The command to execute
42 | * @param arg0
43 | * The first argument to the command, may be null
44 | * @param arg1
45 | * the second argument to the command, may be null
46 | * @param processId
47 | * A one-element array to which the process ID of the started process will be written.
48 | * @return the file descriptor of the started process.
49 | *
50 | */
51 | public static native FileDescriptor createSubprocess(String cmd, String arg0, String arg1,
52 | int[] processId);
53 |
54 | public static native void setPtyWindowSize(FileDescriptor fd, int row, int col, int xpixel,
55 | int ypixel);
56 |
57 | /**
58 | * Causes the calling thread to wait for the process associated with the receiver to finish
59 | * executing.
60 | *
61 | * @return The exit value of the Process being waited on
62 | *
63 | */
64 | public static native int waitFor(int processId);
65 |
66 | static {
67 | System.loadLibrary("com_google_ase_Exec");
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_checkablemenuitem.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
21 |
22 |
29 |
30 |
37 |
38 |
48 |
49 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/test/java/org/connectbot/HostListActivityTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ConnectBot: simple, powerful, open-source SSH client for Android
3 | * Copyright 2015 Kenny Root, Jeffrey Sharkey
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.connectbot;
19 |
20 | import org.connectbot.service.TerminalManager;
21 | import org.junit.Test;
22 | import org.junit.runner.RunWith;
23 | import org.robolectric.Robolectric;
24 |
25 | import android.app.Application;
26 | import android.content.ComponentName;
27 | import android.content.Intent;
28 | import androidx.test.core.app.ApplicationProvider;
29 | import androidx.test.ext.junit.runners.AndroidJUnit4;
30 |
31 | import static org.junit.Assert.assertTrue;
32 | import static org.mockito.Mockito.mock;
33 | import static org.mockito.Mockito.spy;
34 | import static org.mockito.Mockito.when;
35 | import static org.robolectric.Shadows.shadowOf;
36 |
37 | @RunWith(AndroidJUnit4.class)
38 | public class HostListActivityTest {
39 | private void mockBindToService(TerminalManager terminalManager) {
40 | TerminalManager.TerminalBinder stubBinder = mock(TerminalManager.TerminalBinder.class);
41 | when(stubBinder.getService()).thenReturn(terminalManager);
42 | shadowOf((Application) ApplicationProvider.getApplicationContext()).setComponentNameAndServiceForBindService(new ComponentName("org.connectbot", TerminalManager.class.getName()), stubBinder);
43 | }
44 |
45 | @Test
46 | public void bindsToTerminalManager() {
47 | TerminalManager terminalManager = spy(TerminalManager.class);
48 | mockBindToService(terminalManager);
49 |
50 | HostListActivity activity = Robolectric.buildActivity(HostListActivity.class).create().start().get();
51 |
52 | Intent serviceIntent = new Intent(activity, TerminalManager.class);
53 | Intent actualIntent = shadowOf(activity).getNextStartedService();
54 |
55 | assertTrue(actualIntent.filterEquals(serviceIntent));
56 | }
57 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/openintents/intents/FileManagerIntents.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 OpenIntents.org
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.openintents.intents;
18 |
19 | // Version Dec 9, 2008
20 |
21 |
22 | /**
23 | * Provides OpenIntents actions, extras, and categories used by providers.
24 | * These specifiers extend the standard Android specifiers.
25 | */
26 | public final class FileManagerIntents {
27 |
28 | /**
29 | * Activity Action: Pick a file through the file manager, or let user
30 | * specify a custom file name.
31 | * Data is the current file name or file name suggestion.
32 | * Returns a new file name as file URI in data.
33 | *
34 | * Constant Value: "org.openintents.action.PICK_FILE"
35 | */
36 | public static final String ACTION_PICK_FILE = "org.openintents.action.PICK_FILE";
37 |
38 | /**
39 | * Activity Action: Pick a directory through the file manager, or let user
40 | * specify a custom file name.
41 | * Data is the current directory name or directory name suggestion.
42 | * Returns a new directory name as file URI in data.
43 | *
44 | * Constant Value: "org.openintents.action.PICK_DIRECTORY"
45 | */
46 | public static final String ACTION_PICK_DIRECTORY = "org.openintents.action.PICK_DIRECTORY";
47 |
48 | /**
49 | * The title to display.
50 | *
51 | * This is shown in the title bar of the file manager.
52 | *
53 | * Constant Value: "org.openintents.extra.TITLE"
54 | */
55 | public static final String EXTRA_TITLE = "org.openintents.extra.TITLE";
56 |
57 | /**
58 | * The text on the button to display.
59 | *
60 | * Depending on the use, it makes sense to set this to "Open" or "Save".
61 | *
62 | * Constant Value: "org.openintents.extra.BUTTON_TEXT"
63 | */
64 | public static final String EXTRA_BUTTON_TEXT = "org.openintents.extra.BUTTON_TEXT";
65 |
66 | }
67 |
--------------------------------------------------------------------------------