File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
extensions/youtube/src/main/java/app/revanced/extension/youtube/settings
patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 5
5
import android .annotation .SuppressLint ;
6
6
import android .app .Activity ;
7
7
import android .content .Context ;
8
+ import android .content .res .Configuration ;
8
9
import android .preference .PreferenceFragment ;
9
10
import android .view .ViewGroup ;
10
11
import android .widget .TextView ;
Original file line number Diff line number Diff line change @@ -136,15 +136,24 @@ private val settingsResourcePatch = resourcePatch {
136
136
}
137
137
}
138
138
139
- // Modify the manifest and add a data intent filter to the LicenseActivity.
140
- // Some devices freak out if undeclared data is passed to an intent,
141
- // and this change appears to fix the issue.
139
+ // Modify the manifest to enhance LicenseActivity behavior:
140
+ // 1. Add a data intent filter with MIME type "text/plain".
141
+ // Some devices crash if undeclared data is passed to an intent,
142
+ // and this change appears to fix the issue.
143
+ // 2. Add android:configChanges="orientation|screenSize|keyboardHidden".
144
+ // This prevents the activity from being recreated on configuration changes
145
+ // (e.g., screen rotation), preserving its current state and fragment.
142
146
document(" AndroidManifest.xml" ).use { document ->
143
147
val licenseElement = document.childNodes.findElementByAttributeValueOrThrow(
144
148
" android:name" ,
145
149
" com.google.android.libraries.social.licenses.LicenseActivity" ,
146
150
)
147
151
152
+ licenseElement.setAttribute(
153
+ " android:configChanges" ,
154
+ " orientation|screenSize|keyboardHidden"
155
+ )
156
+
148
157
val mimeType = document.createElement(" data" )
149
158
mimeType.setAttribute(" android:mimeType" , " text/plain" )
150
159
You can’t perform that action at this time.
0 commit comments