Changes for March 2023, syncing up to 20230315

This commit is contained in:
Andy CrossGate Yan
2023-03-25 00:22:50 +00:00
parent 4ce6305950
commit 4cd163c62b
138 changed files with 103712 additions and 116618 deletions

View File

@@ -1,7 +1,7 @@
From f0314afe5afcd4bf19188c8688a35e322a7bcf44 Mon Sep 17 00:00:00 2001
From 107b0eaf96413e3faac0bcbe7e761d98d3595d76 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Thu, 13 Jan 2022 14:22:24 +0000
Subject: [PATCH 01/15] Add SPenPointerOverlay
Subject: [PATCH 01/24] Add SPenPointerOverlay
Toggle this overlay with property "persist.ui.spen.pointer"
@@ -122,5 +122,5 @@ index 000000000000..f35255c5f961
+ android:hotSpotX="5dp"
+ android:hotSpotY="5dp" />
--
2.25.1
2.34.1

View File

@@ -1,7 +1,7 @@
From bdb1e544a11d7c82366c636d49da988c8ce6a218 Mon Sep 17 00:00:00 2001
From c37fef3e91e035f05f3a9a6ab2f744f6e2051b38 Mon Sep 17 00:00:00 2001
From: AndyCGYan <GeForce8800Ultra@gmail.com>
Date: Fri, 22 Mar 2019 00:41:20 +0800
Subject: [PATCH 02/15] Disable FP lockouts optionally
Subject: [PATCH 02/24] Disable FP lockouts optionally
Both timed and permanent lockouts - GET THE FUCK OUT
Now targeting LockoutFramework, introduced in Android 12
@@ -72,5 +72,5 @@ index a0befea8e085..48c4ded9f5ca 100644
return LOCKOUT_NONE;
}
--
2.25.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 1b1a877dc08bf8177192b4c44644eecac9469721 Mon Sep 17 00:00:00 2001
From c51f1b93e9e69cd50959a7d5b8936adabbb98b8c Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Thu, 5 Apr 2018 10:01:19 +0800
Subject: [PATCH 03/15] Disable vendor mismatch warning
Subject: [PATCH 03/24] Disable vendor mismatch warning
Change-Id: Ieb8fe91e2f02462f074312ed0f4885d183e9780b
---
@@ -9,10 +9,10 @@ Change-Id: Ieb8fe91e2f02462f074312ed0f4885d183e9780b
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 01490f029e97..6199267cac0b 100644
index 3e1b30b2ff25..8681bd726f3b 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -5856,20 +5856,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@@ -5859,20 +5859,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
}
if (!Build.isBuildConsistent()) {
@@ -36,5 +36,5 @@ index 01490f029e97..6199267cac0b 100644
}
}
--
2.25.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 25a596aa94e3e050e5c7726bf3cfa35f8f0492ac Mon Sep 17 00:00:00 2001
From 53944713b59f662f2a19ea3ccd3cfdcec9f3593a Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Tue, 17 Jan 2023 17:19:19 +0000
Subject: [PATCH 04/15] Keyguard: Fix colors of slices not updating on doze
Subject: [PATCH 04/24] Keyguard: Fix colors of slices not updating on doze
Slices were invisible (black) in doze when using light wallpapers
Introduced in https://github.com/LineageOS/android_frameworks_base/commit/a19e59d717ec6d573c11c7e8277bba3c4de189c2
@@ -13,10 +13,10 @@ Change-Id: I06abd8bf2e28655cc9e6d81366fd82a13454ec5a
2 files changed, 8 insertions(+)
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java
index c715a4eaef2b..a16ab6b8283a 100644
index aec30632c41e..7ef624a6f184 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java
@@ -93,6 +93,13 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
@@ -99,6 +99,13 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
mKeyguardSliceViewController.refresh();
}
@@ -31,10 +31,10 @@ index c715a4eaef2b..a16ab6b8283a 100644
* Set which clock should be displayed on the keyguard. The other one will be automatically
* hidden.
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index f371aac2090a..e6c4fcfefde0 100644
index 731ce92099e8..3e748a0f2722 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -4758,6 +4758,7 @@ public final class NotificationPanelViewController extends PanelViewController {
@@ -5718,6 +5718,7 @@ public final class NotificationPanelViewController implements Dumpable {
public void onDozeAmountChanged(float linearAmount, float amount) {
mInterpolatedDarkAmount = amount;
mLinearDarkAmount = linearAmount;
@@ -43,5 +43,5 @@ index f371aac2090a..e6c4fcfefde0 100644
}
}
--
2.25.1
2.34.1

View File

@@ -1,7 +1,7 @@
From e5dd5a8c1d88fdc155c7ef05aafb148773e40ae7 Mon Sep 17 00:00:00 2001
From d7612a2bd79c4fbc738bfb4cee56a3a88839d415 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sat, 16 Oct 2021 02:23:48 +0000
Subject: [PATCH 05/15] UI: Adjust default navbar layouts
Subject: [PATCH 05/24] UI: Adjust default navbar layouts
- Slightly tighten nodpi layout
- Remove sw372dp layout - looks terrible, probably meant for legacy phablets, but most modern phones qualify
@@ -45,7 +45,7 @@ index 07b797a32428..000000000000
- <string name="config_navBarLayout" translatable="false">left[.25W],back[.5WC];home;recent[.5WC],right[.25W]</string>
-</resources>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index d7d88cea2dbc..8a2b88d3cf9a 100644
index 48c35ae8789d..70269b18a573 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -301,7 +301,7 @@
@@ -58,5 +58,5 @@ index d7d88cea2dbc..8a2b88d3cf9a 100644
<string name="config_navBarLayoutHandle" translatable="false">back[70AC];home_handle;ime_switcher[70AC]</string>
--
2.25.1
2.34.1

View File

@@ -1,7 +1,7 @@
From d95f2986ab877e2f33ce45fea6e4997ff17a35e1 Mon Sep 17 00:00:00 2001
From 132cfec6f7d245e867a2be7939931076d721405d Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sun, 10 Jan 2021 11:44:29 +0000
Subject: [PATCH 06/15] UI: Disable wallpaper zoom
Subject: [PATCH 06/24] UI: Disable wallpaper zoom
It does little more than inducing motion sickness
@@ -11,10 +11,10 @@ Change-Id: I78cc5484930b27f172cd8d8a5bd9042dce3478d0
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 659d0f37bf05..272df37188bf 100644
index 987426f56463..c2e2c91b2829 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -5104,7 +5104,7 @@
@@ -5146,7 +5146,7 @@
<item name="config_wallpaperMinScale" format="float" type="dimen">1</item>
<!-- The max scale for the wallpaper when it's zoomed in -->
@@ -24,5 +24,5 @@ index 659d0f37bf05..272df37188bf 100644
<!-- If true, the wallpaper will scale regardless of the value of shouldZoomOutWallpaper() -->
<bool name="config_alwaysScaleWallpaper">false</bool>
--
2.25.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 3495203480c06150d56ffd11513f0dc0cfffa9dc Mon Sep 17 00:00:00 2001
From 3cea896b28374cb5975b470134bf572e004c5329 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sun, 25 Sep 2022 02:20:52 +0000
Subject: [PATCH 07/15] UI: Follow Monet and light/dark theme in user 1 icon
Subject: [PATCH 07/24] UI: Follow Monet and light/dark theme in user 1 icon
Change-Id: I755077c6003c39ddc9428da1defe6a6ddd0e5ff8
---
@@ -35,5 +35,5 @@ index d5875f547e91..c7711ed3e493 100644
<color name="user_icon_3">#ff4c8df6</color><!-- blue -->
<color name="user_icon_4">#fff439a0</color><!-- pink -->
--
2.25.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 953d205e2408dcd0f7fe25e7c2801512fad196fd Mon Sep 17 00:00:00 2001
From 9999d9887ec0fc9f3227bac752126d98b2adc07e Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Wed, 3 Jun 2020 01:31:34 +0000
Subject: [PATCH 08/15] UI: Increase default status bar height
Subject: [PATCH 08/24] UI: Increase default status bar height
Change-Id: Ibbcf63159e19bb2bb2b1094ea07ab85917630b07
---
@@ -31,5 +31,5 @@ index 2542268a153a..099a6badc034 100644
Do not read this dimen directly. Use {@link SystemBarUtils#getStatusBarHeight} instead.
-->
--
2.25.1
2.34.1

View File

@@ -1,32 +1,25 @@
From 29b987ef4e37748102b41aeabf6a6fb810e6c37e Mon Sep 17 00:00:00 2001
From b85e925a3accec749a28d5edd6bff3ce20f68924 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sun, 25 Sep 2022 02:20:20 +0000
Subject: [PATCH 09/15] UI: Remove QS footer background
Subject: [PATCH 09/24] UI: Remove QS footer background
Change-Id: I68e82e0c5e3eddb2d3f767fe792b1436eae506ef
---
packages/SystemUI/res-keyguard/layout/footer_actions.xml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
packages/SystemUI/res-keyguard/layout/footer_actions.xml | 1 -
1 file changed, 1 deletion(-)
diff --git a/packages/SystemUI/res-keyguard/layout/footer_actions.xml b/packages/SystemUI/res-keyguard/layout/footer_actions.xml
index a101c64a48e0..028ab29b8643 100644
index 544d0299060d..d45744961f59 100644
--- a/packages/SystemUI/res-keyguard/layout/footer_actions.xml
+++ b/packages/SystemUI/res-keyguard/layout/footer_actions.xml
@@ -25,7 +25,6 @@
@@ -23,7 +23,6 @@
android:elevation="@dimen/qs_panel_elevation"
android:paddingTop="@dimen/qs_footer_actions_top_padding"
android:paddingBottom="@dimen/qs_footer_actions_bottom_padding"
- android:background="@drawable/qs_footer_actions_background"
android:gravity="center_vertical|end"
android:layout_gravity="bottom"
>
@@ -98,4 +97,4 @@
android:tint="?androidprv:attr/textColorPrimaryInverse" />
</LinearLayout>
-</com.android.systemui.qs.FooterActionsView>
\ No newline at end of file
+</com.android.systemui.qs.FooterActionsView>
/>
--
2.25.1
2.34.1

View File

@@ -1,16 +1,16 @@
From f37c5b2151383a120c728d02439692f55c90334e Mon Sep 17 00:00:00 2001
From 289c535bf6f0decf2c1ce58650ec7dd6721880a8 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sat, 19 Mar 2022 09:22:24 +0000
Subject: [PATCH 10/15] UI: Restore split-screen divider to pre-Sv2 looks
Subject: [PATCH 10/24] UI: Restore split-screen divider to pre-Sv2 looks
- Kill rounded corners - where two rectangles collide should be perfectly straight
- Make it black again - taskbar should mind its own business
Change-Id: I240b627793b615c82bd07ebd77638cde180ef80f
---
.../Shell/res/color/split_divider_background.xml | 4 ++--
.../wm/shell/common/split/SplitLayout.java | 15 +--------------
2 files changed, 3 insertions(+), 16 deletions(-)
.../res/color/split_divider_background.xml | 4 ++--
.../wm/shell/common/split/SplitLayout.java | 19 ++-----------------
2 files changed, 4 insertions(+), 19 deletions(-)
diff --git a/libs/WindowManager/Shell/res/color/split_divider_background.xml b/libs/WindowManager/Shell/res/color/split_divider_background.xml
index 049980803ee3..cd54ac26a7fd 100644
@@ -26,16 +26,17 @@ index 049980803ee3..cd54ac26a7fd 100644
+ <item android:color="@android:color/black" />
+</selector>
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java
index 419e62daf586..229844e42a49 100644
index 45b234a6398a..f0b1ff3999bc 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java
@@ -152,20 +152,7 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
@@ -153,23 +153,8 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
}
private int getDividerInsets(Resources resources, Display display) {
private void updateDividerConfig(Context context) {
- final Resources resources = context.getResources();
- final Display display = context.getDisplay();
- final int dividerInset = resources.getDimensionPixelSize(
- com.android.internal.R.dimen.docked_stack_divider_insets);
-
- int radius = 0;
- RoundedCorner corner = display.getRoundedCorner(RoundedCorner.POSITION_TOP_LEFT);
- radius = corner != null ? Math.max(radius, corner.getRadius()) : radius;
@@ -46,11 +47,14 @@ index 419e62daf586..229844e42a49 100644
- corner = display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_LEFT);
- radius = corner != null ? Math.max(radius, corner.getRadius()) : radius;
-
- return Math.max(dividerInset, radius);
+ return 0;
- mDividerInsets = Math.max(dividerInset, radius);
- mDividerSize = resources.getDimensionPixelSize(R.dimen.split_divider_bar_width);
- mDividerWindowWidth = mDividerSize + 2 * mDividerInsets;
+ mDividerWindowWidth = context.getResources().getDimensionPixelSize(
+ R.dimen.split_divider_bar_width);
}
/** Gets bounds of the primary split with screen based coordinate. */
--
2.25.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 9d7f2acaa960dd74aa0bc030c3e6d9cd5a234a74 Mon Sep 17 00:00:00 2001
From 0697f6baa9ffb4f69b90e9c4f8469e7bd130d6bc Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Tue, 6 Oct 2020 01:41:16 +0000
Subject: [PATCH 11/15] UI: Revive navbar layout tuning via sysui_nav_bar
Subject: [PATCH 11/24] UI: Revive navbar layout tuning via sysui_nav_bar
tunable
Google keeps fixing what ain't broken.
@@ -60,5 +60,5 @@ index 51feed875337..5f0f9a220c31 100644
final String newValue = getDefaultLayout();
if (!Objects.equals(mCurrentLayout, newValue)) {
--
2.25.1
2.34.1

View File

@@ -1,7 +1,7 @@
From f5e22a9b6f467439f4c84ee6afbcbcdbbb45b3da Mon Sep 17 00:00:00 2001
From 9f0fb3f042124da5731232dffa1bda623c395a22 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sun, 26 Apr 2020 08:56:13 +0000
Subject: [PATCH 12/15] UI: Use SNAP_FIXED_RATIO for multi-window globally
Subject: [PATCH 12/24] UI: Use SNAP_FIXED_RATIO for multi-window globally
Enables multiple snap targets under landscape for phone UI
@@ -78,10 +78,10 @@ index 34b6a54be493..3921c9edfeac 100644
Only applies if the device display is not square. -->
<bool name="config_navBarCanMove">false</bool>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 272df37188bf..58cd819b9404 100644
index c2e2c91b2829..8f81427cbe67 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -3790,7 +3790,7 @@
@@ -3829,7 +3829,7 @@
1 - 3 snap targets: fixed ratio, 1:1, (1 - fixed ratio)
2 - 1 snap target: 1:1
-->
@@ -91,5 +91,5 @@ index 272df37188bf..58cd819b9404 100644
<!-- The maximum aspect ratio (longerSide/shorterSide) that is treated as close-to-square. The
orientation requests from apps would be ignored if the display is close-to-square. -->
--
2.25.1
2.34.1

View File

@@ -1,7 +1,7 @@
From c29a4e448651024369665a67a9938592f727394a Mon Sep 17 00:00:00 2001
From 30a3637fe457193166cc324af29c306d7748adfa Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 3 Nov 2020 22:43:12 -0800
Subject: [PATCH 13/15] core: Remove old app target SDK dialog
Subject: [PATCH 13/24] core: Remove old app target SDK dialog
If an app is old, users should already know that, and there's usually no
point in warning them about it because they would already be using a
@@ -27,5 +27,5 @@ index 994f07959f3b..6749ae78c09c 100644
/**
--
2.25.1
2.34.1

View File

@@ -1,7 +1,7 @@
From feca2661444f0d615f8c050fed4d79acffb42890 Mon Sep 17 00:00:00 2001
From 964346e2b9e8ceaa7c6b2b9a4c74a401af0fc9e0 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 5 Oct 2021 21:01:50 -0700
Subject: [PATCH 14/15] Paint: Enable subpixel text positioning by default
Subject: [PATCH 14/24] Paint: Enable subpixel text positioning by default
On desktop Linux, subpixel text positioning is necessary to avoid
kerning issues, and Android is no different. Even though most phone
@@ -24,10 +24,10 @@ Change-Id: I8d71e5848a745c5a2d457a28c68458920928ee09
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index 451b99ea7550..e60d506a171b 100644
index f438a03b1434..6621d1f23166 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -253,7 +253,7 @@ public class Paint {
@@ -260,7 +260,7 @@ public class Paint {
// These flags are always set on a new/reset paint, even if flags 0 is passed.
static final int HIDDEN_DEFAULT_PAINT_FLAGS = DEV_KERN_TEXT_FLAG | EMBEDDED_BITMAP_TEXT_FLAG
@@ -37,5 +37,5 @@ index 451b99ea7550..e60d506a171b 100644
/**
* Font hinter option that disables font hinting.
--
2.25.1
2.34.1

View File

@@ -0,0 +1,320 @@
From 4fa320b2eacab5be5b9fb3f2ebe24f39e8b54cc1 Mon Sep 17 00:00:00 2001
From: Park Ju Hyung <qkrwngud825@gmail.com>
Date: Sun, 15 Jan 2017 03:33:04 +0900
Subject: [PATCH 15/24] SystemUI: add burnIn protection
Devices with AMOLED display suffer from
status-bar's notification items and nagivation bar's software keys
causing permanent burn-ins when used long-term.
Moving all items in the area
both horizontally and vertically workarounds this problem.
jrizzoli: integrate with runtime cmsdk preference
Linux4: Removed toggle from settings - the burnIn protection is always
enabled if the corresponding AOSP overlay is set to true
Updated for T
Change-Id: I35b04d1edff86a556adb3ad349569e5d82653f16
Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
Signed-off-by: Thecrazyskull <anaskarbila@gmail.com>
Signed-off-by: Joey Rizzoli <joey@lineageos.org>
---
.../SystemUI/res/values/lineage_dimens.xml | 3 +
.../navigationbar/NavigationBarView.java | 26 +++++
.../statusbar/phone/CentralSurfacesImpl.java | 14 +++
.../statusbar/phone/PhoneStatusBarView.java | 27 +++++
.../policy/BurnInProtectionController.java | 105 ++++++++++++++++++
5 files changed, 175 insertions(+)
create mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/policy/BurnInProtectionController.java
diff --git a/packages/SystemUI/res/values/lineage_dimens.xml b/packages/SystemUI/res/values/lineage_dimens.xml
index e1998ce3d3ab..dc59ccd794f7 100644
--- a/packages/SystemUI/res/values/lineage_dimens.xml
+++ b/packages/SystemUI/res/values/lineage_dimens.xml
@@ -21,4 +21,7 @@
<!-- Largest size an avatar might need to be drawn in the power menu user picker -->
<dimen name="global_actions_avatar_size">24dp</dimen>
+
+ <dimen name="burnin_protection_horizontal_shift">3dp</dimen>
+ <dimen name="burnin_protection_vertical_shift">1dp</dimen>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
index 883903efb95f..2020910d88bf 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
@@ -163,6 +163,13 @@ public class NavigationBarView extends FrameLayout implements TunerService.Tunab
private FloatingRotationButton mFloatingRotationButton;
private RotationButtonController mRotationButtonController;
+ private int mBasePaddingBottom;
+ private int mBasePaddingLeft;
+ private int mBasePaddingRight;
+ private int mBasePaddingTop;
+
+ private ViewGroup mNavigationBarContents;
+
/**
* Helper that is responsible for showing the right toast when a disallowed activity operation
* occurred. In pinned mode, we show instructions on how to break out of this mode, whilst in
@@ -880,12 +887,31 @@ public class NavigationBarView extends FrameLayout implements TunerService.Tunab
mContextualButtonGroup.setButtonVisibility(R.id.accessibility_button, visible);
}
+ public void shiftNavigationBarItems(int horizontalShift, int verticalShift) {
+ if (mNavigationBarContents == null) {
+ return;
+ }
+
+ mNavigationBarContents.setPaddingRelative(mBasePaddingLeft + horizontalShift,
+ mBasePaddingTop + verticalShift,
+ mBasePaddingRight + horizontalShift,
+ mBasePaddingBottom - verticalShift);
+ invalidate();
+ }
+
@Override
public void onFinishInflate() {
super.onFinishInflate();
mNavigationInflaterView = findViewById(R.id.navigation_inflater);
mNavigationInflaterView.setButtonDispatchers(mButtonDispatchers);
+
+ mNavigationBarContents = (ViewGroup) findViewById(R.id.nav_buttons);
+
+ mBasePaddingLeft = mNavigationBarContents.getPaddingStart();
+ mBasePaddingTop = mNavigationBarContents.getPaddingTop();
+ mBasePaddingRight = mNavigationBarContents.getPaddingEnd();
+ mBasePaddingBottom = mNavigationBarContents.getPaddingBottom();
updateOrientationViews();
reloadNavIcons();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
index 83755c6591be..4e2bb5424eb8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -226,6 +226,7 @@ import com.android.systemui.statusbar.phone.dagger.StatusBarPhoneModule;
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BrightnessMirrorController;
+import com.android.systemui.statusbar.policy.BurnInProtectionController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
@@ -453,6 +454,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces, Tune
@Nullable
protected LockscreenWallpaper mLockscreenWallpaper;
private final AutoHideController mAutoHideController;
+ private BurnInProtectionController mBurnInProtectionController;
private final Point mCurrentDisplaySize = new Point();
@@ -1233,6 +1235,12 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces, Tune
mNotificationPanelViewController.updatePanelExpansionAndVisibility();
setBouncerShowingForStatusBarComponents(mBouncerShowing);
checkBarModes();
+
+ if (mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_enableBurnInProtection)) {
+ mBurnInProtectionController = new BurnInProtectionController(mContext,
+ this, mStatusBarView);
+ }
});
initializer.initializeStatusBar(mCentralSurfacesComponent);
@@ -3488,6 +3496,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces, Tune
updateNotificationPanelTouchState();
mNotificationShadeWindowViewController.cancelCurrentTouch();
+ if (mBurnInProtectionController != null) {
+ mBurnInProtectionController.stopShiftTimer(true);
+ }
if (mLaunchCameraOnFinishedGoingToSleep) {
mLaunchCameraOnFinishedGoingToSleep = false;
@@ -3593,6 +3604,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces, Tune
}
}
updateScrimController();
+ if (mBurnInProtectionController != null) {
+ mBurnInProtectionController.startShiftTimer(true);
+ }
}
};
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index 5692024fb473..3892921957b2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone;
import android.annotation.Nullable;
import android.content.Context;
+import android.content.res.Resources;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.inputmethodservice.InputMethodService;
@@ -63,6 +64,13 @@ public class PhoneStatusBarView extends FrameLayout implements Callbacks {
private final CommandQueue mCommandQueue;
private final StatusBarContentInsetsProvider mContentInsetsProvider;
+ private int mBasePaddingBottom;
+ private int mBasePaddingLeft;
+ private int mBasePaddingRight;
+ private int mBasePaddingTop;
+
+ private ViewGroup mStatusBarContents;
+
private DarkReceiver mBattery;
private ClockController mClockController;
private int mRotationOrientation = -1;
@@ -140,6 +148,18 @@ public class PhoneStatusBarView extends FrameLayout implements Callbacks {
StatusBarUserChipViewBinder.bind(container, viewModel);
}
+ public void shiftStatusBarItems(int horizontalShift, int verticalShift) {
+ if (mStatusBarContents == null) {
+ return;
+ }
+
+ mStatusBarContents.setPaddingRelative(mBasePaddingLeft + horizontalShift,
+ mBasePaddingTop + verticalShift,
+ mBasePaddingRight + horizontalShift,
+ mBasePaddingBottom - verticalShift);
+ invalidate();
+ }
+
@Override
public void onFinishInflate() {
super.onFinishInflate();
@@ -147,6 +167,13 @@ public class PhoneStatusBarView extends FrameLayout implements Callbacks {
mClockController = new ClockController(getContext(), this);
mCutoutSpace = findViewById(R.id.cutout_space_view);
+ mStatusBarContents = (ViewGroup) findViewById(R.id.status_bar_contents);
+
+ mBasePaddingLeft = mStatusBarContents.getPaddingStart();
+ mBasePaddingTop = mStatusBarContents.getPaddingTop();
+ mBasePaddingRight = mStatusBarContents.getPaddingEnd();
+ mBasePaddingBottom = mStatusBarContents.getPaddingBottom();
+
updateResources();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BurnInProtectionController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BurnInProtectionController.java
new file mode 100644
index 000000000000..864d86ffd6a3
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BurnInProtectionController.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2017 Paranoid Android
+ * Copyright 2020 The LineageOS Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.policy;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.Log;
+
+import com.android.systemui.R;
+import com.android.systemui.navigationbar.NavigationBarView;
+import com.android.systemui.statusbar.phone.PhoneStatusBarView;
+import com.android.systemui.statusbar.phone.CentralSurfacesImpl;
+
+public class BurnInProtectionController {
+ private static final String TAG = "BurnInProtectionController";
+ private static final boolean DEBUG = false;
+ private static final long INTERVAL = 60000; // Milliseconds
+
+ private int mHorizontalShift = 0;
+ private int mVerticalShift = 0;
+ private int mHorizontalDirection = 1;
+ private int mVerticalDirection = 1;
+ private int mNavigationBarHorizontalMaxShift;
+ private int mNavigationBarVerticalMaxShift;
+ private int mHorizontalMaxShift;
+ private int mVerticalMaxShift;
+ private long mShiftInterval;
+
+ private final Handler mHandler = new Handler();
+ private final Runnable mRunnable = () -> {
+ shiftItems();
+ mHandler.postDelayed(this.mRunnable, INTERVAL);
+ };
+
+ private PhoneStatusBarView mPhoneStatusBarView;
+ private CentralSurfacesImpl mStatusBar;
+
+ private Context mContext;
+
+ public BurnInProtectionController(Context context, CentralSurfacesImpl statusBar,
+ PhoneStatusBarView phoneStatusBarView) {
+ mContext = context;
+
+ mPhoneStatusBarView = phoneStatusBarView;
+ mStatusBar = statusBar;
+
+ mHorizontalMaxShift = mContext.getResources()
+ .getDimensionPixelSize(R.dimen.burnin_protection_horizontal_shift);
+ // total of ((vertical_max_shift - 1) * 2) pixels can be moved
+ mVerticalMaxShift = mContext.getResources()
+ .getDimensionPixelSize(R.dimen.burnin_protection_vertical_shift) - 1;
+ }
+
+ public void startShiftTimer(boolean enabled) {
+ if (!enabled) return;
+ mHandler.removeCallbacks(mRunnable);
+ mHandler.postDelayed(mRunnable, INTERVAL);
+ if (DEBUG) Log.d(TAG, "Started shift timer");
+ }
+
+ public void stopShiftTimer(boolean enabled) {
+ if (!enabled) return;
+ mHandler.removeCallbacks(mRunnable);
+ if (DEBUG) Log.d(TAG, "Canceled shift timer");
+ }
+
+ private void shiftItems() {
+ mHorizontalShift += mHorizontalDirection;
+ if ((mHorizontalShift >= mHorizontalMaxShift) ||
+ (mHorizontalShift <= -mHorizontalMaxShift)) {
+ mHorizontalDirection *= -1;
+ }
+
+ mVerticalShift += mVerticalDirection;
+ if ((mVerticalShift >= mVerticalMaxShift) ||
+ (mVerticalShift <= -mVerticalMaxShift)) {
+ mVerticalDirection *= -1;
+ }
+
+ mPhoneStatusBarView.shiftStatusBarItems(mHorizontalShift, mVerticalShift);
+ NavigationBarView navigationBarView = mStatusBar.getNavigationBarView();
+
+ if (navigationBarView != null) {
+ navigationBarView.shiftNavigationBarItems(mHorizontalShift, mVerticalShift);
+ }
+ if (DEBUG) Log.d(TAG, "Shifting items\u2026");
+ }
+}
--
2.34.1

View File

@@ -1,7 +1,7 @@
From 933a1e4767cc3deec8545623ce7e44f39a05a922 Mon Sep 17 00:00:00 2001
From d5b5deb95a8bf6737973cde8460d05b19a70032c Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Sat, 16 Oct 2021 05:27:57 -0700
Subject: [PATCH 15/15] Add support for app signature spoofing
Subject: [PATCH 16/24] Add support for app signature spoofing
This is needed by microG GmsCore to pretend to be the official Google
Play Services package, because client apps check the package signature
@@ -38,7 +38,7 @@ Change-Id: Ied7d6ce0b83a2d2345c3abba0429998d86494a88
4 files changed, 56 insertions(+), 3 deletions(-)
diff --git a/core/api/current.txt b/core/api/current.txt
index c8a43db2f9c2..277183036c60 100644
index 487e57d114c9..04e69741b9fd 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -87,6 +87,7 @@ package android {
@@ -58,10 +58,10 @@ index c8a43db2f9c2..277183036c60 100644
field public static final String MICROPHONE = "android.permission-group.MICROPHONE";
field public static final String NEARBY_DEVICES = "android.permission-group.NEARBY_DEVICES";
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 1b90803404f7..d1cb6c3241f2 100644
index bbe31240f5f3..7d717b2106a1 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -3542,6 +3542,21 @@
@@ -3572,6 +3572,21 @@
android:description="@string/permdesc_getPackageSize"
android:protectionLevel="normal" />
@@ -84,10 +84,10 @@ index 1b90803404f7..d1cb6c3241f2 100644
{@link android.content.pm.PackageManager#addPackageToPreferred}
for details. -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 5763345aba4d..8ffdbdd6f15b 100644
index 9410e0682106..7ed7a03f1b61 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -974,6 +974,18 @@
@@ -977,6 +977,18 @@
<!-- Permissions -->
@@ -159,5 +159,5 @@ index 46b7460dff1b..40549962436f 100644
if (packageInfo == null) {
return null;
--
2.25.1
2.34.1

View File

@@ -0,0 +1,113 @@
From 47265639ead98824ac0d176e06bcffe6a2035a42 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Mon, 11 Oct 2021 19:59:51 -0700
Subject: [PATCH 17/24] Spoof product name for Google Play Services
NB: This code is under the gmscompat package, but it does not depend on
any code from gmscompat.
Change-Id: Ic018c0d7abe4573143c3b92301a2625b91e6673a
---
core/java/android/app/Instrumentation.java | 4 ++
.../internal/gmscompat/AttestationHooks.java | 60 +++++++++++++++++++
2 files changed, 64 insertions(+)
create mode 100644 core/java/com/android/internal/gmscompat/AttestationHooks.java
diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java
index 556058b567f9..44449588bbab 100644
--- a/core/java/android/app/Instrumentation.java
+++ b/core/java/android/app/Instrumentation.java
@@ -57,6 +57,8 @@ import android.view.WindowManagerGlobal;
import com.android.internal.content.ReferrerIntent;
+import com.android.internal.gmscompat.AttestationHooks;
+
import java.io.File;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -1242,6 +1244,7 @@ public class Instrumentation {
Application app = getFactory(context.getPackageName())
.instantiateApplication(cl, className);
app.attach(context);
+ AttestationHooks.initApplicationBeforeOnCreate(app);
return app;
}
@@ -1259,6 +1262,7 @@ public class Instrumentation {
ClassNotFoundException {
Application app = (Application)clazz.newInstance();
app.attach(context);
+ AttestationHooks.initApplicationBeforeOnCreate(app);
return app;
}
diff --git a/core/java/com/android/internal/gmscompat/AttestationHooks.java b/core/java/com/android/internal/gmscompat/AttestationHooks.java
new file mode 100644
index 000000000000..55db97dc28a1
--- /dev/null
+++ b/core/java/com/android/internal/gmscompat/AttestationHooks.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.gmscompat;
+
+import android.app.Application;
+import android.os.Build;
+import android.os.SystemProperties;
+import android.util.Log;
+
+import java.lang.reflect.Field;
+
+/** @hide */
+public final class AttestationHooks {
+ private static final String TAG = "GmsCompat/Attestation";
+
+ private static final String PACKAGE_GMS = "com.google.android.gms";
+
+ private AttestationHooks() { }
+
+ private static void setBuildField(String key, String value) {
+ try {
+ // Unlock
+ Field field = Build.class.getDeclaredField(key);
+ field.setAccessible(true);
+
+ // Edit
+ field.set(null, value);
+
+ // Lock
+ field.setAccessible(false);
+ } catch (NoSuchFieldException | IllegalAccessException e) {
+ Log.e(TAG, "Failed to spoof Build." + key, e);
+ }
+ }
+
+ private static void spoofBuildGms() {
+ // Alter model name to avoid hardware attestation enforcement
+ setBuildField("MODEL", "Pixel 5a");
+ }
+
+ public static void initApplicationBeforeOnCreate(Application app) {
+ if (PACKAGE_GMS.equals(app.getPackageName())) {
+ spoofBuildGms();
+ }
+ }
+}
--
2.34.1

View File

@@ -0,0 +1,93 @@
From 838a9febd980da5a1829c75f86ecc5a519e9cdb9 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Mon, 11 Oct 2021 20:00:44 -0700
Subject: [PATCH 18/24] keystore: Block key attestation for SafetyNet
SafetyNet (part of Google Play Services) opportunistically uses
hardware-backed key attestation via KeyStore as a strong integrity
check. This causes SafetyNet to fail on custom ROMs because the verified
boot key and bootloader unlock state can be detected from attestation
certificates.
As a workaround, we can take advantage of the fact that SafetyNet's
usage of key attestation is opportunistic (i.e. falls back to basic
integrity checks if it fails) and prevent it from getting the
attestation certificate chain from KeyStore. This is done by checking
the stack for DroidGuard, which is the codename for SafetyNet, and
pretending that the device doesn't support key attestation.
Key attestation has only been blocked for SafetyNet specifically, as
Google Play Services and other apps have many valid reasons to use it.
For example, it appears to be involved in Google's mobile security key
ferature.
Change-Id: I5146439d47f42dc6231cb45c4dab9f61540056f6
---
.../internal/gmscompat/AttestationHooks.java | 15 +++++++++++++++
.../security/keystore2/AndroidKeyStoreSpi.java | 3 +++
2 files changed, 18 insertions(+)
diff --git a/core/java/com/android/internal/gmscompat/AttestationHooks.java b/core/java/com/android/internal/gmscompat/AttestationHooks.java
index 55db97dc28a1..f2c85c82821f 100644
--- a/core/java/com/android/internal/gmscompat/AttestationHooks.java
+++ b/core/java/com/android/internal/gmscompat/AttestationHooks.java
@@ -22,12 +22,14 @@ import android.os.SystemProperties;
import android.util.Log;
import java.lang.reflect.Field;
+import java.util.Arrays;
/** @hide */
public final class AttestationHooks {
private static final String TAG = "GmsCompat/Attestation";
private static final String PACKAGE_GMS = "com.google.android.gms";
+ private static volatile boolean sIsGms = false;
private AttestationHooks() { }
@@ -54,7 +56,20 @@ public final class AttestationHooks {
public static void initApplicationBeforeOnCreate(Application app) {
if (PACKAGE_GMS.equals(app.getPackageName())) {
+ sIsGms = true;
spoofBuildGms();
}
}
+
+ private static boolean isCallerSafetyNet() {
+ return Arrays.stream(Thread.currentThread().getStackTrace())
+ .anyMatch(elem -> elem.getClassName().contains("DroidGuard"));
+ }
+
+ public static void onEngineGetCertificateChain() {
+ // Check stack for SafetyNet
+ if (sIsGms && isCallerSafetyNet()) {
+ throw new UnsupportedOperationException();
+ }
+ }
}
diff --git a/keystore/java/android/security/keystore2/AndroidKeyStoreSpi.java b/keystore/java/android/security/keystore2/AndroidKeyStoreSpi.java
index 33411e1ec5b9..133a4094d434 100644
--- a/keystore/java/android/security/keystore2/AndroidKeyStoreSpi.java
+++ b/keystore/java/android/security/keystore2/AndroidKeyStoreSpi.java
@@ -42,6 +42,7 @@ import android.system.keystore2.ResponseCode;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.gmscompat.AttestationHooks;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -164,6 +165,8 @@ public class AndroidKeyStoreSpi extends KeyStoreSpi {
@Override
public Certificate[] engineGetCertificateChain(String alias) {
+ AttestationHooks.onEngineGetCertificateChain();
+
KeyEntryResponse response = getKeyMetadata(alias);
if (response == null || response.metadata.certificate == null) {
--
2.34.1

View File

@@ -0,0 +1,42 @@
From 260b0f7a81c762b3b03b8f83dedee9c92e0f55ca Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Mon, 1 Nov 2021 20:06:48 -0700
Subject: [PATCH 19/24] Limit SafetyNet workarounds to unstable GMS process
The unstable process is where SafetyNet attestation actually runs, so
we only need to spoof the model in that process. Leaving other processes
fixes various issues caused by model detection and flag provisioning,
including screen-off Voice Match in Google Assistant, broken At a Glance
weather and settings on Android 12, and more.
Change-Id: Idcf663907a6c3d0408dbd45b1ac53c9eb4200df8
---
.../com/android/internal/gmscompat/AttestationHooks.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/core/java/com/android/internal/gmscompat/AttestationHooks.java b/core/java/com/android/internal/gmscompat/AttestationHooks.java
index f2c85c82821f..37ce8c946de6 100644
--- a/core/java/com/android/internal/gmscompat/AttestationHooks.java
+++ b/core/java/com/android/internal/gmscompat/AttestationHooks.java
@@ -29,6 +29,8 @@ public final class AttestationHooks {
private static final String TAG = "GmsCompat/Attestation";
private static final String PACKAGE_GMS = "com.google.android.gms";
+ private static final String PROCESS_UNSTABLE = "com.google.android.gms.unstable";
+
private static volatile boolean sIsGms = false;
private AttestationHooks() { }
@@ -55,7 +57,8 @@ public final class AttestationHooks {
}
public static void initApplicationBeforeOnCreate(Application app) {
- if (PACKAGE_GMS.equals(app.getPackageName())) {
+ if (PACKAGE_GMS.equals(app.getPackageName()) &&
+ PROCESS_UNSTABLE.equals(Application.getProcessName())) {
sIsGms = true;
spoofBuildGms();
}
--
2.34.1

View File

@@ -0,0 +1,59 @@
From 839d9d8e213a15c823aa218539993b2c23f3bd65 Mon Sep 17 00:00:00 2001
From: Dyneteve <dyneteve@hentaios.com>
Date: Tue, 23 Aug 2022 18:57:05 +0200
Subject: [PATCH 20/24] gmscompat: Apply the SafetyNet workaround to Play Store
aswell
Play Store is used for the new Play Integrity API, extend the hack
to it aswell
Test: Device Integrity and Basic Integrity passes.
Signed-off-by: Dyneteve <dyneteve@hentaios.com>
Change-Id: Id607cdff0b902f285a6c1b769c0a4ee4202842b1
---
.../android/internal/gmscompat/AttestationHooks.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/core/java/com/android/internal/gmscompat/AttestationHooks.java b/core/java/com/android/internal/gmscompat/AttestationHooks.java
index 37ce8c946de6..65469239a0c6 100644
--- a/core/java/com/android/internal/gmscompat/AttestationHooks.java
+++ b/core/java/com/android/internal/gmscompat/AttestationHooks.java
@@ -29,9 +29,11 @@ public final class AttestationHooks {
private static final String TAG = "GmsCompat/Attestation";
private static final String PACKAGE_GMS = "com.google.android.gms";
+ private static final String PACKAGE_FINSKY = "com.android.vending";
private static final String PROCESS_UNSTABLE = "com.google.android.gms.unstable";
private static volatile boolean sIsGms = false;
+ private static volatile boolean sIsFinsky = false;
private AttestationHooks() { }
@@ -62,6 +64,11 @@ public final class AttestationHooks {
sIsGms = true;
spoofBuildGms();
}
+
+ if (PACKAGE_FINSKY.equals(app.getPackageName())) {
+ sIsFinsky = true;
+ spoofBuildGms();
+ }
}
private static boolean isCallerSafetyNet() {
@@ -74,5 +81,10 @@ public final class AttestationHooks {
if (sIsGms && isCallerSafetyNet()) {
throw new UnsupportedOperationException();
}
+
+ // Check stack for PlayIntegrity
+ if (sIsFinsky) {
+ throw new UnsupportedOperationException();
+ }
}
}
--
2.34.1

View File

@@ -0,0 +1,46 @@
From 030dc8f051ca98594cc037b1fe6b79d417d3a8a3 Mon Sep 17 00:00:00 2001
From: Dyneteve <dyneteve@hentaios.com>
Date: Thu, 8 Sep 2022 14:39:52 +0200
Subject: [PATCH 21/24] gmscompat: Use Nexus 6P fingerprint for CTS/Integrity
Google seems to have patched the KM block to Play Store in record time,
but is still not enforced for anything under android N.
Since we moved to angler FP we don't need to spoof model to Play Store
anymore, however the KM block is still needed.
Test: Run Play Intregrity Attestation
Signed-off-by: Dyneteve <dyneteve@hentaios.com>
Change-Id: Ic2401a6e40ddfc4318a1d0faa87e42eb118ac3d1
---
.../com/android/internal/gmscompat/AttestationHooks.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/core/java/com/android/internal/gmscompat/AttestationHooks.java b/core/java/com/android/internal/gmscompat/AttestationHooks.java
index 65469239a0c6..328d9777b2a2 100644
--- a/core/java/com/android/internal/gmscompat/AttestationHooks.java
+++ b/core/java/com/android/internal/gmscompat/AttestationHooks.java
@@ -54,8 +54,9 @@ public final class AttestationHooks {
}
private static void spoofBuildGms() {
- // Alter model name to avoid hardware attestation enforcement
- setBuildField("MODEL", "Pixel 5a");
+ // Alter model name and fingerprint to avoid hardware attestation enforcement
+ setBuildField("FINGERPRINT", "google/angler/angler:6.0/MDB08L/2343525:user/release-keys");
+ setBuildField("MODEL", "Nexus 6P");
}
public static void initApplicationBeforeOnCreate(Application app) {
@@ -67,7 +68,6 @@ public final class AttestationHooks {
if (PACKAGE_FINSKY.equals(app.getPackageName())) {
sIsFinsky = true;
- spoofBuildGms();
}
}
--
2.34.1

View File

@@ -0,0 +1,27 @@
From bdd113e11896541b2e4df0fcb9dd94ce3334e933 Mon Sep 17 00:00:00 2001
From: Dyneteve <dyneteve@hentaios.com>
Date: Tue, 6 Dec 2022 15:59:08 +0100
Subject: [PATCH 22/24] gmscompat: Use actual device model name
Signed-off-by: Dyneteve <dyneteve@hentaios.com>
Change-Id: I454654d87b3ea6286e12e9a9f5ed120f06cb2aa6
---
core/java/com/android/internal/gmscompat/AttestationHooks.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/java/com/android/internal/gmscompat/AttestationHooks.java b/core/java/com/android/internal/gmscompat/AttestationHooks.java
index 328d9777b2a2..7649bb6533da 100644
--- a/core/java/com/android/internal/gmscompat/AttestationHooks.java
+++ b/core/java/com/android/internal/gmscompat/AttestationHooks.java
@@ -56,7 +56,7 @@ public final class AttestationHooks {
private static void spoofBuildGms() {
// Alter model name and fingerprint to avoid hardware attestation enforcement
setBuildField("FINGERPRINT", "google/angler/angler:6.0/MDB08L/2343525:user/release-keys");
- setBuildField("MODEL", "Nexus 6P");
+ setBuildField("MODEL", Build.MODEL + "\u200b");
}
public static void initApplicationBeforeOnCreate(Application app) {
--
2.34.1

View File

@@ -0,0 +1,57 @@
From b4b83ed885d8c3751220ab7270ff0819ea37fb5e Mon Sep 17 00:00:00 2001
From: Anirudh Gupta <anirudhgupta109@aosip.dev>
Date: Wed, 4 Jan 2023 18:20:56 +0000
Subject: [PATCH 23/24] gmscompat: Set shipping level to 32 for devices >=33
If ro.product.first_api_level is 33, its forced to use HW attestation even though the safteynet checker app shows BASIC
setting it to 32 allows for software attestation and passing CTS
Change-Id: Ie7326eaac48424cdea3d9633ebe13c65053ef6c1
Signed-off-by: Dyneteve <dyneteve@hentaios.com>
---
.../internal/gmscompat/AttestationHooks.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/core/java/com/android/internal/gmscompat/AttestationHooks.java b/core/java/com/android/internal/gmscompat/AttestationHooks.java
index 7649bb6533da..d2b1d2879c9c 100644
--- a/core/java/com/android/internal/gmscompat/AttestationHooks.java
+++ b/core/java/com/android/internal/gmscompat/AttestationHooks.java
@@ -18,6 +18,7 @@ package com.android.internal.gmscompat;
import android.app.Application;
import android.os.Build;
+import android.os.Build.VERSION;
import android.os.SystemProperties;
import android.util.Log;
@@ -53,10 +54,27 @@ public final class AttestationHooks {
}
}
+ private static void setVersionField(String key, Integer value) {
+ try {
+ // Unlock
+ Field field = Build.VERSION.class.getDeclaredField(key);
+ field.setAccessible(true);
+
+ // Edit
+ field.set(null, value);
+
+ // Lock
+ field.setAccessible(false);
+ } catch (NoSuchFieldException | IllegalAccessException e) {
+ Log.e(TAG, "Failed to spoof Build." + key, e);
+ }
+ }
+
private static void spoofBuildGms() {
// Alter model name and fingerprint to avoid hardware attestation enforcement
setBuildField("FINGERPRINT", "google/angler/angler:6.0/MDB08L/2343525:user/release-keys");
setBuildField("MODEL", Build.MODEL + "\u200b");
+ setVersionField("DEVICE_INITIAL_SDK_INT", Build.VERSION_CODES.S);
}
public static void initApplicationBeforeOnCreate(Application app) {
--
2.34.1

View File

@@ -0,0 +1,65 @@
From 2d053efcdbc7ad46ab7cae4550c3134b6ca5ba62 Mon Sep 17 00:00:00 2001
From: Dyneteve <dyneteve@hentaios.com>
Date: Wed, 8 Feb 2023 15:21:01 +0000
Subject: [PATCH 24/24] gmscompat: Make CTS/Play Integrity pass again
The logic behind CTS and Play Integrity has been updated today it now
checks the product and model names against the fingerprint and if
they do not match the CTS profile will fail.
Also while we are at it use a newer FP from Pixel XL and add logging
for key attestation blocking for debugging.
Test: Boot, check for CTS and Play Integrity
Change-Id: I089d5ef935bba40338e10c795ea7d181103ffd15
Signed-off-by: Dyneteve <dyneteve@hentaios.com>
---
.../internal/gmscompat/AttestationHooks.java | 20 +++++++++----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/core/java/com/android/internal/gmscompat/AttestationHooks.java b/core/java/com/android/internal/gmscompat/AttestationHooks.java
index d2b1d2879c9c..ef7a308a25bc 100644
--- a/core/java/com/android/internal/gmscompat/AttestationHooks.java
+++ b/core/java/com/android/internal/gmscompat/AttestationHooks.java
@@ -72,9 +72,11 @@ public final class AttestationHooks {
private static void spoofBuildGms() {
// Alter model name and fingerprint to avoid hardware attestation enforcement
- setBuildField("FINGERPRINT", "google/angler/angler:6.0/MDB08L/2343525:user/release-keys");
- setBuildField("MODEL", Build.MODEL + "\u200b");
- setVersionField("DEVICE_INITIAL_SDK_INT", Build.VERSION_CODES.S);
+ setBuildField("FINGERPRINT", "google/marlin/marlin:7.1.2/NJH47F/4146041:user/release-keys");
+ setBuildField("PRODUCT", "marlin");
+ setBuildField("DEVICE", "marlin");
+ setBuildField("MODEL", "Pixel XL");
+ setVersionField("DEVICE_INITIAL_SDK_INT", Build.VERSION_CODES.N_MR1);
}
public static void initApplicationBeforeOnCreate(Application app) {
@@ -90,18 +92,14 @@ public final class AttestationHooks {
}
private static boolean isCallerSafetyNet() {
- return Arrays.stream(Thread.currentThread().getStackTrace())
+ return sIsGms && Arrays.stream(Thread.currentThread().getStackTrace())
.anyMatch(elem -> elem.getClassName().contains("DroidGuard"));
}
public static void onEngineGetCertificateChain() {
- // Check stack for SafetyNet
- if (sIsGms && isCallerSafetyNet()) {
- throw new UnsupportedOperationException();
- }
-
- // Check stack for PlayIntegrity
- if (sIsFinsky) {
+ // Check stack for SafetyNet or Play Integrity
+ if (isCallerSafetyNet() || sIsFinsky) {
+ Log.i(TAG, "Blocked key attestation sIsGms=" + sIsGms + " sIsFinsky=" + sIsFinsky);
throw new UnsupportedOperationException();
}
}
--
2.34.1