diff --git a/Patches/Common/android_packages_apps_Contacts/0003-Skip_Accounts.patch b/Patches/Common/android_packages_apps_Contacts/0003-Skip_Accounts.patch new file mode 100644 index 00000000..39b2632a --- /dev/null +++ b/Patches/Common/android_packages_apps_Contacts/0003-Skip_Accounts.patch @@ -0,0 +1,53 @@ +From 66f406b9797194895e607b080cefa5ab27189e77 Mon Sep 17 00:00:00 2001 +From: Chirayu Desai +Date: Wed, 25 May 2022 23:59:57 +0100 +Subject: [PATCH] Don't prompt to add account when creating a contact + +--- + .../ContactEditorAccountsChangedActivity.java | 33 +++---------------- + 1 file changed, 5 insertions(+), 28 deletions(-) + +diff --git a/src/com/android/contacts/activities/ContactEditorAccountsChangedActivity.java b/src/com/android/contacts/activities/ContactEditorAccountsChangedActivity.java +index 8f0509bab..1ae79a8bb 100644 +--- a/src/com/android/contacts/activities/ContactEditorAccountsChangedActivity.java ++++ b/src/com/android/contacts/activities/ContactEditorAccountsChangedActivity.java +@@ -171,34 +171,11 @@ public void onClick(View v) { + } + }); + } else { +- // If the user has 0 writable accounts, we will just show the user a message with 2 +- // possible action buttons. +- view = View.inflate(this, +- R.layout.contact_editor_accounts_changed_activity_with_text, null); +- +- final TextView textView = (TextView) view.findViewById(R.id.text); +- final Button leftButton = (Button) view.findViewById(R.id.left_button); +- final Button rightButton = (Button) view.findViewById(R.id.right_button); +- +- textView.setText(getString(R.string.contact_editor_prompt_zero_accounts)); +- +- // This button allows the user to continue editing the contact as a phone-only +- // local contact. +- leftButton.setText(getString(android.R.string.cancel)); +- leftButton.setOnClickListener(new OnClickListener() { +- @Override +- public void onClick(View v) { +- // Remember that the user wants to create local contacts, so the user is not +- // prompted again with this activity. +- saveAccountAndReturnResult(AccountWithDataSet.getNullAccount()); +- finish(); +- } +- }); +- +- // This button allows the user to add a new account to the device and return to +- // this app afterwards. +- rightButton.setText(getString(R.string.add_account)); +- rightButton.setOnClickListener(mAddAccountClickListener); ++ view = null; // Only to make the compiler happy ++ // If the user has 0 writable accounts, don't bother, let them continue editing ++ // the contact as a phone-only local contact. ++ saveAccountAndReturnResult(AccountWithDataSet.getNullAccount()); ++ finish(); + } + + if (mDialog != null && mDialog.isShowing()) { diff --git a/Patches/Common/android_packages_apps_Contacts/0004-No_GMaps.patch b/Patches/Common/android_packages_apps_Contacts/0004-No_GMaps.patch new file mode 100644 index 00000000..39179328 --- /dev/null +++ b/Patches/Common/android_packages_apps_Contacts/0004-No_GMaps.patch @@ -0,0 +1,25 @@ +From 3f69205d062a4f7dd241e6262acd77f45a68253a Mon Sep 17 00:00:00 2001 +From: flawedworld +Date: Wed, 25 May 2022 23:47:12 +0100 +Subject: [PATCH] Use common intent for directions instead of Google Maps URL + +--- + src/com/android/contacts/util/StructuredPostalUtils.java | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/src/com/android/contacts/util/StructuredPostalUtils.java b/src/com/android/contacts/util/StructuredPostalUtils.java +index 6e46176ca8..f5f454948e 100644 +--- a/src/com/android/contacts/util/StructuredPostalUtils.java ++++ b/src/com/android/contacts/util/StructuredPostalUtils.java +@@ -32,10 +32,6 @@ public static Uri getPostalAddressUri(String postalAddress) { + } + + public static Intent getViewPostalAddressDirectionsIntent(String postalAddress) { +- return new Intent(Intent.ACTION_VIEW, getPostalAddressDirectionsUri(postalAddress)); +- } +- +- public static Uri getPostalAddressDirectionsUri(String postalAddress) { +- return Uri.parse("https://maps.google.com/maps?daddr=" + Uri.encode(postalAddress)); ++ return new Intent(Intent.ACTION_VIEW, getPostalAddressUri(postalAddress)); + } + } diff --git a/Patches/LineageOS-19.1/android_frameworks_base/0013-Special_Permissions-2.patch b/Patches/LineageOS-19.1/android_frameworks_base/0013-Special_Permissions-2.patch new file mode 100644 index 00000000..b44e8ec8 --- /dev/null +++ b/Patches/LineageOS-19.1/android_frameworks_base/0013-Special_Permissions-2.patch @@ -0,0 +1,58 @@ +From 7408144e1b476918ada6dfaedcc3c243dbb22d7b Mon Sep 17 00:00:00 2001 +From: Daniel Micay +Date: Tue, 31 May 2022 04:18:35 -0400 +Subject: [PATCH] extend special runtime permission implementation + +--- + .../server/pm/permission/PermissionManagerService.java | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java +index c0567a446e48..96e2760d9e87 100644 +--- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java ++++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java +@@ -1881,7 +1881,7 @@ public void onInstallPermissionUpdatedNotifyListener(int uid) { + // permission as requiring a review as this is the initial state. + final int uid = mPackageManagerInt.getPackageUid(packageName, 0, userId); + final int targetSdk = mPackageManagerInt.getUidTargetSdkVersion(uid); +- final int flags = (targetSdk < Build.VERSION_CODES.M && isRuntimePermission) ++ final int flags = (targetSdk < Build.VERSION_CODES.M && isRuntimePermission && !isSpecialRuntimePermission(permName)) + ? FLAG_PERMISSION_REVIEW_REQUIRED | FLAG_PERMISSION_REVOKED_COMPAT + : 0; + +@@ -2727,7 +2727,7 @@ && shouldGrantPermissionByProtectionFlags(pkg, ps, permission, + FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT, + FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT); + } +- if (targetSdkVersion < Build.VERSION_CODES.M) { ++ if (targetSdkVersion < Build.VERSION_CODES.M && !isSpecialRuntimePermission(permissionName)) { + uidState.updatePermissionFlags(permission, + PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED + | PackageManager.FLAG_PERMISSION_REVOKED_COMPAT, +@@ -2853,7 +2853,7 @@ && shouldGrantPermissionByProtectionFlags(pkg, ps, permission, + // continue; + // } + +- if (bp.isRuntimeOnly() && !appSupportsRuntimePermissions) { ++ if (bp.isRuntimeOnly() && !appSupportsRuntimePermissions && !isSpecialRuntimePermission(bp.getName())) { + if (DEBUG_PERMISSIONS) { + Log.i(TAG, "Denying runtime-only permission " + bp.getName() + + " for package " + friendlyName); +@@ -2932,7 +2932,7 @@ && shouldGrantPermissionByProtectionFlags(pkg, ps, permission, + boolean restrictionApplied = (origState.getPermissionFlags( + bp.getName()) & FLAG_PERMISSION_APPLY_RESTRICTION) != 0; + +- if (appSupportsRuntimePermissions) { ++ if (appSupportsRuntimePermissions || isSpecialRuntimePermission(bp.getName())) { + // If hard restricted we don't allow holding it + if (permissionPolicyInitialized && hardRestricted) { + if (!restrictionExempt) { +@@ -3020,7 +3020,7 @@ && shouldGrantPermissionByProtectionFlags(pkg, ps, permission, + if (restrictionApplied) { + flags &= ~FLAG_PERMISSION_APPLY_RESTRICTION; + // Dropping restriction on a legacy app implies a review +- if (!appSupportsRuntimePermissions) { ++ if (!appSupportsRuntimePermissions && !isSpecialRuntimePermission(bp.getName())) { + flags |= FLAG_PERMISSION_REVIEW_REQUIRED; + } + wasChanged = true; diff --git a/Patches/LineageOS-19.1/android_frameworks_base/0022-Ignore_StatementService_ANR.patch b/Patches/LineageOS-19.1/android_frameworks_base/0022-Ignore_StatementService_ANR.patch new file mode 100644 index 00000000..cccf66bc --- /dev/null +++ b/Patches/LineageOS-19.1/android_frameworks_base/0022-Ignore_StatementService_ANR.patch @@ -0,0 +1,26 @@ +From 22d32cb61b289512a0c8b4561d9ea20fe180358d Mon Sep 17 00:00:00 2001 +From: Daniel Micay +Date: Wed, 20 Oct 2021 19:40:42 -0400 +Subject: [PATCH] [temporary] don't report statementservice crashes + +There's a known issue in AOSP 12 caused by it creating overly large +intents for the work manager. It's not caused by anything done by end +users and they can't work around it so avoid reporting it to them since +they get a message each time it tries again. +--- + core/res/res/values/config.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml +index fb7abb632c15..5965635c7371 100644 +--- a/core/res/res/values/config.xml ++++ b/core/res/res/values/config.xml +@@ -3603,7 +3603,7 @@ + + +- ++ com.android.statementservice + + diff --git a/Scripts/LineageOS-14.1/Patch.sh b/Scripts/LineageOS-14.1/Patch.sh index 86306dd7..904ea5bf 100644 --- a/Scripts/LineageOS-14.1/Patch.sh +++ b/Scripts/LineageOS-14.1/Patch.sh @@ -198,6 +198,10 @@ if enterAndClear "hardware/qcom/media-caf/msm8994"; then applyPatch "$DOS_PATCHES/android_hardware_qcom_media/227622.patch"; #n_asb_09-2018-qcom (CAF) fi; +if enterAndClear "packages/apps/Contacts"; then +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0004-No_GMaps.patch"; #Use common intent for directions instead of Google Maps URL (GrapheneOS) +fi; + if enterAndClear "packages/apps/CMParts"; then rm -rf src/org/cyanogenmod/cmparts/cmstats/ res/xml/anonymous_stats.xml res/xml/preview_data.xml; #Nuke part of CMStats applyPatch "$DOS_PATCHES/android_packages_apps_CMParts/0001-Remove_Analytics.patch"; #Remove the rest of CMStats (DivestOS) diff --git a/Scripts/LineageOS-15.1/Patch.sh b/Scripts/LineageOS-15.1/Patch.sh index 4b3f0cb1..5e791647 100644 --- a/Scripts/LineageOS-15.1/Patch.sh +++ b/Scripts/LineageOS-15.1/Patch.sh @@ -192,6 +192,8 @@ fi; if enterAndClear "packages/apps/Contacts"; then applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0001-No_Google_Links.patch"; #Remove Privacy Policy and Terms of Service links (GrapheneOS) +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0003-Skip_Accounts.patch"; #Don't prompt to add account when creating a contact (CalyxOS) +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0004-No_GMaps.patch"; #Use common intent for directions instead of Google Maps URL (GrapheneOS) fi; if enterAndClear "packages/apps/LineageParts"; then diff --git a/Scripts/LineageOS-16.0/Patch.sh b/Scripts/LineageOS-16.0/Patch.sh index d9697e19..004259d9 100644 --- a/Scripts/LineageOS-16.0/Patch.sh +++ b/Scripts/LineageOS-16.0/Patch.sh @@ -247,6 +247,8 @@ fi; if enterAndClear "packages/apps/Contacts"; then applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0001-No_Google_Links.patch"; #Remove Privacy Policy and Terms of Service links (GrapheneOS) +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0003-Skip_Accounts.patch"; #Don't prompt to add account when creating a contact (CalyxOS) +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0004-No_GMaps.patch"; #Use common intent for directions instead of Google Maps URL (GrapheneOS) fi; if enterAndClear "packages/apps/Dialer"; then diff --git a/Scripts/LineageOS-17.1/Patch.sh b/Scripts/LineageOS-17.1/Patch.sh index a2adfdce..77a8ad4e 100644 --- a/Scripts/LineageOS-17.1/Patch.sh +++ b/Scripts/LineageOS-17.1/Patch.sh @@ -261,6 +261,8 @@ fi; if enterAndClear "packages/apps/Contacts"; then applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0001-No_Google_Links.patch"; #Remove Privacy Policy and Terms of Service links (GrapheneOS) applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0002-No_Google_Backup.patch"; #Backups are not sent to Google (GrapheneOS) +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0003-Skip_Accounts.patch"; #Don't prompt to add account when creating a contact (CalyxOS) +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0004-No_GMaps.patch"; #Use common intent for directions instead of Google Maps URL (GrapheneOS) fi; if enterAndClear "packages/apps/Dialer"; then diff --git a/Scripts/LineageOS-18.1/Patch.sh b/Scripts/LineageOS-18.1/Patch.sh index 7c216996..fff195fa 100644 --- a/Scripts/LineageOS-18.1/Patch.sh +++ b/Scripts/LineageOS-18.1/Patch.sh @@ -270,6 +270,8 @@ fi; if enterAndClear "packages/apps/Contacts"; then applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0001-No_Google_Links.patch"; #Remove Privacy Policy and Terms of Service links (GrapheneOS) applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0002-No_Google_Backup.patch"; #Backups are not sent to Google (GrapheneOS) +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0003-Skip_Accounts.patch"; #Don't prompt to add account when creating a contact (CalyxOS) +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0004-No_GMaps.patch"; #Use common intent for directions instead of Google Maps URL (GrapheneOS) fi; if enterAndClear "packages/apps/Dialer"; then diff --git a/Scripts/LineageOS-19.1/Patch.sh b/Scripts/LineageOS-19.1/Patch.sh index 34aaaa3c..5d1c38b0 100644 --- a/Scripts/LineageOS-19.1/Patch.sh +++ b/Scripts/LineageOS-19.1/Patch.sh @@ -132,6 +132,7 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/0003-SUPL_No_IMSI.patch"; #Don' applyPatch "$DOS_PATCHES/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0005-User_Logout.patch"; #Allow user logout (GrapheneOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0013-Special_Permissions.patch"; #Support new special runtime permissions (GrapheneOS) +applyPatch "$DOS_PATCHES/android_frameworks_base/0013-Special_Permissions-2.patch"; #Extend special runtime permission implementation (GrapheneOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0013-Network_Permission-1.patch"; #Make INTERNET into a special runtime permission (GrapheneOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0013-Network_Permission-2.patch"; #Add a NETWORK permission group for INTERNET (GrapheneOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0013-Network_Permission-3.patch"; #net: Notify ConnectivityService of runtime permission changes (GrapheneOS) @@ -159,6 +160,7 @@ sed -i 's/sys.spawn.exec/persist.security.exec_spawn_new/' core/java/com/android fi; applyPatch "$DOS_PATCHES/android_frameworks_base/0020-Location_Indicators.patch"; #SystemUI: Use new privacy indicators for location (GrapheneOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0021-Boot_Animation.patch"; #Use basic boot animation (DivestOS) +applyPatch "$DOS_PATCHES/android_frameworks_base/0022-Ignore_StatementService_ANR.patch"; #Don't report statementservice crashes (GrapheneOS) applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0007-ABI_Warning.patch"; #Warn when running activity from 32 bit app on ARM64 devices. (AOSP) applyPatch "$DOS_PATCHES/android_frameworks_base/326692.patch"; #Skip screen on animation when wake and unlock via biometrics (jesec) hardenLocationConf services/core/java/com/android/server/location/gnss/gps_debug.conf; #Harden the default GPS config @@ -241,6 +243,8 @@ fi; if enterAndClear "packages/apps/Contacts"; then applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0001-No_Google_Links.patch"; #Remove Privacy Policy and Terms of Service links (GrapheneOS) applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0002-No_Google_Backup.patch"; #Backups are not sent to Google (GrapheneOS) +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0003-Skip_Accounts.patch"; #Don't prompt to add account when creating a contact (CalyxOS) +applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0004-No_GMaps.patch"; #Use common intent for directions instead of Google Maps URL (GrapheneOS) fi; if enterAndClear "packages/apps/Dialer"; then