From 58b53de17adc2095535ce8735bb7a33c9b30d8a0 Mon Sep 17 00:00:00 2001 From: Tad Date: Mon, 24 Jan 2022 05:28:15 -0500 Subject: [PATCH] Multi user tweaks from GrapheneOS Signed-off-by: Tad --- .../0005-User_Logout.patch | 36 +++++++++++++++++++ .../base/core/res/res/values/config.xml | 2 +- Scripts/LineageOS-16.0/Patch.sh | 1 + Scripts/LineageOS-17.1/Patch.sh | 1 + Scripts/LineageOS-18.1/Patch.sh | 1 + 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 Patches/Common/android_frameworks_base/0005-User_Logout.patch diff --git a/Patches/Common/android_frameworks_base/0005-User_Logout.patch b/Patches/Common/android_frameworks_base/0005-User_Logout.patch new file mode 100644 index 00000000..81054468 --- /dev/null +++ b/Patches/Common/android_frameworks_base/0005-User_Logout.patch @@ -0,0 +1,36 @@ +From f1d6d41b4fa836b7b0953eb3b24f3af6e1d5cbcf Mon Sep 17 00:00:00 2001 +From: Daniel Micay +Date: Sun, 4 Oct 2020 19:02:09 -0400 +Subject: [PATCH] enable secondary user logout support by default + +--- + .../server/devicepolicy/DevicePolicyManagerService.java | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +index ae354a953eec..47769ef9e7a8 100644 +--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java ++++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +@@ -1166,7 +1166,7 @@ public void onUserRestrictionsChanged(int userId, Bundle newRestrictions, + boolean requireAutoTime = false; // Can only be set by a device owner. + boolean forceEphemeralUsers = false; // Can only be set by a device owner. + boolean isNetworkLoggingEnabled = false; // Can only be set by a device owner. +- boolean isLogoutEnabled = false; // Can only be set by a device owner. ++ boolean isLogoutEnabled = true; // Can only be set by a device owner. + + // one notification after enabling + one more after reboots + static final int DEF_MAXIMUM_NETWORK_LOGGING_NOTIFICATIONS_SHOWN = 2; +@@ -15116,11 +15116,11 @@ public void setLogoutEnabled(ComponentName admin, boolean enabled) { + @Override + public boolean isLogoutEnabled() { + if (!mHasFeature) { +- return false; ++ return true; + } + synchronized (getLockObject()) { + ActiveAdmin deviceOwner = getDeviceOwnerAdminLocked(); +- return (deviceOwner != null) && deviceOwner.isLogoutEnabled; ++ return (deviceOwner == null) || deviceOwner.isLogoutEnabled; + } + } + diff --git a/Patches/Common/android_vendor_divested/overlay/common/frameworks/base/core/res/res/values/config.xml b/Patches/Common/android_vendor_divested/overlay/common/frameworks/base/core/res/res/values/config.xml index ed8ff669..52665c4a 100644 --- a/Patches/Common/android_vendor_divested/overlay/common/frameworks/base/core/res/res/values/config.xml +++ b/Patches/Common/android_vendor_divested/overlay/common/frameworks/base/core/res/res/values/config.xml @@ -71,7 +71,7 @@ true - 6 + 16 1.android.pool.ntp.org diff --git a/Scripts/LineageOS-16.0/Patch.sh b/Scripts/LineageOS-16.0/Patch.sh index 5e5ab6f1..8cca5354 100644 --- a/Scripts/LineageOS-16.0/Patch.sh +++ b/Scripts/LineageOS-16.0/Patch.sh @@ -113,6 +113,7 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/0009-SystemUI_No_Permission_Rev if [ "$DOS_GRAPHENE_EXEC" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0010-Exec_Based_Spawning.patch"; fi; #Add exec-based spawning support (GrapheneOS) applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0003-SUPL_No_IMSI.patch"; #Don't send IMSI to SUPL (MSe1969) applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS) +applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0005-User_Logout.patch"; #Allow user logout (GrapheneOS) if [ "$DOS_SENSORS_PERM" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0011-Sensors.patch"; fi; #Permission for sensors access (MSe1969) #applyPatch "$DOS_PATCHES/android_frameworks_base/0012-Private_DNS.patch"; #More 'Private DNS' options (CalyxOS) if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0002-Signature_Spoofing.patch"; fi; #Allow packages to spoof their signature (microG) diff --git a/Scripts/LineageOS-17.1/Patch.sh b/Scripts/LineageOS-17.1/Patch.sh index 9c40c51a..86bb1554 100644 --- a/Scripts/LineageOS-17.1/Patch.sh +++ b/Scripts/LineageOS-17.1/Patch.sh @@ -108,6 +108,7 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/0009-SystemUI_No_Permission_Rev if [ "$DOS_GRAPHENE_EXEC" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0010-Exec_Based_Spawning.patch"; fi; #add exec-based spawning support (GrapheneOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0003-SUPL_No_IMSI.patch"; #Don't send IMSI to SUPL (MSe1969) applyPatch "$DOS_PATCHES/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS) +applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0005-User_Logout.patch"; #Allow user logout (GrapheneOS) if [ "$DOS_SENSORS_PERM_NEW" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0011-Sensors.patch"; fi; #Permission for sensors access (MSe1969) applyPatch "$DOS_PATCHES/android_frameworks_base/0012-Restore_SensorsOff.patch"; #Restore the Sensors Off tile applyPatch "$DOS_PATCHES/android_frameworks_base/0013-Private_DNS.patch"; #More 'Private DNS' options (CalyxOS) diff --git a/Scripts/LineageOS-18.1/Patch.sh b/Scripts/LineageOS-18.1/Patch.sh index da5a4ebe..2a333220 100644 --- a/Scripts/LineageOS-18.1/Patch.sh +++ b/Scripts/LineageOS-18.1/Patch.sh @@ -90,6 +90,7 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/0008-Browser_No_Location.patch" applyPatch "$DOS_PATCHES/android_frameworks_base/0009-SystemUI_No_Permission_Review.patch"; #Allow SystemUI to directly manage Bluetooth/WiFi (GrapheneOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0003-SUPL_No_IMSI.patch"; #Don't send IMSI to SUPL (MSe1969) applyPatch "$DOS_PATCHES/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS) +applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0005-User_Logout.patch"; #Allow user logout (GrapheneOS) if [ "$DOS_SENSORS_PERM_NEW" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0010-Sensors.patch"; fi #Permission for sensors access (MSe1969) applyPatch "$DOS_PATCHES/android_frameworks_base/0011-Restore_SensorsOff.patch"; #Restore the Sensors Off tile applyPatch "$DOS_PATCHES/android_frameworks_base/0012-Private_DNS.patch"; #More 'Private DNS' options (CalyxOS)