Skip to content

Commit

Permalink
v1.27
Browse files Browse the repository at this point in the history
  • Loading branch information
mirfatif committed Aug 29, 2024
1 parent fdf002b commit e065b1d
Show file tree
Hide file tree
Showing 56 changed files with 280 additions and 219 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public void onResume() {
}

private String getFileContents() {

NotificationManagerCompat.from(App.getCxt())
.cancel(ApiUtils.getInt(R.integer.channel_crash_report));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public static void setLocale() {
}

public static Context getCxt() {

while (sContext == null) {
SystemClock.sleep(100);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ public Result backup(
StringBuilder stringBuilder = new StringBuilder();
for (Object object : (Set<?>) value) {
if (stringBuilder.length() != 0) {

stringBuilder.append(SEPARATOR);
}
stringBuilder.append(object.toString());
Expand Down Expand Up @@ -298,7 +297,6 @@ public Result restore(Uri file, boolean skipUninstalledApps, SwapUserIds swapUse
}
res = restore(is, skipUninstalledApps, swapUserIds);
} catch (IOException | SecurityException e) {

MyLog.e(TAG, "restore", e);
return null;
}
Expand All @@ -313,7 +311,6 @@ public Result restore(Uri file, boolean skipUninstalledApps, SwapUserIds swapUse
}

public Result restore(InputStream is, boolean skipUninstalledApps, SwapUserIds swap) {

ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len;
Expand Down Expand Up @@ -363,7 +360,6 @@ public Result restore(InputStream is, boolean skipUninstalledApps, SwapUserIds s
case LONG -> prefEdit.putLong(key, Long.parseLong(value));
case SET -> {
if (value.length() == 0) {

prefEdit.putStringSet(key, new HashSet<>());
} else {
prefEdit.putStringSet(key, new HashSet<>(Arrays.asList(value.split(SEPARATOR))));
Expand Down Expand Up @@ -436,7 +432,6 @@ public Result restore(InputStream is, boolean skipUninstalledApps, SwapUserIds s
PermsDb.INS.updateRefsDb(entities.toArray(new PermissionEntity[0]));

if (!entries.isEmpty() && entries.get(0)[0] == null) {

if (!AppOpsParser.INS.fixPermDb()) {
MySettings.INS.setFixPermDb(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ protected synchronized void onCreate(Bundle savedInstanceState) {
protected abstract void onCreated(Bundle savedInstanceState);

public boolean onOptionsItemSelected(MenuItem item) {

if (item.getItemId() == android.R.id.home) {
getOnBackPressedDispatcher().onBackPressed();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,16 @@ public CustomButton(Context context, AttributeSet attrs) {
normalBg.setColor(UiUtils.getDimBgColor((Activity) context));
normalBg.setCornerRadius(DP4_TO_PX * 3f / 2);
if (VERSION.SDK_INT >= VERSION_CODES.Q) {

normalBg.setPadding(2 * DP4_TO_PX, DP4_TO_PX, 2 * DP4_TO_PX, DP4_TO_PX);
}

int rippleColor = context.getColor(R.color.colorControlNormalA50);
ColorStateList colorStateList =
new ColorStateList(new int[][] {new int[] {}}, new int[] {rippleColor});
mRipple = new RippleDrawable(colorStateList, null, normalBg);

mRipple.setPadding(2 * DP4_TO_PX, DP4_TO_PX, 2 * DP4_TO_PX, DP4_TO_PX);

StateListDrawable d = new StateListDrawable();

d.addState(new int[] {android.R.attr.state_pressed}, new InsetDrawable(mRipple, DP4_TO_PX));
d.addState(new int[] {}, new InsetDrawable(normalBg, DP4_TO_PX));
setBackground(d);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
return true;
}
if (item.getItemId() == android.R.id.home) {

mA.finishAfterTransition();
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ private boolean connToAdbAndRestartDaemon(String host, int port, boolean buttonP
if (buttonPressed
&& VERSION.SDK_INT >= VERSION_CODES.R
&& port != MySettings.INS.getAdbPort()) {

try (AdbConnManager connMgr = new AdbConnManager()) {
connMgr.setTimeout(10, TimeUnit.SECONDS);
if (connMgr.connect(port)) {
Expand Down Expand Up @@ -418,7 +417,6 @@ private static int getPort(CharSequence portStr, TextInputLayout container) {
private static String getHost(CharSequence ipStr, TextInputLayout container) {
if (!TextUtils.isEmpty(ipStr)) {
String host = ipStr.toString().trim();

if (Os.inet_pton(OsConstants.AF_INET, host) != null) {
return host;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ default void onTextChanged(CharSequence s, int start, int before, int count) {}

private void doBackupRestore(boolean isBackup, Uri uri) {
if (uri == null) {

return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ void onCreated(String intentAction) {
}

private void startDaemon(String intentAction) {

DaemonStarter.INS.startPrivDaemon(false, true, true, !ACTION_SHOW_DRAWER.equals(intentAction));
}

Expand Down Expand Up @@ -88,13 +87,10 @@ private void handleStartDaemonResult(DaemonStarter.DaemonStartResult res) {
}

if (res.isFirstRun) {

mA.setLiveDataObservers();
} else if (res.wasAlive || res.daemonStarted == DaemonStarter.DaemonStartStatus.STARTED) {

PackageParser.INS.updatePkgList();
} else {

mA.setBigProgVisible(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ public MainActivity(MainActivityM activity) {
private final Class<?> mSnackBarLayoutCls = Snackbar.SnackbarLayout.class;

public void onCreated() {

if (isSecondaryUser()) {
return;
}
Expand Down Expand Up @@ -211,7 +210,6 @@ public void onNewIntent(Intent intent) {

public boolean onCreateOptionsMenu(Menu menu) {
if (UserUtils.getUserId() != 0) {

return false;
}

Expand Down Expand Up @@ -408,7 +406,6 @@ private void setNowProg(int progNow) {
private final LiveSchedParamTask<Integer> mPkgCountNotifier;

private void onListCompleted(int pkgCount) {

setProgVisible(false);

if (pkgCount >= 0) {
Expand Down Expand Up @@ -525,10 +522,8 @@ private void askForFeedback() {
}

private void setUpSearchView() {

mSearchView.setOnQueryTextListener(
new OnQueryTextListener() {

public boolean onQueryTextSubmit(String query) {
handleSearchQuery();
return true;
Expand Down Expand Up @@ -573,7 +568,6 @@ private void hideSearchSettings() {
FragmentManager fm = mA.getSupportFragmentManager();
Fragment frag = fm.findFragmentById(R.id.search_settings_frag);
if (frag != null) {

fm.beginTransaction().remove(frag).commit();
delay = 50;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ private TextAppearanceSpan getHighlightSpan(int currentColor) {
}

private static class DiffUtilItemCallBack extends DiffUtil.ItemCallback<Package> {

public boolean areItemsTheSame(Package oldItem, Package newItem) {
return oldItem.getName().equals(newItem.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public View onCreateView(

public Dialog onCreateDialog(Bundle savedInstanceState) {
if (mPkg == null) {

dismissAllowingStateLoss();
}
return super.onCreateDialog(savedInstanceState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ private void showOverlay() {

mAnim.addListener(
new Animator.AnimatorListener() {

public void onAnimationStart(Animator animation) {}

public void onAnimationEnd(Animator animation) {
Expand All @@ -182,7 +181,6 @@ public void onAnimationRepeat(Animator animation) {}
mOverlay.setOnClickListener(v -> endFocus());

if (!mDrawerLayout.isOpen()) {

endFocus();
} else {
mDecorView.addView(mOverlay);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import com.mirfatif.permissionmanagerx.util.bg.LiveEvent;
import com.mirfatif.permissionmanagerx.util.bg.UiRunner;
import com.mirfatif.privtasks.Constants;
import com.mirfatif.privtasks.HiddenSdkConstants;
import com.mirfatif.privtasks.HiddenSdkIntConstants;
import com.mirfatif.privtasks.bind.MyPackageOps;
import com.mirfatif.privtasks.bind.PermFixedFlags;
import com.mirfatif.privtasks.util.MyLog;
Expand Down Expand Up @@ -123,7 +123,6 @@ private List<Package> updatePkgListInternal() {
PackageInfo pkgInfo = pkgInfoList.get(i);

if (pkgInfo == null) {

continue;
}

Expand Down Expand Up @@ -233,7 +232,7 @@ public void buildRequiredData() {
}
} else if (mAppCanReadFlags) {
try {
flags = HiddenSdkConstants.getPermFixedFlags();
flags = HiddenSdkIntConstants.getPermFixedFlags();
} catch (RemoteException e) {
mAppCanReadFlags = false;
MyLog.e(TAG, "buildRequiredData", e.toString());
Expand Down Expand Up @@ -587,7 +586,6 @@ && createPerm(pkgInfo, permName, count, filterPerms, permList)) {
}

private boolean isNotFilteredOut(Permission perm) {

if (perm.isExtraAppOp()) {
return true;
}
Expand Down Expand Up @@ -852,7 +850,6 @@ private int[] createAppOp(
if (opMode == null) {
opModeSet = false;
} else if (!AppOpsParser.INS.isValidAppOpMode(opMode)) {

mOpModesConsistent = validMode = false;
}

Expand Down Expand Up @@ -935,7 +932,6 @@ private ManifestPermFlags getManifestPermFlags(String permName) {
try {
flags = getManifestPermFlags(PackageParser.INS.mPm.getPermissionInfo(permName, 0));
} catch (NameNotFoundException ignored) {

flags = new ManifestPermFlags();
}
mManifestFlags.put(permName, flags);
Expand All @@ -949,7 +945,6 @@ public static ManifestPermFlags getManifestPermFlags(PermissionInfo permInfo) {

int protectionLevel = getProtectionLevel(permInfo) & PI_PROTECTION_MASK_BASE;
int protectionFlags = getProtectionLevel(permInfo) & ~PI_PROTECTION_MASK_BASE;

int PROTECTION_SIGNATURE_OR_SYSTEM = PermissionInfo.PROTECTION_SIGNATURE_OR_SYSTEM;

if (protectionLevel == PermissionInfo.PROTECTION_NORMAL) {
Expand Down Expand Up @@ -1000,7 +995,6 @@ public void handleSearchQuery() {

private void handleSearchQuery(int isFinal) {
if (isFinal == PostListStatus.NOT_FINAL && mSearchQueryExecutor.hasRunningOrPendingTasks()) {

return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ public int getAppOpMode() {
}

public String getAppOpAccessTime() {

if (System.currentTimeMillis() - mAppOpAccessTime > TimeUnit.DAYS.toMillis(365)) {
return null;
}
Expand Down Expand Up @@ -258,7 +257,6 @@ private boolean isChangeableInternal() {
if (mAppOp) {
return isAppOpPermChangeable(mDependsOn);
} else {

return (mProtectionLevel.equals(PROTECTION_DANGEROUS) || mDevelopment)
&& (!mSystemApp || !mPrivileged || allowCriticChanges)
&& !mPolicyFixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ public boolean onCreateOptionsMenu(Menu menu) {

mSearchView.setOnQueryTextListener(
new SearchView.OnQueryTextListener() {

public boolean onQueryTextSubmit(String query) {
submitPermList();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public View onCreateView(

public Dialog onCreateDialog(Bundle savedInstanceState) {
if (mPerm == null) {

dismissAllowingStateLoss();
}
return super.onCreateDialog(savedInstanceState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ private void populateExcludedAppsList(boolean force, boolean loadDefaults) {
int flags = PackageManager.MATCH_UNINSTALLED_PACKAGES;
pkgLabel = ApiUtils.getAppInfo(pkgName, flags).loadLabel(App.getPm()).toString();
} catch (PackageManager.NameNotFoundException e) {

continue;
}

Expand All @@ -108,7 +107,6 @@ private void populateExcludedAppsList(boolean force, boolean loadDefaults) {
excAppsTmpList.sort(Comparator.comparing(o -> o.label.toString().toUpperCase()));

CharSequence[] excAppsLabels = new CharSequence[excAppsTmpList.size()];

mExcludedApps = Collections.synchronizedSet(new LinkedHashSet<>());

for (int i = 0; i < excAppsTmpList.size(); i++) {
Expand Down Expand Up @@ -206,7 +204,6 @@ public void populateExtraAppOpsList(boolean force, boolean loadDefaults) {
Set<String> extraAppOps;

if (savedExtraAppOps == null || loadDefaults) {

String[] defaultExtraAppOps =
App.getCxt().getResources().getStringArray(R.array.extra_app_ops);
extraAppOps = new HashSet<>(Arrays.asList(defaultExtraAppOps));
Expand All @@ -217,7 +214,6 @@ public void populateExtraAppOpsList(boolean force, boolean loadDefaults) {
List<String> appOpsList = AppOpsParser.INS.getAppOpsNames();

if (!appOpsList.isEmpty()) {

extraAppOps.removeIf(appOp -> !appOpsList.contains(appOp));
}

Expand Down Expand Up @@ -247,7 +243,6 @@ public void populateLists(boolean force) {
}

public void resetExcFilters() {

SharedPreferences.Editor prefEditor = MySettings.getDefPrefs().edit();
int count = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@ public void onCreated(Bundle savedInstanceState) {
mB.excFiltersMasterSwitch.setOnClickListener(
v -> {
if (mB.excFiltersMasterSwitch.isChecked()) {

MySettings.INS.setExcFiltersEnabled(true);
addFrag(savedInstanceState);
} else {
removeFrag();

MySettings.INS.setExcFiltersEnabled(false);
}
PackageParser.INS.updatePkgList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,11 @@ private void updateExcludedPermsView(

private void updateExtraAppOpsView(
String[] appOps, CharSequence[] appOpsLabels, Set<String> extraAppOps) {

int appOpsCount = appOpsLabels.length;

if (appOpsCount != 0) {

extraAppOpsListView.setEntries(appOpsLabels);

extraAppOpsListView.setEntryValues(appOps);

extraAppOpsListView.setValues(extraAppOps);
}

Expand All @@ -329,7 +325,6 @@ private void updateExtraAppOpsView(
} else {
message = (String) extraAppOps.toArray()[0];
extraAppOpsCount--;

if (extraAppOpsCount > 0) {
message =
ApiUtils.getQtyString(
Expand All @@ -347,7 +342,6 @@ public void onDisplayPreferenceDialog(Preference preference) {
}

public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {

ExcFiltersData.INS.updateList(key);

updateViews();
Expand Down
Loading

0 comments on commit e065b1d

Please sign in to comment.