Skip to content

Commit

Permalink
Support Android 11 & 12 behavior changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tasomaniac committed Jan 1, 2022
1 parent 8157579 commit cd24414
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
19 changes: 11 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
Expand Down Expand Up @@ -64,12 +67,12 @@
android:configChanges="keyboardHidden|orientation|screenLayout"
android:documentLaunchMode="never"
android:excludeFromRecents="true"
android:exported="true"
android:finishOnCloseSystemDialogs="true"
android:label="@string/open_with"
android:relinquishTaskIdentity="true"
android:theme="@style/Theme.Transparent.NoAnimation"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"
android:exported="true">
android:windowSoftInputMode="stateAlwaysHidden|adjustResize">

<intent-filter android:label="@string/open_with">
<action android:name="android.intent.action.SEND" />
Expand All @@ -91,9 +94,9 @@
<activity-alias
android:name=".TextSelectionActivity"
android:enabled="true"
android:exported="true"
android:label="@string/open_with"
android:targetActivity=".ShareToOpenWith"
android:exported="true">
android:targetActivity=".ShareToOpenWith">

<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
Expand All @@ -108,9 +111,9 @@
<activity-alias
android:name=".BrowserActivity"
android:enabled="false"
android:exported="true"
android:label="@string/open_with"
android:targetActivity=".ShareToOpenWith"
android:exported="true">
android:targetActivity=".ShareToOpenWith">

<intent-filter>
<action android:name="android.intent.action.VIEW" />
Expand All @@ -130,13 +133,13 @@
android:documentLaunchMode="never"
android:enabled="@bool/add_to_home_screen_enabled"
android:excludeFromRecents="true"
android:exported="true"
android:finishOnCloseSystemDialogs="true"
android:icon="@mipmap/ic_launcher_bookmark"
android:label="@string/add_to_homescreen"
android:relinquishTaskIdentity="true"
android:theme="@style/Theme.Transparent.NoAnimation"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"
android:exported="true">
android:windowSoftInputMode="stateAlwaysHidden|adjustResize">

<intent-filter android:label="@string/add_to_homescreen">
<action android:name="android.intent.action.SEND" />
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
ext.playPublishTrack = 'internal'

ext.versions = [
compileSdk : 32,
compileSdk : 31,
minSdk : 22,
versionCode: versionMajor * 10000 + versionMinor * 100 + versionBuild,
versionName: "${versionMajor}.${versionMinor}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ class AddToHomeScreenDialogFragment : DaggerAppCompatDialogFragment() {
IconCompat.createWithResource(requireContext(), R.mipmap.ic_launcher_bookmark)

private fun startHomeScreen(): IntentSender =
PendingIntent.getActivity(requireContext(), 0, Intents.homeScreenIntent(), 0).intentSender
PendingIntent.getActivity(
requireContext(),
0,
Intents.homeScreenIntent(),
PendingIntent.FLAG_IMMUTABLE
).intentSender

fun show(fragmentManager: FragmentManager) = show(fragmentManager, "AddToHomeScreen")

Expand Down

0 comments on commit cd24414

Please sign in to comment.