Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* [Issue 13] Remove unused imports and code. #1348

Open
wants to merge 1 commit into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 7 additions & 28 deletions app/src/main/java/dev/ukanth/ufirewall/Api.java
Original file line number Diff line number Diff line change
Expand Up @@ -2748,14 +2748,6 @@ public static boolean loadSharedPreferencesFromFile(Context ctx, StringBuilder b
return res;
}

/**
* Probe log target
* @param ctx
*/
public static void probeLogTarget(final Context ctx) {

}

@SuppressLint("InlinedApi")
public static void showInstalledAppDetails(Context context, String packageName) {
final String SCHEME = "package";
Expand Down Expand Up @@ -2989,19 +2981,6 @@ public static void applyDefaultChainsv6(Context ctx, RootCommand callback) {
}
}

/**
* Delete all firewall rules. For diagnostic purposes only.
*
* @param ctx application context
* @param callback callback for completion
*/
public static void flushOtherRules(Context ctx, RootCommand callback) {
List<String> cmds = new ArrayList<String>();
cmds.add("-F firewall");
cmds.add("-X firewall");
apply46(ctx, cmds, callback);
}

// Clipboard
public static void copyToClipboard(Context context, String val) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
Expand Down Expand Up @@ -3159,13 +3138,13 @@ public static void setDefaultPermission(ApplicationInfo applicationInfo) {

static class RuleDataSet {

List<Integer> wifiList;
List<Integer> dataList;
List<Integer> lanList;
List<Integer> roamList;
List<Integer> vpnList;
List<Integer> tetherList;
List<Integer> torList;
final List<Integer> wifiList;
final List<Integer> dataList;
final List<Integer> lanList;
final List<Integer> roamList;
final List<Integer> vpnList;
final List<Integer> tetherList;
final List<Integer> torList;

RuleDataSet(List<Integer> uidsWifi, List<Integer> uids3g,
List<Integer> uidsRoam, List<Integer> uidsVPN, List<Integer> uidsTether,
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/dev/ukanth/ufirewall/InterfaceDetails.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ public class InterfaceDetails {
public boolean isBluetoothTethered = false;
public boolean tetherBluetoothStatusKnown = false;

public boolean isUsbTethered = false;
public boolean tetherUsbStatusKnown = false;
final public boolean isUsbTethered = false;

final public boolean tetherUsbStatusKnown = false;

public String lanMaskV4 = "";
public String lanMaskV6 = "";
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/dev/ukanth/ufirewall/InterfaceTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@

import static dev.ukanth.ufirewall.util.G.ctx;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
Expand Down
53 changes: 3 additions & 50 deletions app/src/main/java/dev/ukanth/ufirewall/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
private static final int DEFAULT_COLUMN = 2;
private int selectedColumns = DEFAULT_COLUMN;
private static final int DEFAULT_VIEW_LIMIT = 4;
private View view;

public boolean isDirty() {
return dirty;
Expand Down Expand Up @@ -272,14 +271,6 @@ private void updateSelectedColumns() {
selectedColumns = G.enableTor() ? selectedColumns + 1 : selectedColumns;
}

private void registerLogService() {
if (G.enableLogService()) {
Log.i(G.TAG, "Starting Log Service");
final Intent logIntent = new Intent(getBaseContext(), LogService.class);
startService(logIntent);
}
}

private void registerUIRefresh() {
IntentFilter filter = new IntentFilter("dev.ukanth.ufirewall.ui.CHECKREFRESH");
uiRefreshReceiver = new BroadcastReceiver() {
Expand Down Expand Up @@ -831,27 +822,6 @@ private void reloadProfileList(boolean reset) {
}
}

public void deviceCheck() {
if (Build.VERSION.SDK_INT >= 21) {
if ((G.isDoKey(getApplicationContext()) || isDonate())) {
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
if (keyguardManager.isKeyguardSecure()) {
Intent createConfirmDeviceCredentialIntent = keyguardManager.createConfirmDeviceCredentialIntent(null, null);
if (createConfirmDeviceCredentialIntent != null) {
try {
startActivityForResult(createConfirmDeviceCredentialIntent, LOCK_VERIFICATION);
} catch (ActivityNotFoundException e) {
}
}
} else {
Toast.makeText(this, getText(R.string.android_version), Toast.LENGTH_SHORT).show();
}
} else {
Api.donateDialog(MainActivity.this, true);
}
}
}

@Override
protected void onPause() {
super.onPause();
Expand Down Expand Up @@ -898,8 +868,6 @@ private void checkPreferences() {
*/
private void refreshHeader() {
final String mode = G.pPrefs.getString(Api.PREF_MODE, Api.MODE_WHITELIST);
//final TextView labelmode = (TextView) this.findViewById(R.id.label_mode);
final Resources res = getResources();

if (mode.equals(Api.MODE_WHITELIST)) {
if (mainMenu != null) {
Expand Down Expand Up @@ -1251,7 +1219,7 @@ private void copyOldExportedData() {
String targetDir = ctx.getExternalFilesDir(null) + "/";
String command = "cp -R " + existingDir + " " + targetDir;
Log.i(TAG, "Invoking migration script " + command);
com.topjohnwu.superuser.Shell.Result result = com.topjohnwu.superuser.Shell.cmd(command).exec();
com.topjohnwu.superuser.Shell.cmd(command).exec();
G.hasCopyOldExports(true);
}
}
Expand Down Expand Up @@ -2434,7 +2402,7 @@ protected void onProgressUpdate(Integer... progress) {
}

private class RunApply extends AsyncTask<Void, Long, Boolean> {
boolean enabled = Api.isEnabled(getApplicationContext());
final boolean enabled = Api.isEnabled(getApplicationContext());

private final WeakReference<MainActivity> activityReference;

Expand Down Expand Up @@ -2524,7 +2492,7 @@ protected void onPostExecute(Boolean aVoid) {
private class RootCheck extends AsyncTask<Void, Void, Void> {
MaterialDialog suDialog = null;
boolean unsupportedSU = false;
boolean[] suGranted = {false};
final boolean[] suGranted = {false};
private Context context = null;
//private boolean suAvailable = false;

Expand Down Expand Up @@ -2594,19 +2562,4 @@ public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which)
}
}
}

@RequiresApi(28)
private static class OnUnhandledKeyEventListenerWrapper implements View.OnUnhandledKeyEventListener {
private final ViewCompat.OnUnhandledKeyEventListenerCompat mCompatListener;

OnUnhandledKeyEventListenerWrapper(ViewCompat.OnUnhandledKeyEventListenerCompat listener) {
this.mCompatListener = listener;
}

public boolean onUnhandledKeyEvent(View v, KeyEvent event) {
return this.mCompatListener.onUnhandledKeyEvent(v, event);
}
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import dev.ukanth.ufirewall.Api;
import dev.ukanth.ufirewall.R;
import dev.ukanth.ufirewall.service.RootCommand;
import dev.ukanth.ufirewall.util.G;

public class ExpPreferenceFragment extends PreferenceFragment implements
Expand Down
15 changes: 0 additions & 15 deletions app/src/main/java/dev/ukanth/ufirewall/profiles/ProfileHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,6 @@ public static ProfileData getProfileByIdentifier(String identifier) {
.querySingle();
}

public static void updateProfileName(String identifier,String newName) {
ProfileData profileData = SQLite.select()
.from(ProfileData.class).where(ProfileData_Table.name.eq(identifier))
.querySingle();
profileData.setName(newName);
profileData.save();
}

public static boolean deleteProfile(String identifier) {
ProfileData data = getProfileByIdentifier(identifier);
if (data != null) {
data.delete();
}
return true;
}
public static boolean deleteProfileByName(String profileName) {
ProfileData data = getProfileByName(profileName);
if (data != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.os.Environment;

import com.afollestad.materialdialogs.MaterialDialog;
import com.topjohnwu.superuser.Shell;

import java.io.File;
import java.io.FilenameFilter;
Expand Down
Loading
Loading