Various small patches

7408144e1b
> extend Network/Sensors permission handling for legacy apps not targeting Android 6
> or above (API 23) to resolve a UI issue where the user choosing to grant the
> Network/Sensors permissions via the legacy permission review interface doesn't
> appear in the Settings app info page

22d32cb61b
suppresses https://github.com/Divested-Mobile/DivestOS-Build/discussions/112

66f406b979
3f69205d06
nice to have

Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
Tad 2022-06-02 23:03:16 -04:00
parent e6a7cd6a14
commit da63c9e571
10 changed files with 178 additions and 0 deletions

View File

@ -0,0 +1,53 @@
From 66f406b9797194895e607b080cefa5ab27189e77 Mon Sep 17 00:00:00 2001
From: Chirayu Desai <chirayudesai1@gmail.com>
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()) {

View File

@ -0,0 +1,25 @@
From 3f69205d062a4f7dd241e6262acd77f45a68253a Mon Sep 17 00:00:00 2001
From: flawedworld <flawedworld@flawed.world>
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));
}
}

View File

@ -0,0 +1,58 @@
From 7408144e1b476918ada6dfaedcc3c243dbb22d7b Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
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;

View File

@ -0,0 +1,26 @@
From 22d32cb61b289512a0c8b4561d9ea20fe180358d Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
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 @@
<!-- List of comma separated package names for which we the system will not show crash, ANR,
etc. dialogs. -->
- <string translatable="false" name="config_appsNotReportingCrashes"></string>
+ <string translatable="false" name="config_appsNotReportingCrashes">com.android.statementservice</string>
<!-- Inactivity threshold (in milliseconds) used in JobScheduler. JobScheduler will consider
the device to be "idle" after being inactive for this long. -->

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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