Skip to content

Commit

Permalink
v1.25
Browse files Browse the repository at this point in the history
  • Loading branch information
mirfatif committed Jun 4, 2024
1 parent fd2b0a4 commit 643527b
Show file tree
Hide file tree
Showing 38 changed files with 768 additions and 163 deletions.
6 changes: 5 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ android {
// Due to android:extractNativeLibs set to 'true' in AndroidManifest.
useLegacyPackaging true
}

// Exclude large files.
resources.excludes.add('org/bouncycastle/pqc/crypto/picnic/lowmcL1.bin.properties')
resources.excludes.add('org/bouncycastle/pqc/crypto/picnic/lowmcL3.bin.properties')
resources.excludes.add('org/bouncycastle/pqc/crypto/picnic/lowmcL5.bin.properties')
}
}

Expand All @@ -127,7 +132,6 @@ dependencies {

implementation libs.androidx.appcompat
implementation libs.androidx.recyclerview
implementation libs.androidx.lifecycle.extensions
implementation libs.androidx.swiperefreshlayout
implementation libs.androidx.preference
implementation libs.androidx.browser
Expand Down
4 changes: 4 additions & 0 deletions app/src/foss/res/values-tr/strings_foss.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">İzinler Yöneticisi X</string>
</resources>
51 changes: 32 additions & 19 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,30 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<uses-permission
android:name="android.permission.GET_APP_OPS_STATS"
tools:ignore="ProtectedPermissions"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />

<application
android:name=".fwk.AppM"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".fwk.AppM"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup">

<activity
android:exported="true"
android:name=".fwk.MainActivityM">
android:name=".fwk.MainActivityM"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -32,50 +34,61 @@

<activity
android:name=".fwk.PackageActivityM"
android:parentActivityName=".fwk.MainActivityM"/>
android:parentActivityName=".fwk.MainActivityM" />

<activity
android:name=".fwk.SettingsActivityM"
android:parentActivityName=".fwk.MainActivityM"/>
android:parentActivityName=".fwk.MainActivityM" />

<activity
android:name=".fwk.AdvSettingsActivityM"
android:parentActivityName=".fwk.MainActivityM"/>
android:parentActivityName=".fwk.MainActivityM" />

<activity
android:name=".fwk.FilterSettingsActivityM"
android:parentActivityName=".fwk.MainActivityM"/>
android:parentActivityName=".fwk.MainActivityM" />

<activity
android:name=".fwk.AboutActivityM"
android:parentActivityName=".fwk.MainActivityM"/>
android:parentActivityName=".fwk.MainActivityM" />

<activity
android:name=".fwk.HelpActivityM"
android:parentActivityName=".fwk.MainActivityM"/>
android:parentActivityName=".fwk.MainActivityM" />

<activity
android:name=".fwk.CrashReportActivityM"
android:parentActivityName=".fwk.MainActivityM"/>
android:parentActivityName=".fwk.MainActivityM" />

<service android:name=".fwk.LogcatSvcM" />
<service
android:name=".fwk.LogcatSvcM"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This service is explicitly started by the user. It may run up to maximum 5 minutes and collects logs in a text file while the user is interacting with the app which includes navigating between different screens and closing the app. User can tap the stop button on the notification anytime to stop the service." />
</service>

<service
android:exported="true"
android:name=".fwk.DaemonRcvSvcM"
android:exported="true"
android:foregroundServiceType="shortService"
tools:ignore="ExportedService" />

<service
android:name=".fwk.AdbConnectSvcM"
android:exported="true"
android:foregroundServiceType="specialUse"
tools:ignore="ExportedService">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This service is explicitly started by the user through commandline to notify the app that ADB has been enabled." />
</service>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${LOG_FILE_PROVIDER}"
android:exported="false"
android:grantUriPermissions="true"
android:name="androidx.core.content.FileProvider">
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static com.mirfatif.permissionmanagerx.util.ApiUtils.getString;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Debug;
Expand Down Expand Up @@ -117,7 +118,13 @@ public void onCreated() {

mB.dumpCont.setVisibility(View.VISIBLE);
mB.dumpV.setOnClickListener(
v -> mDumpLauncher.launch("PMX_Dump_" + Util.getCurrDateTime(false, true) + ".txt"));
v -> {
try {
mDumpLauncher.launch("PMX_Dump_" + Util.getCurrDateTime(false, true) + ".txt");
} catch (ActivityNotFoundException ignored) {
UiUtils.showToast(R.string.no_file_picker_installed);
}
});

PackageParser.INS
.getListInProg()
Expand Down Expand Up @@ -154,7 +161,11 @@ private void handleLogging(boolean notifPermGranted) {

if (notifPermGranted) {
UiUtils.showToast(R.string.select_log_file);
mLoggingLauncher.launch("PermissionManagerX_" + Util.getCurrDateTime(false, true) + ".log");
try {
mLoggingLauncher.launch("PermissionManagerX_" + Util.getCurrDateTime(false, true) + ".log");
} catch (ActivityNotFoundException ignored) {
UiUtils.showToast(R.string.no_file_picker_installed);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected synchronized void onCreate(Bundle savedInstanceState) {
public boolean onOptionsItemSelected(MenuItem item) {

if (item.getItemId() == android.R.id.home) {
onBackPressed();
getOnBackPressedDispatcher().onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ protected void onCreated(Bundle savedInstanceState) {
mA.onCreated();
}

public void onBackPressed() {
if (!mA.onBackPressed()) {
super.onBackPressed();
}
}

public boolean onCreateOptionsMenu(Menu menu) {
return mA.onCreateOptionsMenu(menu);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
return mA.onOptionsItemSelected(item) || super.onOptionsItemSelected(item);
}

public void onBackPressed() {
if (!mA.onBackPressed()) {
super.onBackPressed();
}
}

protected void onResume() {
super.onResume();
mA.onResume();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ protected void onStop() {
super.onStop();
}

public void onBackPressed() {
if (!mA.onBackPressed()) {
super.onBackPressed();
}
}

public AlertDialog createDialog(String tag, AlertDialogFragment dialogFragment) {
AlertDialog d = mA.createDialog(tag);
return d != null ? d : super.createDialog(tag, dialogFragment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ protected void onCreated(Bundle savedInstanceState) {
mA.onCreated(savedInstanceState);
}

public void onBackPressed() {
if (!mA.onBackPressed()) {
super.onBackPressed();
}
}

protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mA.onSaveInstanceState(outState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.activity.OnBackPressedCallback;
import androidx.webkit.WebViewClientCompat;
import androidx.webkit.WebViewCompat;
import com.mirfatif.permissionmanagerx.R;
Expand All @@ -26,11 +27,12 @@
import java.util.ArrayList;
import java.util.List;

public class HelpActivity {
public class HelpActivity extends OnBackPressedCallback {

private final HelpActivityM mA;

public HelpActivity(HelpActivityM activity) {
super(true);
mA = activity;
}

Expand Down Expand Up @@ -79,14 +81,16 @@ public void onCreated() {
mB.webV.clearCache(true);
mB.webV.reload();
});

mA.getOnBackPressedDispatcher().addCallback(mA, this);
}

public boolean onBackPressed() {
public void handleOnBackPressed() {
if (mB != null && mB.webV.canGoBack()) {
mB.webV.goBack();
return true;
} else {
mA.finishAfterTransition();
}
return false;
}

private void enableJs() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.mirfatif.permissionmanagerx.util.bg.LiveTasksQueueTyped;
import com.mirfatif.privtasks.util.MyLog;
import com.mirfatif.privtasks.util.NonBlockingReader;
import io.github.muntashirakon.adb.AdbPairingRequiredException;
import io.github.muntashirakon.adb.AdbStream;
import io.github.muntashirakon.adb.android.AdbMdns;
import java.io.IOException;
Expand Down Expand Up @@ -311,7 +312,10 @@ private boolean connToAdbAndRestartDaemon(String host, int port, boolean buttonP
} else {
MyLog.e(TAG, "connToAdbAndRestartDaemon", "Adb connect for tcpip failed");
}
} catch (AdbException | InterruptedException | IOException e) {
} catch (AdbException
| InterruptedException
| IOException
| AdbPairingRequiredException e) {
MyLog.e(TAG, "connToAdbAndRestartDaemon", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
import androidx.activity.OnBackPressedCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.ActionBar;
Expand Down Expand Up @@ -71,13 +72,14 @@
import java.util.Objects;
import java.util.concurrent.TimeUnit;

public class MainActivity {
public class MainActivity extends OnBackPressedCallback {

private static final String TAG = "MainActivity";

public final MainActivityM mA;

public MainActivity(MainActivityM activity) {
super(true);
mA = activity;

mPkgCountNotifier =
Expand Down Expand Up @@ -199,6 +201,8 @@ public void onCreated() {
if (ApiUtils.hasNotifPerm()) {
BgRunner.execute(() -> AppUpdate.check(true));
}

mA.getOnBackPressedDispatcher().addCallback(mA, this);
}

public void onNewIntent(Intent intent) {
Expand Down Expand Up @@ -246,31 +250,25 @@ public boolean onOptionsItemSelected(MenuItem item) {
return mActFlavor.onOptionsItemSelected(item) || mDrawerToggle.onOptionsItemSelected(item);
}

public boolean onBackPressed() {
public void handleOnBackPressed() {
mCheckBoxFocus.endFocus();

if (mB != null && mB.getRoot().isDrawerOpen(GravityCompat.START)) {
mB.getRoot().closeDrawer(GravityCompat.START, true);
return true;
return;
}

if (mSearchView != null && !TextUtils.isEmpty(mSearchView.getQuery())) {
collapseSearchView();
return true;
return;
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
mExited = true;
mActFlavor.onBackPressed();
}

if (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q) {
mA.finishAfterTransition();
} else {
return false;
}

return true;
mA.finishAfterTransition();
}

private boolean mExited = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ && createPerm(pkgInfo, permName, count, filterPerms, permList)) {
}
}

if (ops1.size() != 0) {
if (!ops1.isEmpty()) {
int[] ops2 = new int[ops1.size()];
for (int i = 0; i < ops1.size(); i++) {
ops2[i] = ops1.get(i);
Expand Down Expand Up @@ -1070,6 +1070,9 @@ private void doSearchInBg(int isFinal) {

private void updateSearchLists(Package pkg, boolean removeOnly) {
String queryText = MySettings.INS.getQueryText();
if (queryText == null) {
return;
}
if (!MySettings.INS.isDeepSearching()) {
if (pkg.contains(queryText)) {
if (!removeOnly) {
Expand Down
Loading

0 comments on commit 643527b

Please sign in to comment.