Skip to content

Commit

Permalink
fix: Fix broken Remove screen capture restriction, `Remove screensh…
Browse files Browse the repository at this point in the history
…ot restriction`, `Spoof Wi-Fi connection`, and `Export internal data documents provider` patch (ReVanced#4405)
  • Loading branch information
LisoUseInAIKyrios authored Feb 6, 2025
1 parent a935f5c commit 1d52b74
Show file tree
Hide file tree
Showing 28 changed files with 165 additions and 110 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
android.namespace = "app.revanced.extension"
android {
namespace = "app.revanced.extension"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

dependencies {
compileOnly(libs.annotation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import androidx.annotation.RequiresApi;

/** @noinspection deprecation, unused */
@SuppressWarnings({"deprecation", "unused"})
public class SpoofWifiPatch {

// Used to check what the (real or fake) active network is (take a look at `hasTransport`).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
android {
namespace = "app.revanced.extension"

defaultConfig {
minSdk = 21
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

dependencies {
compileOnly(libs.annotation)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package app.revanced.extension.all.misc.directory.documentsprovider;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.ProviderInfo;
Expand All @@ -23,6 +24,7 @@
/**
* A DocumentsProvider that allows access to the app's internal data directory.
*/
@SuppressLint("LongLogTag")
public class InternalDataDocumentsProvider extends DocumentsProvider {
private static final String[] rootColumns =
{"root_id", "mime_types", "flags", "icon", "title", "summary", "document_id"};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
android.namespace = "app.revanced.extension"
android {
namespace = "app.revanced.extension"

defaultConfig {
minSdk = 21
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

dependencies {
compileOnly(libs.annotation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

import androidx.annotation.RequiresApi;

public final class RemoveScreencaptureRestrictionPatch {
@SuppressWarnings("unused")
public final class RemoveScreenCaptureRestrictionPatch {
// Member of AudioAttributes.Builder
@RequiresApi(api = Build.VERSION_CODES.Q)
public static AudioAttributes.Builder setAllowedCapturePolicy(final AudioAttributes.Builder builder, final int capturePolicy) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
android.namespace = "app.revanced.extension"
android {
namespace = "app.revanced.extension"

defaultConfig {
minSdk = 21
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

dependencies {
compileOnly(libs.annotation)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.view.Window;
import android.view.WindowManager;

@SuppressWarnings("unused")
public class RemoveScreenshotRestrictionPatch {

public static void addFlags(Window window, int flags) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/boostforreddit/stub/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

android {
namespace = "app.revanced.extension"
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = 24
Expand Down
6 changes: 5 additions & 1 deletion extensions/music/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
// Do not remove. Necessary for the extension plugin to be applied to the project.
android {
defaultConfig {
minSdk = 26
}
}
2 changes: 1 addition & 1 deletion extensions/reddit/stub/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

android {
namespace = "app.revanced.extension"
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = 24
Expand Down
2 changes: 1 addition & 1 deletion extensions/syncforreddit/stub/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

android {
namespace = "app.revanced.extension"
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = 24
Expand Down
11 changes: 11 additions & 0 deletions extensions/tiktok/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,14 @@ dependencies {
compileOnly(project(":extensions:tiktok:stub"))
compileOnly(libs.annotation)
}

android {
defaultConfig {
minSdk = 22
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ public class ReVancedPreferenceFragment extends AbstractPreferenceFragment {
protected void syncSettingWithPreference(@NonNull Preference pref,
@NonNull Setting<?> setting,
boolean applySettingToPreference) {
if (pref instanceof RangeValuePreference rangeValuePref) {
if (pref instanceof RangeValuePreference) {
RangeValuePreference rangeValuePref = (RangeValuePreference) pref;
Setting.privateSetValueFromString(setting, rangeValuePref.getValue());
} else if (pref instanceof DownloadPathPreference downloadPathPref) {
} else if (pref instanceof DownloadPathPreference) {
DownloadPathPreference downloadPathPref = (DownloadPathPreference) pref;
Setting.privateSetValueFromString(setting, downloadPathPref.getValue());
} else {
super.syncSettingWithPreference(pref, setting, applySettingToPreference);
Expand All @@ -32,7 +34,7 @@ protected void syncSettingWithPreference(@NonNull Preference pref,

@Override
protected void initialize() {
final var context = getContext();
final var context = getActivity();

// Currently no resources can be compiled for TikTok (fails with aapt error).
// So all TikTok Strings are hard coded in the extension.
Expand Down
9 changes: 2 additions & 7 deletions extensions/tiktok/stub/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ plugins {

android {
namespace = "app.revanced.extension"
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = 24
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
minSdk = 22
}
}
6 changes: 6 additions & 0 deletions extensions/tumblr/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
dependencies {
compileOnly(project(":extensions:tumblr:stub"))
}

android {
defaultConfig {
minSdk = 26
}
}
11 changes: 4 additions & 7 deletions extensions/tumblr/stub/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
android.namespace = "app.revanced.extension"

plugins {
id(libs.plugins.android.library.get().pluginId)
}

android {
namespace = "app.revanced.extension"
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = 24
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
minSdk = 26
}
}
11 changes: 11 additions & 0 deletions extensions/twitch/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,14 @@ dependencies {
compileOnly(libs.annotation)
compileOnly(libs.appcompat)
}

android {
defaultConfig {
minSdk = 21
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}
9 changes: 2 additions & 7 deletions extensions/twitch/stub/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ plugins {

android {
namespace = "app.revanced.extension"
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = 24
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
minSdk = 21
}
}
11 changes: 8 additions & 3 deletions extensions/youtube/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
//noinspection GradleDependency
android.compileSdk = 33

dependencies {
compileOnly(project(":extensions:shared:library"))
compileOnly(project(":extensions:youtube:stub"))
compileOnly(libs.annotation)
}

android {
compileSdk = 33 // TODO: Update Swipe controls code to allow updating this to the latest sdk.

defaultConfig {
minSdk = 26
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import android.graphics.Rect;
import android.graphics.drawable.ShapeDrawable;
import android.os.Build;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
Expand Down Expand Up @@ -366,9 +365,7 @@ public static CharSequence updateRollingNumber(TextView view, CharSequence origi
private static final List<WeakReference<TextView>> shortsTextViewRefs = new ArrayList<>();

private static void clearRemovedShortsTextViews() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { // YouTube requires Android N or greater
shortsTextViewRefs.removeIf(ref -> ref.get() == null);
}
shortsTextViewRefs.removeIf(ref -> ref.get() == null);
}

/**
Expand Down
Loading

0 comments on commit 1d52b74

Please # to comment.