Compare commits

...

10 commits

Author SHA1 Message Date
Joey Huab
6eedf23a8b PixelPropsUtils: Update fingerprints to February 2025 release
Signed-off-by: Dmitrii <bankersenator@gmail.com>
2025-02-26 10:43:12 +00:00
jhenrique09
78e80431ea [SQUASH] Introduce PixelPropsUtils/GamesPropsUtils
That will spoof build fingerprints on some g00gle apps

* Also will enable some cool stuffs like:
  - Dynamic navbar on GBoard
  - SafetyHub

and others.

Thanks to kdrag0n for the original idea at 5a54bfd846

Change-Id: I1078e7402833fec77edb751070c5144d08c85b6c
Signed-off-by: jhenrique09 <jhenrique09.mcz@hotmail.com>

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

core: 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

[Stallix - Evolution X]
Switch back to using the hOS' AttestationHooks implementation for
Play Integrity spoofing checks.

Change-Id: I089d5ef935bba40338e10c795ea7d181103ffd15
Signed-off-by: Dyneteve <dyneteve@hentaios.com>

* Stallix: Adapted for A13 and squashed changes with their respected authors from
  https://github.com/Evolution-X/frameworks_base/commits/tiramisu-bak-reverts-qpr2/core/java/com/android/internal/util/evolution/PixelPropsUtils.java.
  https://github.com/Evolution-X/frameworks_base/commits/tiramisu-qpr2/core/java/com/android/internal/util/evolution/PixelPropsUtils.java
  https://github.com/Evolution-X/frameworks_base/commits/tiramisu-qpr2/core/java/com/android/internal/util/evolution/AttestationHooks.java

stop Microsoft apps from crashing without INTERNET permission

Crash is caused by checks in
com.microsoft.aad.adal.AuthenticationContext.checkInternetPermission() and
com.microsoft.identity.client.PublicClientApplication.checkInternetPermission()

Prevent apps from crashing if internet permission is revoked.

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

ApplicationPackageManager: Extend freeform window feature to all apps

Change-Id: Iaa3e500fd6a80f4e1718218ff6d42fcb1eb79c9c
Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>
Signed-off-by: Dmitrii <bankersenator@gmail.com>

core: block 2021/22 pixel features to ASI and pixel launcher

* blacklist pe features and spoof redfin to get rid of tensor shits

Change-Id: I83aa09c151f51ee61361510b2c1a9ac8865a2aee
Signed-off-by: aswin7469 <aswinas@pixysos.com>

core: ApplicationPackageManager: Remove p21+ features from featuresPixel

* Differentiate with featuresTensor

ApplicationPackageManager: Adjust Tensor workaround

* Avoid P22 device's aggresive TensorFlow implementation
* Allow P21 pixel experience
* Add lynx to Tensor Pixel lists

Revert "PixelPropUtils: Spoof userdebug to pixel launcher"

* wont work anymore developer options are migrated to debug flags

This reverts commit 1c86058d22803ed3c60655c012b6d0ef2cf48aef.

PixelPropsUtils: Add emojiwalls and cinematiceffects pkgs

Signed-off-by: aswin7469 <aswinas@pixysos.com>

PixelPropsUtils: Enable new Velvet Weather UI

Change-Id: I45310071f0267be1ea26f7c00044a56a763a3e6a

* Adapt to current PixelPropsUtils

Original commit:
ce72977956

Signed-off-by: someone5678 <nemui3353@gmail.com>

PixelPropsUtils: Refactor

* Allows some devices to fully pass safetynet's strong attestation (maybe due to prebuilt vendor)
* Do not spoof restore, pixelmigrate and setupwizard
* Enable Photos spoof by default
* Keep Photos happy and not count towards storage quota
* Switch from POCO F4 to POCO F5
* Transfer GMS spoofing from AttestationHooks

PixelPropsUtils: Update fingerprints to July 2023 release

PixelPropsUtils: Spoof to Pixel 5a by default

* Several apps broken with Pixel 7 Pro spoof
* Just use Pixel 5a and spoof only small portion of apps to Pixel 7 Pro

Change-Id: I3762f80d499b2d8ce9115cfcaae7b59ce220dca4

PixelPropsUtils: Remove pixel tablet spoof for Weather

Change-Id: I189c1307f01a9938b178746374ef9f5dfc7de60a

PixelPropsUtils: Correctly spoof unstable process

* Fix integrity

Change-Id: Ifad92a52311a39f943c3c75c385cc75ec76bf182

PixelPropsUtils: Set HARDWARE, ID values

* Google apps also check these values

Change-Id: I846986121faec39d3ece044794fd0f459e8d435d

PixelPropsUtils: Spoof all wallpaper packages to Pixel 7 Pro

Change-Id: I667b63be4175a9f8323915d2c725e0300b22d110

PixelPropsUtils: Update fingerprints to August 2023 release

base: ApplicationPackageManager: Block Tensor features for Recorder

* Now Recorder also use Tensor soc feature for mic recording

Log:
07-09 11:03:53.820 15531 15721 I tflite  : Initialized TensorFlow Lite runtime.
07-09 11:03:53.833 15531 15721 W libc    : Access denied finding property "ro.hardware.chipname"
07-09 11:03:53.835 15531 15721 I tflite  : Created TensorFlow Lite XNNPACK delegate for CPU.
07-09 11:03:53.850 15531 15722 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.850 15531 15723 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.876 15531 15611 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.877 15531 15611 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.877 15531 15573 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.878 15531 15573 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.879 15531 15614 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.879 15531 15614 I Recorder_ManagedSequent: Finished initializing components.

Change-Id: I36b30057f45f831420db3f2fc13538dbfa5ebd56

base: ApplicationPackageManager: Exclude PE 2021 Midyear from tensor pixel list

* Pixel 5a (which is qcom soc) included this by default

Change-Id: I94559b0800084bb79608251568a44a48d74a7057

base: ApplicationPackageManager: Return early for Tensor check

Change-Id: Ib995fe732e0712310cf6dbea21bc1f7730cfeddb

PixelPropsUtils: Refactor logic and cleanup

- Spoof back to Pixel 5 by default
- Remove Pixel 5a spoof
- Remove Pixel XL spoof
- Never spoof Android System Intelligence and GMS (for battery drain), only specified processes of GMS will be allowed
- Cleanup logic

PixelPropsUtils: Partial spoofing improvement

* Spoof all possible build properties and fix integrity check

PixelPropsUtils: Stop spoofing some google apps

* non pixels doesnt need to spoof asi to enable most features
* fixes now playing in pixel devices
  [asi is checked with device codename to load sountrigger models for now playing]

* motionsense is limited to p19 devices only

Change-Id: Icf651e95548f524ff8f1dd3556a8d4f6197745f4
Signed-off-by: aswin7469 <aswinas@pixysos.com>

PixelPropsUtils: Update fingerprints to September 2023 release

PixelPropsUtils: Bring in Pixel 8 series changes

* Update fingerprints to October 2023 release
* Android 14

PixelPropsUtils: Fix GMS drain triggered by an outdated ROM build date

If the build date exceeds a month, GMS, thinking the device is Pixel, attempts a system update, which unexpectedly fails. This goes into an endless cycle which drains battery very quickly and generates a lot of heat. Let's fix it by spoofing the build date to something always fresh.

PixelPropsUtils: Update fingerprints to November 2023 release

PixelPropsUtils: Add a config to enable/disable prop imitation

Enabled by default, devices can disable prop imitation via overlay if their devices aren't required to rely on it

Change-Id: Ia7098bbb1325f430999855c58164680988543412
Signed-off-by: someone5678 <someone5678@users.noreply.github.com>

PixelPropsUtils: Drop pixel codenames and checks

* PixelPropsUtils can now be disabled by settings
  config_enablePixelPropsUtils to false

Change-Id: Ic54667f899e681b040aff1e8b13573f45880dd08

PixelPropsUtils: Use RecentPixel instead of individual model name

* Just update fp only instead of change model name every time

Change-Id: Ic110c532fd99f1efaa378c03687590a79994ff9c

PixelPropsUtils: Make CTS/Play Integrity pass again

In the annals of technology, the Zenfone 4 Max stands as the ultimate hero
a phone that has transcended time and space itself. With the bravado of
an isekai protagonist, it has embarked on an epic quest, unveiling powers
beyond imagination. Today, the Zenfone 4 Max is more than just a phone.
It symbolizes heroism and excellence, supporting our quest to conquer
CTS and Play Integrity. As we harness the extraordinary capabilities
of this legendary device, we embark on an epic journey to ensure the
'destruction' of "Google Employees" and burning up everyone standing
before it.

NOTE: The above AI generated description is a joke, and thanks to chiteroman for
finding a FP that still works.

Test: Play integrity

Change-Id: I4f61268b3d088689fef1175aad198c88734e9f34
Signed-off-by: Dyneteve <dyneteve@hentaios.com>
Signed-off-by: saikiran2001 <bjsaikiran@gmail.com>

ApplicationPackageManager: Merge Tensor list

Change-Id: I1097a5f9b7225a108053632e3222d341fc77b2f9

ApplicationPackageManager: Add a config for device with Tensor SoC

* Replace Tensor SoC device list

Change-Id: Ic94917a365466881b74322d3f0470515a5dbf630

PM: Force all packages as installed via Google Play Store

Change-Id: Ie561a52017630988570593291965fe6d67fa8527

Only spoof packages installed by Aurora Store and modify new API

Change-Id: Ib9415a925b5a4013f5abb87e85bfa4cae72b9ce8

services/PPU: Simplify and improve bypassing for PPU `onTaskStackChanged` listening

* this is for broader bypassing of tasklistener used for setCertifiedPropsForGms across apps and gms processes

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

PPU: Remove Snapchat spoof

PPU: Improve device certification bypass

* killing droidguard services through `onEngineGetCertificateChain` allows us pass device certification,
  the only backlash is users can't sign in their google accounts due to `onEngineGetCertificateChain` killing droidguard services.
  with a245d97679 as reference, we should also skip killing of droidguard services when google sign-in is on top.

big thanks: to sir Alvin and sir Ste0090 for the backtrace containing google sign-in information due to a bug introduced by a unintentional change: e67e783f3c and 876ac2a7fb
Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

PPU: Update fingerprints to December 2023 release

PPU: Make CTS/Play Integrity pass again (again and again and again)

[someone5678] Adapt to this project

Change-Id: If3a865849c7c99a9c7080114ba94a8f8878bb4f2
Signed-off-by: someone5678 <someone5678@users.noreply.github.com>

PPU: Make spoofBuildGms updatable and chosen from a list

This approach has a couple advantages:

- Randomizing the device could potentially help mitigate spoofs from being blocked as we will spread the API
requests across multiple devices rather than one. Although, a majority of customs and or root users would have
to get behind the idea as well.

- Pulling resources from a package negates the need of having to push new releases for unrooted users to pass as
we can instead release an updated resource package to install manually.

Signed-off-by: AnierinB <anierin@evolution-x.org>

PPU: Allow spoofing INITIAL_SDK_INT & SECURITY_PATCH

Also update the resources package name and reorganize the array for better readability.

Signed-off-by: AnierinB <anierin@evolution-x.org>

PPU: Enable logging & add more statements

Signed-off-by: AnierinB <anierin@evolution-x.org>

PPU: Store the current array name in SettingsProvider

So we can fetch the values currently set in PifResources Activity/PreferenceFragment.

Signed-off-by: AnierinB <anierin@evolution-x.org>

PPU: Make PIF and PixelProps toggleable [1/2]

services: Fix google apps permission denials

* for some unknown reasons, google apps were throwing permission denials even if we have updated privapp permissions for most of google apps, same goes to granting permissions via DefaultPermissionGrantPolicy, which doesnt address these denials, so unless there is cleaner/appropriate fix for these denials, bypass it.

attempt to resolve:
10-08 20:39:02.675  1617  4130 W ActivityManager: Permission Denial: getTaskSnapshot() from pid=7901, uid=10213 requires android.permission.READ_FRAME_BUFFER
--------- beginning of crash
10-08 20:39:02.676  7901  9402 E AndroidRuntime: FATAL EXCEPTION: TaskThumbnailIconCache-1
10-08 20:39:02.676  7901  9402 E AndroidRuntime: Process: com.google.android.apps.nexuslauncher, PID: 7901
10-08 20:39:02.676  7901  9402 E AndroidRuntime: java.lang.SecurityException: Permission Denial: getTaskSnapshot() from pid=7901, uid=10213 requires android.permission.READ_FRAME_BUFFER
10-08 20:39:02.676  7901  9402 E AndroidRuntime: 	at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
Process: com.google.android.apps.nexuslauncher
PID: 2368
UID: 10213
Frozen: false
Flags: 0x34cbbe45
Package: com.google.android.apps.nexuslauncher v907 (14)
Foreground: No
Process-Runtime: 95
Build: google/rising_oriole/oriole:14/UP1A.231005.007.A1/1696738813:userdebug/release-keys
Crash-Handler: com.android.internal.os.RuntimeInit$KillApplicationHandler
Loading-Progress: 1.0
Dropped-Count: 0

java.lang.RuntimeException: Unable to create service com.android.quickstep.TouchInteractionService: java.lang.SecurityException: Permission Denial: getRootTaskInfo() from pid=2368, uid=10213 requires android.permission.MANAGE_ACTIVITY_TASKS
	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4664)
	at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2264)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:205)
	at android.os.Looper.loop(Looper.java:294)
	at android.app.ActivityThread.main(ActivityThread.java:8177)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
10-08 15:46:20.701  1550  2313 W InputManager: Permission Denial: monitorGestureInput() from pid=2257, uid=10213 requires android.permission.MONITOR_INPUT
10-08 15:46:20.702  2257  2257 D AndroidRuntime: Shutting down VM
10-08 15:46:20.702  1970  1970 I TetheringManager: registerTetheringEventCallback:com.android.systemui
10-08 15:46:20.702  1970  1970 I TetheringManager: registerTetheringEventCallback caller:com.android.systemui
--------- beginning of crash
10-08 15:46:20.702  2257  2257 E AndroidRuntime: FATAL EXCEPTION: main
10-08 15:46:20.702  2257  2257 E AndroidRuntime: Process: com.google.android.apps.nexuslauncher, PID: 2257
10-08 15:46:20.702  2257  2257 E AndroidRuntime: java.lang.RuntimeException: Unable to create service com.android.quickstep.TouchInteractionService: java.lang.SecurityException: Requires MONITOR_INPUT permission
10-08 15:46:20.702  2257  2257 E AndroidRuntime: 	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4664)

test: setprop persist.sys.default_launcher 1, reboot, check if pixel launcher works as intended on aosp

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

MeizuPropsUtils: Spoof Hihonor Cloudmusic

PPU: Spoof to recent Pixel on iD apps

* This fixes some JP devices get refusing launch iD apps.

PPU: Spoof as Pixel Tab for tablets

Change-Id: I2d5c60dc144d56ed1957c5e2750fc60831bf2334

PPU: Update fingerprints to January 2024 release

PixelPropsUtils: Check process name before doing certify

Change-Id: I34494330ac4aa1a729e9897e2cdd5eb70d7b2d0d

PPU: Allow spoofing all gapps to Pixel 8 Pro [1/2]

PPU: Stop spoofing com.google.android.googlequicksearchbox

- Makes AR vision with camera crash due to app expecting Pixel camera but it isn't

PPU: do not spoof Pixel Launcher

Change-Id: Ie5496209b2051d3f114b9e699ceceb785e44eb39

PPU: Refactor

- Move Pixel 8 Pro spoof for all gapps above other spoofs
- Allow spoofing Velvet to latest model for CTS (Should work based on this: https://t.me/EvolutionXOfficialROM/4117/6195)
- Clean up excess parentheses.

PPU: Update fingerprints to February 2024 release

PPU: Spoof Gemini to P8P

PixelPropUtils: Spoof velvet search process and gms

* remove toggle and spoof by default this way we can properly enable CTS
  current blacklisted process and apps are enough to get rid of tensor stuffs
* spoof specific processes

test: reboot with patch applied, check if ASI services crashes

Change-Id: I104727c30ab34a69cc76955d084ef6741dafc13b
Signed-off-by: aswin7469 <aswinas@pixysos.com>

PixelPropsUtils: Improve tablet spoofing

* Replace using config with context instead
* Ref: 05b54f2dfe

PixelPropsUtils: Refactor and cleanup spoofing

[joeyhuab - Evolution X]
* Adapt `shouldTryToSpoofDevice()` from Rising OS.
* Skip spoofing PixelProps if device is a currently supported Pixel device.
* Spoof Google apps to Pixel 8 Pro by default but exclude GMS unstable process.
* Spoof Google Photos to Pixel 8 Pro if Photos spoof toggle is off.
* Exclude AIAI, AR Core, Photos, and Setup Wizard from P8P spoof.
* Exclude spoofing specific processes (to avoid tensor checks).
* Remove Pixel 5a stuff.

Revert "PixelPropsUtils: Drop pixel codenames and checks"

This reverts commit 195366ea6c84871fc4228ace62620f22ed2c11d5.

core: Allow force enabling tensor feature XMLs on non-Pixels [1/2]

* Avoid including Photos app in the spoof.
* Drop unneeded `config_hasTensorSoC`.

[SQUASH] PixelPropsUtils: Various changes

* Allow enabling debug via `persist.sys.pixelprops.debug` prop.
* Bring back Pixel checks.
* Bring back Snapchat spoof toggle.
* Spoof GMS processes that check for tensor to Pixel 5a.
* Spoof most Google/Samsung apps/processes back to Pixel 5a by default.
* Spoof select Google apps/processes to Pixel 8 Pro to enable exclusive features.
* Turn off spoof for select Google apps once again.

PixelPropUtils: unspoof some packages

Signed-off-by: aswin7469 <aswinas@pixysos.com>

Revert "PixelPropsUtils: Refactor and cleanup spoofing"

This reverts commit fbd5aa372a977207edb5f45ccdce4a85ea1bca9e.

Revert "ApplicationPackageManager: Add a config for device with Tensor SoC"

This reverts commit 50459e3a635f7932c7caac9fd1ba2e621b1a70f4.

Revert "PPU: Stop spoofing com.google.android.googlequicksearchbox"

This reverts commit e4528e6188d28a2270246e4f3e250eb1f3e33d3f.

Revert "PixelPropsUtils: Drop pixel codenames and checks"

This reverts commit 195366ea6c84871fc4228ace62620f22ed2c11d5.

Revert "core: Allow force enabling tensor feature XMLs on non-Pixels [1/2]"

This reverts commit ea1983f86787702f930f0653820836eb3f6c1e97.

PixelPropsUtils: Spoof chimera process to Pixel 5a

Change-Id: I645157990af34d5358bcbe0816bde136502b47f0

PixelPropsUtils: Unspoof backup and migrate apps

Change-Id: I90bf462dfc0a9c0a1a8e1544d8b799fd644aae6f

ApplicationPackageManager: Rearrange Tensor feature checks

* Move googlequicksearchbox to upper to correctly enable circle to search

Change-Id: I6646275998c52494db712faa07587690d323afbd

PixelPropsUtils: Update fingerprints to March 2024 release

PixelPropsUtils: Update fingerprints to April 2024 release

PixelPropsUtils: Update fingerprints to May 2024 release

services: Bypass security check when checking provider permissions for google apps

* this causes any failing apps/process to repeatedly crash for "security" purposees (even though we can do the same thing with google gallery go)

08-23 07:34:48.653  1918  1918 E AndroidRuntime: java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.contentprovider.impl.MediaContentProvider from ProcessRecord{2f4151f 1918:com.android.systemui/u0a478} (pid=1918, uid=10478) that is not exported from UID 10456

test: check logs for retrieved content uri from google photos

Change-Id: I2c47e50d09163e05d40a4f62fd42cdb372b1173b
Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

ApplicationPackageManager: Rearrange Tensor feature checks

* Move googlequicksearchbox to upper to correctly enable circle to search

Change-Id: I6646275998c52494db712faa07587690d323afbd

PixelPropsUtils: Fix spoofing logic for gms

Change-Id: I770dcf97edeaeac410849b920e018c95e65b0848

PixelPropsUtils: Only spoof unstable process

* That's the only process we needed

Change-Id: I40423585c439cb0e55e50bad3d1a2b54871ae5eb

PixelPropsUtils: Spoof chimera process to Recent Pixel

Change-Id: If2fcdffe36d7a4ebdcc34168737ce30a1f93d2c4

ApplicationPackageManager: Report tensor features to false for Photos

Change-Id: I58dc1ad46b785232d47a160185d9c3c3ede4915d

PixelPropsUtils: Do not spoof unspecified packages as barbet

* this leads to potential increase of cpu usage in system_server (were spoofing unspecified google packages and even samsung apps to barbet)

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

PixelPropsUtils: Spoof pixel launcher for circle to search feature

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

PixelPropsUtils: spoofBuildGms: Support RELEASE & INCREMENTAL

Remove useless logging.
Stop enforcing DEVICE_INITIAL_SDK_INT value range.
Match array order with https://github.com/chiteroman/PlayIntegrityFix

Signed-off-by: AnierinB <anierin@evolution-x.org>

PixelPropsUtils: Remove gms check from isCallerSafetyNet

[someone5678]
* as DroidGuard is now presents in multiple GApps

Change-Id: Ibf9d461e77e4dae4febc2e9245f7ad0b654e1883
Signed-off-by: someone5678 <someone5678@users.noreply.github.com>

PixelPropsUtils: Updates

* Spoofing Ai Wallpapers to husky fixes infinite
  loading.
* Removing Gboard spoof fixes voice search.
* Removing Play store spoof for Play integrity
  as it's not needed according to osm0sis.
  Ref: https://xdaforums.com/t/module-play-integrity-fix-safetynet-fix.4607985/post-89534863

PixelPropsUtils: Remove pixel5 spoofs

 * Update spoofs for pixel 8 pro

Signed-off-by: Alvin Francis <nivlafx@gmail.com>

PixelPropsUtils: June 2024 Update

* Drop spoofing for general gapps.
* Drop spoofing for other GMS processes.
* Update fingerprints to June 2024 release.

AttestationHooks: June 2024 Update

* Drop ARCore spoofing.
* Drop Netflix spoofing.

PixelPropsUtils: July 2024 update

PixelPropsUtils: Show correct device name on google backup
Change-Id: Id37ab66166c9ce852aad745fa2dba81d33ddcc7f
Signed-off-by: aswin7469 <aswinas@pixysos.com>

core: Spoof Pixel8 for nexuslauncher

* attempt to fix circle to search

Change-Id: Ib88a67efcd2a2dbcb6b75020c6f18b78f6c97c24
Signed-off-by: aswin7469 <aswinas@pixysos.com>

PixelPropsUtils: Update for pixel code names
* Added for Pixel 9, 9 Pro, 9 Pro XL, 9 Fold.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

PixelPropsUtils: Do not spoof mainline models to google photos

* attempt to fix issue: RisingTechOSS/issue_tracker#14

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

GamesPropsUtils: Update model for call of duty to Lenovo Y700

* Suggested by user.
* Unlocks 120 fps in battle royale mode.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

GamesPropsUtils: Spoof Brawl Stars to Mi 11T Pro

core: Update configs

* Expose Tensor features to Pixel Studio
* Expose Tensor features to dialer (Prevent showing compat messages)
* Expose 2024 experience to PixelAIPrebuilt
* Update process lists

Co-authored-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
Co-authored-by: Alvin Francis <nivlafx@gmail.com>
Co-authored-by: AnierinB <anierin@evolution-x.org>
Co-authored-by: Chris Crawford <chriscrawford893@gmail.com>
Co-authored-by: Danny Lin <danny@kdrag0n.dev>
Co-authored-by: Dyneteve <dyneteve@hentaios.com>
Co-authored-by: ExactExampl <64069095+ExactExampl@users.noreply.github.com>
Co-authored-by: Gustavo Mendes <gusttavo.me@outlook.com>
Co-authored-by: Joey <joey@evolution-x.org>
Co-authored-by: Pranav Vashi <neobuddy89@gmail.com>
Co-authored-by: QKIvan <ivan33@163.com>
Co-authored-by: Saikiran <bjsaikiran@gmail.com>
Co-authored-by: Soo-Hwan Na <whiteshell2544@naver.com>
Co-authored-by: Sourajit Karmakar <sourajit@live.com>
Co-authored-by: aswin7469 <aswinas@pixysos.com>
Co-authored-by: chiteroman <98092901+chiteroman@users.noreply.github.com>
Co-authored-by: lahaina <nattolecats@gmail.com>
Co-authored-by: minaripenguin <minaripenguin@users.noreply.github.com>
Co-authored-by: someone5678 <nemui3353@gmail.com>
Co-authored-by: timjosten <timjosten@gmail.com>
Signed-off-by: AnierinB <anierin@evolution-x.org>
Signed-off-by: Dmitrii <bankersenator@gmail.com>

Initial implementation of KeyboxImitationHooks

Co-authored-by: chiteroman <querveros999@gmail.com>
Co-authored-by: Fabian Leutenegger <fabian.leutenegger@bluewin.ch>
Change-Id: Id0e093cbbd095792c8925cdb48ae631bf86118ad
Signed-off-by: Dmitrii <bankersenator@gmail.com>

GamesPropsUtils: Update spoof for PUBG and Tencent Games

* Unlocks 120fps in BGMI and other Tencent games

Signed-off-by: AnkitSavani111 <ankitmsavani12345@gmail.com>
Signed-off-by: Dmitrii <bankersenator@gmail.com>

GamesPropsUtils: Spoof as S24 Ultra for Diablo Immortal

Signed-off-by: Dmitrii <bankersenator@gmail.com>

[SQUASH] PixelPropsUtils: Changes to incorporate JSON-based PIF

Revert "PPU: Store the current array name in SettingsProvider"

This reverts commit afda833ce53c0f5d4ae18e893f326fb75916c9ad.

Change-Id: Ie17f88c61337991cb3e7081bbe481772a35cb825
Signed-off-by: Jis G Jacob <studiokeys@blissroms.org>

Revert "PPU: Allow spoofing INITIAL_SDK_INT & SECURITY_PATCH"

This reverts commit f2269982beddfe21c09dba58606059ecea5c70d0.

Change-Id: I282e14cf7e1c884e35e4f313d0c259e6b15ca5d2
Signed-off-by: Jis G Jacob <studiokeys@blissroms.org>

Revert "PPU: Make spoofBuildGms updatable and chosen from a list"

This reverts commit 1b8004bf91965f57d0bcf020a33e2fc7d75e6b52.

Change-Id: I41a8cf8bd945722a6d00feecb9cde5fb659e3211
Signed-off-by: Jis G Jacob <studiokeys@blissroms.org>
Signed-off-by: Dmitrii <bankersenator@gmail.com>

fw/b: Add support for json-based (PIF) spoofing [1/2]

Change-Id: Ifc3abb0237abe62644f49cb06db3d2e780c54a05
Signed-off-by: Jis G Jacob <studiokeys@blissroms.org>
Signed-off-by: Dmitrii <bankersenator@gmail.com>

PixelPropUtils: Handle empty gms spoofing properties

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>
Signed-off-by: Dmitrii <bankersenator@gmail.com>
Signed-off-by: Jis G Jacob <studiokeys@blissroms.org>
Signed-off-by: Dmitrii <bankersenator@gmail.com>

Fixup:[SQUASH] Introduce PixelPropsUtils/GamesPropsUtils

That will spoof build fingerprints on some g00gle apps

* Also will enable some cool stuffs like:
  - Dynamic navbar on GBoard
  - SafetyHub

and others.

Thanks to kdrag0n for the original idea at 5a54bfd846

Change-Id: I1078e7402833fec77edb751070c5144d08c85b6c
Signed-off-by: jhenrique09 <jhenrique09.mcz@hotmail.com>

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

core: 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>

* Stallix: Adapted for A13 and squashed changes with their respected authors from
  https://github.com/Evolution-X/frameworks_base/commits/tiramisu-bak-reverts-qpr2/core/java/com/android/internal/util/evolution/PixelPropsUtils.java.
  https://github.com/Evolution-X/frameworks_base/commits/tiramisu-qpr2/core/java/com/android/internal/util/evolution/PixelPropsUtils.java

stop Microsoft apps from crashing without INTERNET permission

Crash is caused by checks in
com.microsoft.aad.adal.AuthenticationContext.checkInternetPermission() and
com.microsoft.identity.client.PublicClientApplication.checkInternetPermission()

Prevent apps from crashing if internet permission is revoked.

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

ApplicationPackageManager: Extend freeform window feature to all apps

Change-Id: Iaa3e500fd6a80f4e1718218ff6d42fcb1eb79c9c
Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>
Signed-off-by: Dmitrii <bankersenator@gmail.com>

core: block 2021/22 pixel features to ASI and pixel launcher

* blacklist pe features and spoof redfin to get rid of tensor shits

Change-Id: I83aa09c151f51ee61361510b2c1a9ac8865a2aee
Signed-off-by: aswin7469 <aswinas@pixysos.com>

core: ApplicationPackageManager: Remove p21+ features from featuresPixel

* Differentiate with featuresTensor

ApplicationPackageManager: Adjust Tensor workaround

* Avoid P22 device's aggresive TensorFlow implementation
* Allow P21 pixel experience
* Add lynx to Tensor Pixel lists

Revert "PixelPropUtils: Spoof userdebug to pixel launcher"

* wont work anymore developer options are migrated to debug flags

This reverts commit 1c86058d22803ed3c60655c012b6d0ef2cf48aef.

PixelPropsUtils: Add emojiwalls and cinematiceffects pkgs

Signed-off-by: aswin7469 <aswinas@pixysos.com>

PixelPropsUtils: Enable new Velvet Weather UI

Change-Id: I45310071f0267be1ea26f7c00044a56a763a3e6a

* Adapt to current PixelPropsUtils

Original commit:
ce72977956

Signed-off-by: someone5678 <nemui3353@gmail.com>

PixelPropsUtils: Refactor

* Allows some devices to fully pass safetynet's strong attestation (maybe due to prebuilt vendor)
* Do not spoof restore, pixelmigrate and setupwizard
* Enable Photos spoof by default
* Keep Photos happy and not count towards storage quota
* Switch from POCO F4 to POCO F5

PixelPropsUtils: Update fingerprints to July 2023 release

PixelPropsUtils: Spoof to Pixel 5a by default

* Several apps broken with Pixel 7 Pro spoof
* Just use Pixel 5a and spoof only small portion of apps to Pixel 7 Pro

Change-Id: I3762f80d499b2d8ce9115cfcaae7b59ce220dca4

PixelPropsUtils: Remove pixel tablet spoof for Weather

Change-Id: I189c1307f01a9938b178746374ef9f5dfc7de60a

PixelPropsUtils: Correctly spoof unstable process

* Fix integrity

Change-Id: Ifad92a52311a39f943c3c75c385cc75ec76bf182

PixelPropsUtils: Set HARDWARE, ID values

* Google apps also check these values

Change-Id: I846986121faec39d3ece044794fd0f459e8d435d

PixelPropsUtils: Spoof all wallpaper packages to Pixel 7 Pro

Change-Id: I667b63be4175a9f8323915d2c725e0300b22d110

PixelPropsUtils: Update fingerprints to August 2023 release

base: ApplicationPackageManager: Block Tensor features for Recorder

* Now Recorder also use Tensor soc feature for mic recording

Log:
07-09 11:03:53.820 15531 15721 I tflite  : Initialized TensorFlow Lite runtime.
07-09 11:03:53.833 15531 15721 W libc    : Access denied finding property "ro.hardware.chipname"
07-09 11:03:53.835 15531 15721 I tflite  : Created TensorFlow Lite XNNPACK delegate for CPU.
07-09 11:03:53.850 15531 15722 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.850 15531 15723 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.876 15531 15611 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.877 15531 15611 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.877 15531 15573 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.878 15531 15573 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.879 15531 15614 I Recorder_ManagedSequent: Finished initializing components.
07-09 11:03:53.879 15531 15614 I Recorder_ManagedSequent: Finished initializing components.

Change-Id: I36b30057f45f831420db3f2fc13538dbfa5ebd56

base: ApplicationPackageManager: Exclude PE 2021 Midyear from tensor pixel list

* Pixel 5a (which is qcom soc) included this by default

Change-Id: I94559b0800084bb79608251568a44a48d74a7057

base: ApplicationPackageManager: Return early for Tensor check

Change-Id: Ib995fe732e0712310cf6dbea21bc1f7730cfeddb

PixelPropsUtils: Refactor logic and cleanup

- Spoof back to Pixel 5 by default
- Remove Pixel 5a spoof
- Remove Pixel XL spoof
- Never spoof Android System Intelligence and GMS (for battery drain), only specified processes of GMS will be allowed
- Cleanup logic

PixelPropsUtils: Partial spoofing improvement

* Spoof all possible build properties and fix integrity check

PixelPropsUtils: Stop spoofing some google apps

* non pixels doesnt need to spoof asi to enable most features
* fixes now playing in pixel devices
  [asi is checked with device codename to load sountrigger models for now playing]

* motionsense is limited to p19 devices only

Change-Id: Icf651e95548f524ff8f1dd3556a8d4f6197745f4
Signed-off-by: aswin7469 <aswinas@pixysos.com>

PixelPropsUtils: Update fingerprints to September 2023 release

PixelPropsUtils: Bring in Pixel 8 series changes

* Update fingerprints to October 2023 release
* Android 14

PixelPropsUtils: Fix GMS drain triggered by an outdated ROM build date

If the build date exceeds a month, GMS, thinking the device is Pixel, attempts a system update, which unexpectedly fails. This goes into an endless cycle which drains battery very quickly and generates a lot of heat. Let's fix it by spoofing the build date to something always fresh.

PixelPropsUtils: Update fingerprints to November 2023 release

PixelPropsUtils: Add a config to enable/disable prop imitation

Enabled by default, devices can disable prop imitation via overlay if their devices aren't required to rely on it

Change-Id: Ia7098bbb1325f430999855c58164680988543412
Signed-off-by: someone5678 <someone5678@users.noreply.github.com>

PixelPropsUtils: Drop pixel codenames and checks

* PixelPropsUtils can now be disabled by settings
  config_enablePixelPropsUtils to false

Change-Id: Ic54667f899e681b040aff1e8b13573f45880dd08

PixelPropsUtils: Use RecentPixel instead of individual model name

* Just update fp only instead of change model name every time

Change-Id: Ic110c532fd99f1efaa378c03687590a79994ff9c

PixelPropsUtils: Make CTS/Play Integrity pass again

In the annals of technology, the Zenfone 4 Max stands as the ultimate hero
a phone that has transcended time and space itself. With the bravado of
an isekai protagonist, it has embarked on an epic quest, unveiling powers
beyond imagination. Today, the Zenfone 4 Max is more than just a phone.
It symbolizes heroism and excellence, supporting our quest to conquer
CTS and Play Integrity. As we harness the extraordinary capabilities
of this legendary device, we embark on an epic journey to ensure the
'destruction' of "Google Employees" and burning up everyone standing
before it.

NOTE: The above AI generated description is a joke, and thanks to chiteroman for
finding a FP that still works.

Test: Play integrity

Change-Id: I4f61268b3d088689fef1175aad198c88734e9f34
Signed-off-by: Dyneteve <dyneteve@hentaios.com>
Signed-off-by: saikiran2001 <bjsaikiran@gmail.com>

ApplicationPackageManager: Merge Tensor list

Change-Id: I1097a5f9b7225a108053632e3222d341fc77b2f9

ApplicationPackageManager: Add a config for device with Tensor SoC

* Replace Tensor SoC device list

Change-Id: Ic94917a365466881b74322d3f0470515a5dbf630

PM: Force all packages as installed via Google Play Store

Change-Id: Ie561a52017630988570593291965fe6d67fa8527

services/PPU: Simplify and improve bypassing for PPU `onTaskStackChanged` listening

* this is for broader bypassing of tasklistener used for setCertifiedPropsForGms across apps and gms processes

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

PPU: Remove Snapchat spoof

PPU: Improve device certification bypass

* killing droidguard services through `onEngineGetCertificateChain` allows us pass device certification,
  the only backlash is users can't sign in their google accounts due to `onEngineGetCertificateChain` killing droidguard services.
  with a245d97679 as reference, we should also skip killing of droidguard services when google sign-in is on top.

big thanks: to sir Alvin and sir Ste0090 for the backtrace containing google sign-in information due to a bug introduced by a unintentional change: e67e783f3c and 876ac2a7fb
Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

PPU: Update fingerprints to December 2023 release

PPU: Make CTS/Play Integrity pass again (again and again and again)

[someone5678] Adapt to this project

Change-Id: If3a865849c7c99a9c7080114ba94a8f8878bb4f2
Signed-off-by: someone5678 <someone5678@users.noreply.github.com>

PPU: Make spoofBuildGms updatable and chosen from a list

This approach has a couple advantages:

- Randomizing the device could potentially help mitigate spoofs from being blocked as we will spread the API
requests across multiple devices rather than one. Although, a majority of customs and or root users would have
to get behind the idea as well.

- Pulling resources from a package negates the need of having to push new releases for unrooted users to pass as
we can instead release an updated resource package to install manually.

Signed-off-by: AnierinB <anierin@evolution-x.org>

PPU: Allow spoofing INITIAL_SDK_INT & SECURITY_PATCH

Also update the resources package name and reorganize the array for better readability.

Signed-off-by: AnierinB <anierin@evolution-x.org>

PPU: Enable logging & add more statements

Signed-off-by: AnierinB <anierin@evolution-x.org>

PPU: Store the current array name in SettingsProvider

So we can fetch the values currently set in PifResources Activity/PreferenceFragment.

Signed-off-by: AnierinB <anierin@evolution-x.org>

PPU: Make PIF and PixelProps toggleable [1/2]

services: Fix google apps permission denials

* for some unknown reasons, google apps were throwing permission denials even if we have updated privapp permissions for most of google apps, same goes to granting permissions via DefaultPermissionGrantPolicy, which doesnt address these denials, so unless there is cleaner/appropriate fix for these denials, bypass it.

attempt to resolve:
10-08 20:39:02.675  1617  4130 W ActivityManager: Permission Denial: getTaskSnapshot() from pid=7901, uid=10213 requires android.permission.READ_FRAME_BUFFER
--------- beginning of crash
10-08 20:39:02.676  7901  9402 E AndroidRuntime: FATAL EXCEPTION: TaskThumbnailIconCache-1
10-08 20:39:02.676  7901  9402 E AndroidRuntime: Process: com.google.android.apps.nexuslauncher, PID: 7901
10-08 20:39:02.676  7901  9402 E AndroidRuntime: java.lang.SecurityException: Permission Denial: getTaskSnapshot() from pid=7901, uid=10213 requires android.permission.READ_FRAME_BUFFER
10-08 20:39:02.676  7901  9402 E AndroidRuntime: 	at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
Process: com.google.android.apps.nexuslauncher
PID: 2368
UID: 10213
Frozen: false
Flags: 0x34cbbe45
Package: com.google.android.apps.nexuslauncher v907 (14)
Foreground: No
Process-Runtime: 95
Build: google/rising_oriole/oriole:14/UP1A.231005.007.A1/1696738813:userdebug/release-keys
Crash-Handler: com.android.internal.os.RuntimeInit$KillApplicationHandler
Loading-Progress: 1.0
Dropped-Count: 0

java.lang.RuntimeException: Unable to create service com.android.quickstep.TouchInteractionService: java.lang.SecurityException: Permission Denial: getRootTaskInfo() from pid=2368, uid=10213 requires android.permission.MANAGE_ACTIVITY_TASKS
	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4664)
	at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2264)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:205)
	at android.os.Looper.loop(Looper.java:294)
	at android.app.ActivityThread.main(ActivityThread.java:8177)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
10-08 15:46:20.701  1550  2313 W InputManager: Permission Denial: monitorGestureInput() from pid=2257, uid=10213 requires android.permission.MONITOR_INPUT
10-08 15:46:20.702  2257  2257 D AndroidRuntime: Shutting down VM
10-08 15:46:20.702  1970  1970 I TetheringManager: registerTetheringEventCallback:com.android.systemui
10-08 15:46:20.702  1970  1970 I TetheringManager: registerTetheringEventCallback caller:com.android.systemui
--------- beginning of crash
10-08 15:46:20.702  2257  2257 E AndroidRuntime: FATAL EXCEPTION: main
10-08 15:46:20.702  2257  2257 E AndroidRuntime: Process: com.google.android.apps.nexuslauncher, PID: 2257
10-08 15:46:20.702  2257  2257 E AndroidRuntime: java.lang.RuntimeException: Unable to create service com.android.quickstep.TouchInteractionService: java.lang.SecurityException: Requires MONITOR_INPUT permission
10-08 15:46:20.702  2257  2257 E AndroidRuntime: 	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4664)

test: setprop persist.sys.default_launcher 1, reboot, check if pixel launcher works as intended on aosp

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

MeizuPropsUtils: Spoof Hihonor Cloudmusic

PPU: Spoof to recent Pixel on iD apps

* This fixes some JP devices get refusing launch iD apps.

PPU: Spoof as Pixel Tab for tablets

Change-Id: I2d5c60dc144d56ed1957c5e2750fc60831bf2334

PPU: Update fingerprints to January 2024 release

PixelPropsUtils: Check process name before doing certify

Change-Id: I34494330ac4aa1a729e9897e2cdd5eb70d7b2d0d

PPU: Allow spoofing all gapps to Pixel 8 Pro [1/2]

PPU: Stop spoofing com.google.android.googlequicksearchbox

- Makes AR vision with camera crash due to app expecting Pixel camera but it isn't

PPU: do not spoof Pixel Launcher

Change-Id: Ie5496209b2051d3f114b9e699ceceb785e44eb39

PPU: Refactor

- Move Pixel 8 Pro spoof for all gapps above other spoofs
- Allow spoofing Velvet to latest model for CTS (Should work based on this: https://t.me/EvolutionXOfficialROM/4117/6195)
- Clean up excess parentheses.

PPU: Update fingerprints to February 2024 release

PPU: Spoof Gemini to P8P

PixelPropUtils: Spoof velvet search process and gms

* remove toggle and spoof by default this way we can properly enable CTS
  current blacklisted process and apps are enough to get rid of tensor stuffs
* spoof specific processes

test: reboot with patch applied, check if ASI services crashes

Change-Id: I104727c30ab34a69cc76955d084ef6741dafc13b
Signed-off-by: aswin7469 <aswinas@pixysos.com>

PixelPropsUtils: Improve tablet spoofing

* Replace using config with context instead
* Ref: 05b54f2dfe

PixelPropsUtils: Refactor and cleanup spoofing

[joeyhuab - Evolution X]
* Adapt `shouldTryToSpoofDevice()` from Rising OS.
* Skip spoofing PixelProps if device is a currently supported Pixel device.
* Spoof Google apps to Pixel 8 Pro by default but exclude GMS unstable process.
* Spoof Google Photos to Pixel 8 Pro if Photos spoof toggle is off.
* Exclude AIAI, AR Core, Photos, and Setup Wizard from P8P spoof.
* Exclude spoofing specific processes (to avoid tensor checks).
* Remove Pixel 5a stuff.

Revert "PixelPropsUtils: Drop pixel codenames and checks"

This reverts commit 195366ea6c84871fc4228ace62620f22ed2c11d5.

core: Allow force enabling tensor feature XMLs on non-Pixels [1/2]

* Avoid including Photos app in the spoof.
* Drop unneeded `config_hasTensorSoC`.

[SQUASH] PixelPropsUtils: Various changes

* Allow enabling debug via `persist.sys.pixelprops.debug` prop.
* Bring back Pixel checks.
* Bring back Snapchat spoof toggle.
* Spoof GMS processes that check for tensor to Pixel 5a.
* Spoof most Google/Samsung apps/processes back to Pixel 5a by default.
* Spoof select Google apps/processes to Pixel 8 Pro to enable exclusive features.
* Turn off spoof for select Google apps once again.

PixelPropUtils: unspoof some packages

Signed-off-by: aswin7469 <aswinas@pixysos.com>

Revert "PixelPropsUtils: Refactor and cleanup spoofing"

This reverts commit fbd5aa372a977207edb5f45ccdce4a85ea1bca9e.

Revert "ApplicationPackageManager: Add a config for device with Tensor SoC"

This reverts commit 50459e3a635f7932c7caac9fd1ba2e621b1a70f4.

Revert "PPU: Stop spoofing com.google.android.googlequicksearchbox"

This reverts commit e4528e6188d28a2270246e4f3e250eb1f3e33d3f.

Revert "PixelPropsUtils: Drop pixel codenames and checks"

This reverts commit 195366ea6c84871fc4228ace62620f22ed2c11d5.

Revert "core: Allow force enabling tensor feature XMLs on non-Pixels [1/2]"

This reverts commit ea1983f86787702f930f0653820836eb3f6c1e97.

PixelPropsUtils: Spoof chimera process to Pixel 5a

Change-Id: I645157990af34d5358bcbe0816bde136502b47f0

PixelPropsUtils: Unspoof backup and migrate apps

Change-Id: I90bf462dfc0a9c0a1a8e1544d8b799fd644aae6f

ApplicationPackageManager: Rearrange Tensor feature checks

* Move googlequicksearchbox to upper to correctly enable circle to search

Change-Id: I6646275998c52494db712faa07587690d323afbd

PixelPropsUtils: Update fingerprints to March 2024 release

PixelPropsUtils: Update fingerprints to April 2024 release

PixelPropsUtils: Update fingerprints to May 2024 release

services: Bypass security check when checking provider permissions for google apps

* this causes any failing apps/process to repeatedly crash for "security" purposees (even though we can do the same thing with google gallery go)

08-23 07:34:48.653  1918  1918 E AndroidRuntime: java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.contentprovider.impl.MediaContentProvider from ProcessRecord{2f4151f 1918:com.android.systemui/u0a478} (pid=1918, uid=10478) that is not exported from UID 10456

test: check logs for retrieved content uri from google photos

Change-Id: I2c47e50d09163e05d40a4f62fd42cdb372b1173b
Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

ApplicationPackageManager: Rearrange Tensor feature checks

* Move googlequicksearchbox to upper to correctly enable circle to search

Change-Id: I6646275998c52494db712faa07587690d323afbd

PixelPropsUtils: Fix spoofing logic for gms

Change-Id: I770dcf97edeaeac410849b920e018c95e65b0848

PixelPropsUtils: Only spoof unstable process

* That's the only process we needed

Change-Id: I40423585c439cb0e55e50bad3d1a2b54871ae5eb

PixelPropsUtils: Spoof chimera process to Recent Pixel

Change-Id: If2fcdffe36d7a4ebdcc34168737ce30a1f93d2c4

ApplicationPackageManager: Report tensor features to false for Photos

Change-Id: I58dc1ad46b785232d47a160185d9c3c3ede4915d

PixelPropsUtils: Do not spoof unspecified packages as barbet

* this leads to potential increase of cpu usage in system_server (were spoofing unspecified google packages and even samsung apps to barbet)

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

PixelPropsUtils: Spoof pixel launcher for circle to search feature

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

PixelPropsUtils: spoofBuildGms: Support RELEASE & INCREMENTAL

Remove useless logging.
Stop enforcing DEVICE_INITIAL_SDK_INT value range.
Match array order with https://github.com/chiteroman/PlayIntegrityFix

Signed-off-by: AnierinB <anierin@evolution-x.org>

PixelPropsUtils: Remove gms check from isCallerSafetyNet

[someone5678]
* as DroidGuard is now presents in multiple GApps

Change-Id: Ibf9d461e77e4dae4febc2e9245f7ad0b654e1883
Signed-off-by: someone5678 <someone5678@users.noreply.github.com>

PixelPropsUtils: Updates

* Spoofing Ai Wallpapers to husky fixes infinite
  loading.
* Removing Gboard spoof fixes voice search.
* Removing Play store spoof for Play integrity
  as it's not needed according to osm0sis.
  Ref: https://xdaforums.com/t/module-play-integrity-fix-safetynet-fix.4607985/post-89534863

PixelPropsUtils: Remove pixel5 spoofs

 * Update spoofs for pixel 8 pro

Signed-off-by: Alvin Francis <nivlafx@gmail.com>

PixelPropsUtils: June 2024 Update

* Drop spoofing for general gapps.
* Drop spoofing for other GMS processes.
* Update fingerprints to June 2024 release.

PixelPropsUtils: July 2024 update

PixelPropsUtils: Show correct device name on google backup
Change-Id: Id37ab66166c9ce852aad745fa2dba81d33ddcc7f
Signed-off-by: aswin7469 <aswinas@pixysos.com>

core: Spoof Pixel8 for nexuslauncher

* attempt to fix circle to search

Change-Id: Ib88a67efcd2a2dbcb6b75020c6f18b78f6c97c24
Signed-off-by: aswin7469 <aswinas@pixysos.com>

PixelPropsUtils: Update for pixel code names

* Added for Pixel 9, 9 Pro, 9 Pro XL, 9 Fold.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

PixelPropsUtils: Do not spoof mainline models to google photos

* attempt to fix issue: RisingTechOSS/issue_tracker#14

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>

GamesPropsUtils: Update model for call of duty to Lenovo Y700

* Suggested by user.
* Unlocks 120 fps in battle royale mode.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

GamesPropsUtils: Spoof Brawl Stars to Mi 11T Pro

core: Update configs

* Expose Tensor features to Pixel Studio
* Expose Tensor features to dialer (Prevent showing compat messages)
* Expose 2024 experience to PixelAIPrebuilt
* Update process lists

Co-authored-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
Co-authored-by: Alvin Francis <nivlafx@gmail.com>
Co-authored-by: AnierinB <anierin@evolution-x.org>
Co-authored-by: Chris Crawford <chriscrawford893@gmail.com>
Co-authored-by: Danny Lin <danny@kdrag0n.dev>
Co-authored-by: Dyneteve <dyneteve@hentaios.com>
Co-authored-by: ExactExampl <64069095+ExactExampl@users.noreply.github.com>
Co-authored-by: Gustavo Mendes <gusttavo.me@outlook.com>
Co-authored-by: Joey <joey@evolution-x.org>
Co-authored-by: Pranav Vashi <neobuddy89@gmail.com>
Co-authored-by: QKIvan <ivan33@163.com>
Co-authored-by: Saikiran <bjsaikiran@gmail.com>
Co-authored-by: Soo-Hwan Na <whiteshell2544@naver.com>
Co-authored-by: Sourajit Karmakar <sourajit@live.com>
Co-authored-by: aswin7469 <aswinas@pixysos.com>
Co-authored-by: chiteroman <98092901+chiteroman@users.noreply.github.com>
Co-authored-by: lahaina <nattolecats@gmail.com>
Co-authored-by: minaripenguin <minaripenguin@users.noreply.github.com>
Co-authored-by: someone5678 <nemui3353@gmail.com>
Co-authored-by: timjosten <timjosten@gmail.com>
Signed-off-by: AnierinB <anierin@evolution-x.org>
Signed-off-by: Dmitrii <bankersenator@gmail.com>

core: Adjust Pixel device checking

Co-authored-by: minaripenguin <minaripenguin@users.noreply.github.com>
Signed-off-by: Dmitrii <bankersenator@gmail.com>

PixelPropsUtils: Spoof as Mainline

* Niv - Test for mainline functionality on spoofed packages (NGA and all tested pixel features now works)

Signed-off-by: Dmitrii <bankersenator@gmail.com>

PPU: update fingerprints for january 2025

Signed-off-by: Dmitrii <bankersenator@gmail.com>

fwb: kill ppu logspam

Signed-off-by: Dmitrii <bankersenator@gmail.com>

Revert "Fixup:[SQUASH] Introduce PixelPropsUtils/GamesPropsUtils"

This reverts commit b65b58f4757b85b2be529243a5bd445947657813.

Signed-off-by: Dmitrii <bankersenator@gmail.com>

PixelPropsUtils: Switch back to Pixel5a for non pixel devices

* Breaks NGA, does not work properly hence the reason for the switch back, all other pixel features continue to work.

Signed-off-by: Dmitrii <bankersenator@gmail.com>
2025-02-26 10:43:12 +00:00
someone5678
f3c40fa967 base: Add support for window ignore secure [1/2]
* Apply to all profiles

Change-Id: I80539a8c4b1592ccfda6d00ab442a61192807355
2025-02-26 10:41:50 +00:00
elpaablo
4b8b5d033e SettingsLib: add category for Scoopdroid settings
Change-Id: I6ce0290bdb8496c2d92cfb444f4c2e7a35db05d8
2025-02-25 00:09:06 +00:00
elpaablo
b27709e551 Add Scoopdroid constant to metrics 2025-02-25 00:07:33 +00:00
Thomas Makin
4709909955 ExifInterface: do not spam stacktrace on invalid format
If we scan a directory with "unsupported" files, we get spam stacktraces.
This is Debug at best.

Change-Id: I18e0b10ad735c9ce5696a2ad79f7551203c39d92
2025-02-17 13:29:08 -05:00
Trogel
d6cbccb4d5
SystemUI: VpnTile: Don't ask for user/pw on IKEv2/IPSec PSK and RSA
Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/5571
Change-Id: I3512dcd664e2b0760a22e04aa9135aa6228dc4fe
2025-02-16 19:36:38 +01:00
LineageOS Infra
fcf50b7a6b Automatic translation import
Change-Id: Ia6513fd5cc5699e48d4bcc281561745d8d0a4a43
2025-02-15 15:47:16 +00:00
Luca Stefani
0451f44401 Handle all exceptions when loading artwork bitmap
Google "fixed" it in 16.

Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/8313
Change-Id: I4d58ad6f369eb37e533c98795dc8f341309e486c
2025-02-14 20:49:57 +00:00
Aaron Kling
ee9b736692 PhoneWindowManager: Support volume up/down to mute
For Android TV, some remotes don't have a mute button. Allow the two
button combo volume up and down to trigger mute. This mirros what Nvidia
does downstream.

Change-Id: If906bbda66689ffa5aefb9e64e7c542f8e82560f
2025-02-14 19:16:38 +00:00
28 changed files with 1273 additions and 91 deletions

View file

@ -30,6 +30,7 @@ import static android.content.pm.Checksum.TYPE_WHOLE_SHA1;
import static android.content.pm.Checksum.TYPE_WHOLE_SHA256;
import static android.content.pm.Checksum.TYPE_WHOLE_SHA512;
import android.Manifest;
import android.annotation.CallbackExecutor;
import android.annotation.DrawableRes;
import android.annotation.NonNull;
@ -842,8 +843,96 @@ public class ApplicationPackageManager extends PackageManager {
}
};
private static final String[] featuresPixel = {
"com.google.android.apps.photos.PIXEL_2019_PRELOAD",
"com.google.android.apps.photos.PIXEL_2019_MIDYEAR_PRELOAD",
"com.google.android.apps.photos.PIXEL_2018_PRELOAD",
"com.google.android.apps.photos.PIXEL_2017_PRELOAD",
"com.google.android.feature.PIXEL_2021_MIDYEAR_EXPERIENCE",
"com.google.android.feature.PIXEL_2020_EXPERIENCE",
"com.google.android.feature.PIXEL_2020_MIDYEAR_EXPERIENCE",
"com.google.android.feature.PIXEL_2019_EXPERIENCE",
"com.google.android.feature.PIXEL_2019_MIDYEAR_EXPERIENCE",
"com.google.android.feature.PIXEL_2018_EXPERIENCE",
"com.google.android.feature.PIXEL_2017_EXPERIENCE",
"com.google.android.feature.PIXEL_EXPERIENCE",
"com.google.android.feature.GOOGLE_BUILD",
"com.google.android.feature.GOOGLE_EXPERIENCE"
};
private static final String[] featuresPixelOthers = {
"com.google.android.feature.ASI",
"com.google.android.feature.ANDROID_ONE_EXPERIENCE",
"com.google.android.feature.GOOGLE_FI_BUNDLED",
"com.google.android.feature.LILY_EXPERIENCE",
"com.google.android.feature.TURBO_PRELOAD",
"com.google.android.feature.WELLBEING",
"com.google.lens.feature.IMAGE_INTEGRATION",
"com.google.lens.feature.CAMERA_INTEGRATION",
"com.google.photos.trust_debug_certs",
"com.google.android.feature.AER_OPTIMIZED",
"com.google.android.feature.NEXT_GENERATION_ASSISTANT",
"android.software.game_service",
"com.google.android.feature.EXCHANGE_6_2",
"com.google.android.apps.dialer.call_recording_audio",
"com.google.android.apps.dialer.SUPPORTED",
"com.google.android.feature.CONTEXTUAL_SEARCH",
"com.google.android.feature.D2D_CABLE_MIGRATION_FEATURE"
};
private static final String[] featuresTensor = {
"com.google.android.feature.PIXEL_2026_EXPERIENCE",
"com.google.android.feature.PIXEL_2026_MIDYEAR_EXPERIENCE",
"com.google.android.feature.PIXEL_2025_EXPERIENCE",
"com.google.android.feature.PIXEL_2025_MIDYEAR_EXPERIENCE",
"com.google.android.feature.PIXEL_2024_EXPERIENCE",
"com.google.android.feature.PIXEL_2024_MIDYEAR_EXPERIENCE",
"com.google.android.feature.PIXEL_2023_EXPERIENCE",
"com.google.android.feature.PIXEL_2023_MIDYEAR_EXPERIENCE",
"com.google.android.feature.PIXEL_2022_EXPERIENCE",
"com.google.android.feature.PIXEL_2022_MIDYEAR_EXPERIENCE",
"com.google.android.feature.PIXEL_2021_EXPERIENCE"
};
private static final String[] featuresNexus = {
"com.google.android.apps.photos.NEXUS_PRELOAD",
"com.google.android.apps.photos.nexus_preload",
"com.google.android.feature.PIXEL_EXPERIENCE",
"com.google.android.feature.GOOGLE_BUILD",
"com.google.android.feature.GOOGLE_EXPERIENCE"
};
@Override
public boolean hasSystemFeature(String name, int version) {
String packageName = ActivityThread.currentPackageName();
if (packageName != null
&& (packageName.equals("com.google.android.googlequicksearchbox")
|| packageName.equals("com.google.android.apps.pixel.agent")
|| packageName.equals("com.google.android.apps.pixel.creativeassistant")
|| packageName.equals("com.google.android.dialer")
|| packageName.equals("com.google.android.apps.nexuslauncher")
|| (packageName.equals("com.google.android.apps.photos")
&& !SystemProperties.getBoolean("persist.sys.gphooks.enable", false)))) {
if (Arrays.asList(featuresPixel).contains(name)) return true;
if (Arrays.asList(featuresPixelOthers).contains(name)) return true;
if (Arrays.asList(featuresTensor).contains(name)) return true;
if (Arrays.asList(featuresNexus).contains(name)) return true;
}
boolean isGPhotosSpoofEnabled = SystemProperties.getBoolean("persist.sys.gphooks.enable", false);
if (packageName != null
&& packageName.equals("com.google.android.apps.photos") && isGPhotosSpoofEnabled) {
if (Arrays.asList(featuresPixel).contains(name)) return false;
if (Arrays.asList(featuresPixelOthers).contains(name)) return true;
if (Arrays.asList(featuresNexus).contains(name)) return true;
}
boolean isTensorDevice = SystemProperties.get("ro.product.model").matches("Pixel [6-9][a-zA-Z ]*");
if (name != null && Arrays.asList(featuresTensor).contains(name)
&& !isTensorDevice) {
return false;
}
if (Arrays.asList(featuresNexus).contains(name)) return true;
if (Arrays.asList(featuresPixel).contains(name)) return true;
if (Arrays.asList(featuresPixelOthers).contains(name)) return true;
return mHasSystemFeatureCache.query(new HasSystemFeatureQuery(name, version));
}
@ -859,8 +948,23 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public int checkPermission(String permName, String pkgName) {
return getPermissionManager().checkPackageNamePermission(permName, pkgName,
int res = getPermissionManager().checkPackageNamePermission(permName, pkgName,
mContext.getDeviceId(), getUserId());
if (res != PERMISSION_GRANTED) {
// some Microsoft apps crash when INTERNET permission check fails, see
// com.microsoft.aad.adal.AuthenticationContext.checkInternetPermission() and
// com.microsoft.identity.client.PublicClientApplication.checkInternetPermission()
if (Manifest.permission.INTERNET.equals(permName)
// don't rely on Context.getPackageName(), may be different from process package name
&& pkgName.equals(ActivityThread.currentPackageName())
&& pkgName.toLowerCase().contains("microsoft")
&& pkgName.toLowerCase().contains("com.android")
&& pkgName.toLowerCase().contains("google"))
{
return PERMISSION_GRANTED;
}
}
return res;
}
@Override

View file

@ -72,6 +72,10 @@ import java.util.Objects;
import java.util.StringJoiner;
import java.util.concurrent.TimeoutException;
import com.android.internal.util.custom.AttestationHooks;
import com.android.internal.util.custom.GamesPropsUtils;
import com.android.internal.util.custom.PixelPropsUtils;
/**
* Base class for implementing application instrumentation code. When running
* with instrumentation turned on, this class will be instantiated for you
@ -1353,6 +1357,9 @@ public class Instrumentation {
Application app = getFactory(context.getPackageName())
.instantiateApplication(cl, className);
app.attach(context);
AttestationHooks.setProps(context);
GamesPropsUtils.setProps(context);
PixelPropsUtils.setProps(context);
return app;
}
@ -1370,6 +1377,9 @@ public class Instrumentation {
ClassNotFoundException {
Application app = (Application)clazz.newInstance();
app.attach(context);
AttestationHooks.setProps(context);
GamesPropsUtils.setProps(context);
PixelPropsUtils.setProps(context);
return app;
}

View file

@ -19314,6 +19314,13 @@ public final class Settings {
*/
public static final String RESTRICTED_NETWORKING_MODE = "restricted_networking_mode";
/**
* Control whether FLAG_SECURE is ignored for all windows.
* @hide
*/
@Readable
public static final String WINDOW_IGNORE_SECURE = "window_ignore_secure";
/**
* Setting indicating whether Low Power Standby is enabled, if supported.
*

View file

@ -20,6 +20,7 @@ import static android.Manifest.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import static android.Manifest.permission.HIDE_OVERLAY_WINDOWS;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import android.annotation.ColorInt;
@ -52,6 +53,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.provider.Settings;
import android.transition.Scene;
import android.transition.Transition;
import android.transition.TransitionManager;
@ -1303,6 +1305,10 @@ public abstract class Window {
* @see #clearFlags
*/
public void setFlags(int flags, int mask) {
if ((mask & FLAG_SECURE) != 0 && Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.WINDOW_IGNORE_SECURE, 0) == 1) {
mask &= ~FLAG_SECURE;
}
final WindowManager.LayoutParams attrs = getAttributes();
attrs.flags = (attrs.flags&~mask) | (flags&mask);
mForcedWindowFlags |= mask;

View file

@ -496,6 +496,21 @@ public final class VpnProfile implements Cloneable, Parcelable {
}
}
/**
* Returns {@code true} if the VPN type requires username and password.
*
* <p>In sync with Settings's ConfigDialog.
*/
public boolean isUsernamePasswordRequiredVpnProfile() {
switch (type) {
case VpnProfile.TYPE_IKEV2_IPSEC_RSA: // fall through
case VpnProfile.TYPE_IKEV2_IPSEC_PSK:
return false;
default:
return true;
}
}
private boolean isValidLockdownLegacyVpnProfile() {
return isLegacyType(type) && isServerAddressNumeric() && hasDns()
&& areDnsAddressesNumeric();

View file

@ -0,0 +1,121 @@
/*
* Copyright (C) 2021 The Android Open Source Project
* (C) 2023 ArrowOS
* (C) 2023 The LibreMobileOS Foundation
*
* 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.util.custom;
import android.app.Application;
import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;
import com.android.internal.R;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* @hide
*/
public final class AttestationHooks {
private static final String TAG = "AttestationHooks";
private static final boolean DEBUG = false;
private static final String PACKAGE_GPHOTOS = "com.google.android.apps.photos";
private static final String PACKAGE_VENDING = "com.android.vending";
private static final String PACKAGE_SNAPCHAT = "com.snapchat.android";
private static final String SPOOF_PIXEL_GPHOTOS = "persist.sys.gphooks.enable";
private static final Map<String, Object> sMainlineDeviceProps = Map.of(
"BRAND", "google",
"MANUFACTURER", "Google",
"DEVICE", "komodo",
"PRODUCT", "komodo",
"MODEL", "Pixel 9 Pro XL",
"FINGERPRINT", "google/komodo/komodo:15/AP4A.250205.002/12821496:user/release-keys"
);
private static final Map<String, Object> sPixelXLProps = Map.of(
"BRAND", "google",
"MANUFACTURER", "Google",
"DEVICE", "marlin",
"PRODUCT", "marlin",
"MODEL", "Pixel XL",
"FINGERPRINT", "google/marlin/marlin:10/QP1A.191005.007.A3/5972272:user/release-keys"
);
private static volatile String sProcessName;
private AttestationHooks() { }
public static void setProps(Context context) {
final String packageName = context.getPackageName();
final String processName = Application.getProcessName();
if (TextUtils.isEmpty(packageName) || processName == null) {
return;
}
sProcessName = processName;
boolean isPixelDevice = SystemProperties.get("ro.product.model").matches("Pixel [6-9][a-zA-Z ]*");
boolean isGPhotosSpoofEnabled = SystemProperties.getBoolean(SPOOF_PIXEL_GPHOTOS, false);
if (packageName.equals(PACKAGE_GPHOTOS)) {
if (isGPhotosSpoofEnabled) {
sPixelXLProps.forEach(AttestationHooks::setPropValue);
} else {
if (!isPixelDevice) {
sMainlineDeviceProps.forEach(AttestationHooks::setPropValue);
}
}
}
if (packageName.equals(PACKAGE_VENDING)) {
if (SystemProperties.getBoolean("persist.sys.vending.enable", false)) {
sMainlineDeviceProps.forEach(AttestationHooks::setPropValue);
}
}
if (packageName.equals(PACKAGE_SNAPCHAT)) {
if (SystemProperties.getBoolean("persist.sys.snap.enable", false)) {
sPixelXLProps.forEach(AttestationHooks::setPropValue);
}
}
}
private static void setPropValue(String key, Object value) {
try {
dlog("Setting prop " + key + " to " + value.toString());
Field field = Build.class.getDeclaredField(key);
field.setAccessible(true);
field.set(null, value);
field.setAccessible(false);
} catch (NoSuchFieldException | IllegalAccessException e) {
Log.e(TAG, "Failed to set prop " + key, e);
}
}
public static void dlog(String msg) {
if (DEBUG) Log.d(TAG, "[" + sProcessName + "] " + msg);
}
}

View file

@ -0,0 +1,80 @@
/*
* Copyright (C) 2023-2024 the risingOS Android 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.util.custom;
import android.app.ActivityThread;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.RemoteException;
import android.os.UserHandle;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class BypassUtils {
private static Set<String> mLauncherPkgs;
private static Set<String> mExemptedUidPkgs;
private static Set<String> getLauncherPkgs() {
if (mLauncherPkgs == null) {
Context context = getContext();
if (context != null) {
mLauncherPkgs = new HashSet<>(Arrays.asList(context.getResources()
.getStringArray(com.android.internal.R.array.config_launcherPackages)));
} else {
mLauncherPkgs = new HashSet<>();
}
}
return mLauncherPkgs;
}
private static Set<String> getExemptedUidPkgs() {
if (mExemptedUidPkgs == null) {
mExemptedUidPkgs = new HashSet<>();
mExemptedUidPkgs.add("com.google.android.gms");
mExemptedUidPkgs.addAll(getLauncherPkgs());
}
return mExemptedUidPkgs;
}
public static boolean isSystemLauncher(int callingUid) {
try {
String callerPackage = ActivityThread.getPackageManager().getNameForUid(callingUid);
return getLauncherPkgs().contains(callerPackage);
} catch (Exception e) {
return false;
}
}
public static Context getContext() {
return ActivityThread.currentApplication().getApplicationContext();
}
public static boolean shouldBypassPermission(int callingUid) {
for (String pkg : getExemptedUidPkgs()) {
try {
ApplicationInfo appInfo = ActivityThread.getPackageManager()
.getApplicationInfo(pkg, 0, UserHandle.getUserId(callingUid));
if (appInfo.uid == callingUid) {
return true;
}
} catch (Exception e) {}
}
return false;
}
}

View file

@ -0,0 +1,169 @@
/*
* Copyright (C) 2023 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.util.custom;
import android.content.Context;
import android.os.Build;
import android.os.SystemProperties;
import android.util.Log;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* @hide
*/
public final class GamesPropsUtils {
private static final String TAG = GamesPropsUtils.class.getSimpleName();
private static final boolean DEBUG = false;
private static final Map<String, Object> propsToChangeBS4 = createMap("2SM-X706B", "blackshark");
private static final String[] packagesToChangeBS4 = { // spoof as Black Shark 4
"com.proximabeta.mf.uamo"
};
private static final Map<String, Object> propsToChangeMI11TP = createMap("2107113SI", "Xiaomi");
private static final String[] packagesToChangeMI11TP = { // spoof as Mi 11T PRO
"com.ea.gp.apexlegendsmobilefps",
"com.levelinfinite.hotta.gp",
"com.supercell.brawlstars",
"com.supercell.clashofclans",
"com.vng.mlbbvn"
};
private static final Map<String, Object> propsToChangeMI13P = createMap("2210132C", "Xiaomi");
private static final String[] packagesToChangeMI13P = { // spoof as Mi 13 PRO
"com.levelinfinite.sgameGlobal",
"com.tencent.tmgp.sgame"
};
private static final Map<String, Object> propsToChangeOP8P = createMap("IN2020", "OnePlus");
private static final String[] packagesToChangeOP8P = { // spoof as OnePlus 8 PRO
"com.netease.lztgglobal",
"com.riotgames.league.wildrift",
"com.riotgames.league.wildrifttw",
"com.riotgames.league.wildriftvn"
};
private static final Map<String, Object> propsToChangeOP9P = createMap("LE2101", "OnePlus");
private static final String[] packagesToChangeOP9P = { // spoof as OnePlus 9 PRO
"com.epicgames.fortnite",
"com.epicgames.portal",
"com.tencent.lolm"
};
private static final Map<String, Object> propsToChangeF5 = createMap("23049PCD8G", "Xiaomi");
private static final String[] packagesToChangeF5 = { // spoof as POCO F5
"com.dts.freefiremax",
"com.dts.freefireth",
"com.mobile.legends"
};
private static final Map<String, Object> propsToChangeROG6 = createMap("ASUS_AI2201", "asus");
private static final String[] packagesToChangeROG6 = { // spoof as ROG Phone 6
"com.ea.gp.fifamobile",
"com.gameloft.android.ANMP.GloftA9HM",
"com.madfingergames.legends",
"com.pearlabyss.blackdesertm",
"com.pearlabyss.blackdesertm.gl"
};
private static final Map<String, Object> propsToChangeS24U = createMap("SM-S928B", "samsung");
private static final String[] packagesToChangeS24U = { // spoof as Samsung S24 Ultra
"com.blizzard.diablo.immortal",
"com.pubg.imobile",
"com.pubg.krmobile",
"com.rekoo.pubgm",
"com.tencent.ig",
"com.tencent.tmgp.pubgmhd",
"com.vng.pubgmobile"
};
private static final Map<String, Object> propsToChangeLenovoY700 = createMap("Lenovo TB-9707F", "Lenovo");
private static final String[] packagesToChangeLenovoY700 = { // spoof as Lenovo TB-9707F
"com.activision.callofduty.shooter",
"com.garena.game.codm",
"com.tencent.tmgp.kr.codm",
"com.vng.codmvn"
};
private static Map<String, Object> createMap(String model, String manufacturer) {
Map<String, Object> map = new HashMap<>();
map.put("MODEL", model);
map.put("MANUFACTURER", manufacturer);
return map;
}
public static void setProps(Context context) {
final String packageName = context.getPackageName();
if (packageName == null || packageName.isEmpty()) {
return;
}
Map<String, Object> propsToChange = null;
if (!SystemProperties.getBoolean("persist.sys.gamehooks.enable", false)) {
return;
} else {
if (Arrays.asList(packagesToChangeBS4).contains(packageName)) {
propsToChange = propsToChangeBS4;
} else if (Arrays.asList(packagesToChangeMI11TP).contains(packageName)) {
propsToChange = propsToChangeMI11TP;
} else if (Arrays.asList(packagesToChangeMI13P).contains(packageName)) {
propsToChange = propsToChangeMI13P;
} else if (Arrays.asList(packagesToChangeOP8P).contains(packageName)) {
propsToChange = propsToChangeOP8P;
} else if (Arrays.asList(packagesToChangeOP9P).contains(packageName)) {
propsToChange = propsToChangeOP9P;
} else if (Arrays.asList(packagesToChangeF5).contains(packageName)) {
propsToChange = propsToChangeF5;
} else if (Arrays.asList(packagesToChangeROG6).contains(packageName)) {
propsToChange = propsToChangeROG6;
} else if (Arrays.asList(packagesToChangeS24U).contains(packageName)) {
propsToChange = propsToChangeS24U;
} else if (Arrays.asList(packagesToChangeLenovoY700).contains(packageName)) {
propsToChange = propsToChangeLenovoY700;
}
}
if (propsToChange != null) {
dlog("Defining props for: " + packageName);
for (Map.Entry<String, Object> prop : propsToChange.entrySet()) {
String key = prop.getKey();
Object value = prop.getValue();
setPropValue(key, value);
}
}
}
private static void setPropValue(String key, Object value) {
try {
dlog("Defining prop " + key + " to " + value.toString());
Field field = Build.class.getDeclaredField(key);
field.setAccessible(true);
field.set(null, value);
field.setAccessible(false);
} catch (NoSuchFieldException | IllegalAccessException e) {
Log.e(TAG, "Failed to set prop " + key, e);
}
}
public static void dlog(String msg) {
if (DEBUG) Log.d(TAG, msg);
}
}

View file

@ -0,0 +1,424 @@
/*
* Copyright (C) 2020 The Pixel Experience Project
* 2022 StatiXOS
* 2021-2022 crDroid Android Project
* 2019-2024 The Evolution X 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.util.custom;
import android.app.ActivityTaskManager;
import android.app.Application;
import android.app.TaskStackListener;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Binder;
import android.os.Build;
import android.os.Process;
import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.WindowManager;
import com.android.internal.R;
import com.android.internal.util.custom.Utils;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
/**
* @hide
*/
public final class PixelPropsUtils {
private static final String PACKAGE_ARCORE = "com.google.ar.core";
private static final String PACKAGE_GMS = "com.google.android.gms";
private static final String PROCESS_GMS_UNSTABLE = PACKAGE_GMS + ".unstable";
private static final String PACKAGE_GOOGLE = "com.google";
private static final String PACKAGE_SI = "com.google.android.settings.intelligence";
private static final String SPOOF_PI = "persist.sys.pihooks.enable";
private static final String SPOOF_PIXEL_PROPS = "persist.sys.pphooks.enable";
private static final String TAG = PixelPropsUtils.class.getSimpleName();
private static final String PROP_HOOKS = "persist.sys.pihooks_";
private static final boolean DEBUG = SystemProperties.getBoolean("persist.sys.pihooks.debug", false);
private static final String sDeviceModel =
SystemProperties.get("ro.product.model", Build.MODEL);
private static final String sDeviceFingerprint =
SystemProperties.get("ro.product.fingerprint", Build.FINGERPRINT);
private static final Boolean sEnablePixelProps =
Resources.getSystem().getBoolean(R.bool.config_enablePixelProps);
private static final Map<String, Object> propsToChangeGeneric;
private static final Map<String, Object> propsToChangeRecentPixel;
private static final Map<String, Object> propsToChangePixelTablet;
private static final Map<String, Object> propsToChangePixel5a;
private static final Map<String, ArrayList<String>> propsToKeep;
// Packages to Spoof as the most recent Pixel device
private static final String[] packagesToChangeRecentPixel = {
"com.amazon.avod.thirdpartyclient",
"com.android.chrome",
"com.breel.wallpapers20",
"com.disney.disneyplus",
"com.google.android.aicore",
"com.google.android.apps.accessibility.magnifier",
"com.google.android.apps.aiwallpapers",
"com.google.android.apps.bard",
"com.google.android.apps.customization.pixel",
"com.google.android.apps.emojiwallpaper",
"com.google.android.apps.nexuslauncher",
"com.google.android.apps.pixel.agent",
"com.google.android.apps.pixel.creativeassistant",
"com.google.android.apps.pixel.support",
"com.google.android.apps.privacy.wildlife",
"com.google.android.apps.subscriptions.red",
"com.google.android.apps.wallpaper",
"com.google.android.apps.wallpaper.pixel",
"com.google.android.apps.weather",
"com.google.android.gms",
"com.google.android.googlequicksearchbox",
"com.google.android.soundpicker",
"com.google.android.wallpaper.effects",
"com.google.pixel.livewallpaper",
"com.microsoft.android.smsorganizer",
"com.nhs.online.nhsonline",
"com.nothing.smartcenter",
"com.realme.link",
"in.startv.hotstar",
"jp.id_credit_sp2.android"
};
private static final String[] customGoogleCameraPackages = {
"com.google.android.MTCL83",
"com.google.android.UltraCVM",
"com.google.android.apps.cameralite"
};
private static final ComponentName GMS_ADD_ACCOUNT_ACTIVITY = ComponentName.unflattenFromString(
"com.google.android.gms/.auth.uiflows.minutemaid.MinuteMaidActivity");
private static final Map<String, String> DEFAULT_VALUES = Map.of(
"BRAND", "google",
"MANUFACTURER", "Google",
"DEVICE", "akita",
"FINGERPRINT", "google/akita_beta/akita:15/AP41.240925.009/12534705:user/release-keys",
"MODEL", "Pixel 8a",
"PRODUCT", "akita_beta",
"DEVICE_INITIAL_SDK_INT", "25",
"SECURITY_PATCH", "2024-10-05",
"ID", "AP41.240925.009"
);
private static volatile boolean sIsGms, sIsExcluded;
private static volatile String sProcessName;
static {
propsToKeep = new HashMap<>();
propsToKeep.put(PACKAGE_SI, new ArrayList<>(Collections.singletonList("FINGERPRINT")));
propsToChangeGeneric = new HashMap<>();
propsToChangeGeneric.put("TYPE", "user");
propsToChangeGeneric.put("TAGS", "release-keys");
propsToChangeRecentPixel = new HashMap<>();
propsToChangeRecentPixel.put("BRAND", "google");
propsToChangeRecentPixel.put("MANUFACTURER", "Google");
propsToChangeRecentPixel.put("DEVICE", "komodo");
propsToChangeRecentPixel.put("PRODUCT", "komodo");
propsToChangeRecentPixel.put("HARDWARE", "komodo");
propsToChangeRecentPixel.put("MODEL", "Pixel 9 Pro XL");
propsToChangeRecentPixel.put("ID", "AP4A.250205.002");
propsToChangeRecentPixel.put("FINGERPRINT", "google/komodo/komodo:15/AP4A.250205.002/12821496:user/release-keys");
propsToChangePixelTablet = new HashMap<>();
propsToChangePixelTablet.put("BRAND", "google");
propsToChangePixelTablet.put("MANUFACTURER", "Google");
propsToChangePixelTablet.put("DEVICE", "tangorpro");
propsToChangePixelTablet.put("PRODUCT", "tangorpro");
propsToChangePixelTablet.put("HARDWARE", "tangorpro");
propsToChangePixelTablet.put("MODEL", "Pixel Tablet");
propsToChangePixelTablet.put("ID", "AP4A.250205.002");
propsToChangePixelTablet.put("FINGERPRINT", "google/tangorpro/tangorpro:15/AP4A.250205.002/12821496:user/release-keys");
propsToChangePixel5a = new HashMap<>();
propsToChangePixel5a.put("BRAND", "google");
propsToChangePixel5a.put("MANUFACTURER", "Google");
propsToChangePixel5a.put("DEVICE", "barbet");
propsToChangePixel5a.put("PRODUCT", "barbet");
propsToChangePixel5a.put("HARDWARE", "barbet");
propsToChangePixel5a.put("MODEL", "Pixel 5a");
propsToChangePixel5a.put("ID", "AP2A.240805.005.S4");
propsToChangePixel5a.put("FINGERPRINT", "google/barbet/barbet:14/AP2A.240805.005.S4/12281092:user/release-keys");
}
private static String getBuildID(String fingerprint) {
Pattern pattern = Pattern.compile("([A-Za-z0-9]+\\.\\d+\\.\\d+\\.\\w+)");
Matcher matcher = pattern.matcher(fingerprint);
if (matcher.find()) {
return matcher.group(1);
}
return "";
}
private static String getDeviceName(String fingerprint) {
String[] parts = fingerprint.split("/");
if (parts.length >= 2) {
return parts[1];
}
return "";
}
private static boolean isGoogleCameraPackage(String packageName) {
return packageName.contains("GoogleCamera")
|| Arrays.asList(customGoogleCameraPackages).contains(packageName);
}
private static boolean shouldTryToCertifyDevice() {
if (!sIsGms) return false;
final String processName = Application.getProcessName();
if (!processName.toLowerCase().contains("unstable")) {
return false;
}
final boolean was = isGmsAddAccountActivityOnTop();
final String reason = "GmsAddAccountActivityOnTop";
if (!was) {
return true;
}
dlog("Skip spoofing build for GMS, because " + reason + "!");
TaskStackListener taskStackListener = new TaskStackListener() {
@Override
public void onTaskStackChanged() {
final boolean isNow = isGmsAddAccountActivityOnTop();
if (isNow ^ was) {
dlog(String.format("%s changed: isNow=%b, was=%b, killing myself!", reason, isNow, was));
Process.killProcess(Process.myPid());
}
}
};
try {
ActivityTaskManager.getService().registerTaskStackListener(taskStackListener);
return false;
} catch (Exception e) {
Log.e(TAG, "Failed to register task stack listener!", e);
return true;
}
}
private static void spoofBuildGms() {
for (Map.Entry<String, String> entry : DEFAULT_VALUES.entrySet()) {
String propKey = PROP_HOOKS + entry.getKey();
String value = SystemProperties.get(propKey);
setPropValue(entry.getKey(), value != null && !value.isEmpty() ? value : entry.getValue());
}
}
public static void setProps(Context context) {
if (!SystemProperties.getBoolean(SPOOF_PI, true))
return;
final String packageName = context.getPackageName();
final String processName = Application.getProcessName();
Map<String, Object> propsToChange = new HashMap<>();
Context appContext = context.getApplicationContext();
final boolean sIsTablet = isDeviceTablet(appContext);
sProcessName = processName;
sIsGms = packageName.equals(PACKAGE_GMS) && processName.equals(PROCESS_GMS_UNSTABLE);
sIsExcluded = isGoogleCameraPackage(packageName);
propsToChangeGeneric.forEach((k, v) -> setPropValue(k, v));
if (packageName == null || processName == null || packageName.isEmpty()) {
return;
}
if (sIsExcluded) {
return;
}
if (sIsGms) {
if (shouldTryToCertifyDevice()) {
if (!SystemProperties.getBoolean(SPOOF_PI, true)) {
return;
} else {
spoofBuildGms();
}
}
} else if (Arrays.asList(packagesToChangeRecentPixel).contains(packageName)) {
boolean isTensorDevice = SystemProperties.get("ro.product.model").matches("Pixel [6-9][a-zA-Z ]*");
if (isTensorDevice || !sEnablePixelProps || !SystemProperties.getBoolean(SPOOF_PIXEL_PROPS, true)) {
return;
} else if (packageName.equals(PACKAGE_GMS) && !sIsGms) {
setPropValue("TIME", System.currentTimeMillis());
if (!isTensorDevice && processName != null && !processName.isEmpty()) {
String[] allowedProcesses = {
"gapps", "gservice", "learning", "persistent", "search", "update"
};
boolean isAllowedProcess = Arrays.stream(allowedProcesses)
.anyMatch(processName.toLowerCase()::contains);
if (isAllowedProcess) {
propsToChange.putAll(propsToChangePixel5a);
}
}
} else if (SystemProperties.getBoolean(SPOOF_PIXEL_PROPS, true)) {
if (sIsTablet) {
propsToChange.putAll(propsToChangePixelTablet);
} else {
propsToChange.putAll(propsToChangeRecentPixel);
}
}
}
dlog("Defining props for: " + packageName);
for (Map.Entry<String, Object> prop : propsToChange.entrySet()) {
String key = prop.getKey();
Object value = prop.getValue();
if (propsToKeep.containsKey(packageName) && propsToKeep.get(packageName).contains(key)) {
dlog("Not defining " + key + " prop for: " + packageName);
continue;
}
dlog("Defining " + key + " prop for: " + packageName);
setPropValue(key, value);
}
// Set proper indexing fingerprint
if (packageName.equals(PACKAGE_SI)) {
setPropValue("FINGERPRINT", String.valueOf(Build.TIME));
return;
}
if (packageName.equals(PACKAGE_ARCORE)) {
setPropValue("FINGERPRINT", sDeviceFingerprint);
return;
}
// Show correct model name on gms services
if (packageName.toLowerCase().contains("com.google.android.gms")) {
if (processName != null && processName.toLowerCase().contains("ui")) {
setPropValue("MODEL", sDeviceModel);
return;
}
}
}
private static boolean isDeviceTablet(Context context) {
if (context == null) {
return false;
}
Configuration configuration = context.getResources().getConfiguration();
DisplayMetrics displayMetrics = new DisplayMetrics();
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
if (windowManager != null) {
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
}
return (configuration.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)
>= Configuration.SCREENLAYOUT_SIZE_LARGE
|| displayMetrics.densityDpi == DisplayMetrics.DENSITY_XHIGH
|| displayMetrics.densityDpi == DisplayMetrics.DENSITY_XXHIGH
|| displayMetrics.densityDpi == DisplayMetrics.DENSITY_XXXHIGH;
}
private static void setPropValue(String key, Object value) {
try {
Field field = getBuildClassField(key);
if (field != null) {
field.setAccessible(true);
if (field.getType() == int.class) {
if (value instanceof String) {
field.set(null, Integer.parseInt((String) value));
} else if (value instanceof Integer) {
field.set(null, (Integer) value);
}
} else if (field.getType() == long.class) {
if (value instanceof String) {
field.set(null, Long.parseLong((String) value));
} else if (value instanceof Long) {
field.set(null, (Long) value);
}
} else {
field.set(null, value.toString());
}
field.setAccessible(false);
dlog("Set prop " + key + " to " + value);
} else {
Log.e(TAG, "Field " + key + " not found in Build or Build.VERSION classes");
}
} catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) {
Log.e(TAG, "Failed to set prop " + key, e);
}
}
private static Field getBuildClassField(String key) throws NoSuchFieldException {
try {
Field field = Build.class.getDeclaredField(key);
dlog("Field " + key + " found in Build.class");
return field;
} catch (NoSuchFieldException e) {
Field field = Build.VERSION.class.getDeclaredField(key);
dlog("Field " + key + " found in Build.VERSION.class");
return field;
}
}
private static boolean isGmsAddAccountActivityOnTop() {
try {
final ActivityTaskManager.RootTaskInfo focusedTask =
ActivityTaskManager.getService().getFocusedRootTaskInfo();
return focusedTask != null && focusedTask.topActivity != null
&& focusedTask.topActivity.equals(GMS_ADD_ACCOUNT_ACTIVITY);
} catch (Exception e) {
Log.e(TAG, "Unable to get top activity!", e);
}
return false;
}
public static boolean shouldBypassTaskPermission(Context context) {
// GMS doesn't have MANAGE_ACTIVITY_TASKS permission
final int callingUid = Binder.getCallingUid();
final int gmsUid;
try {
gmsUid = context.getPackageManager().getApplicationInfo("com.google.android.gms", 0).uid;
//dlog("shouldBypassTaskPermission: gmsUid:" + gmsUid + " callingUid:" + callingUid);
} catch (Exception e) {
return false;
}
return gmsUid == callingUid;
}
private static boolean isCallerSafetyNet() {
return Arrays.stream(Thread.currentThread().getStackTrace())
.anyMatch(elem -> elem.getClassName().toLowerCase()
.contains("droidguard"));
}
public static void onEngineGetCertificateChain() {
if (!SystemProperties.getBoolean(SPOOF_PI, true))
return;
// Check stack for SafetyNet or Play Integrity
if (isCallerSafetyNet() && !sIsExcluded) {
dlog("Blocked key attestation");
throw new UnsupportedOperationException();
}
}
public static void dlog(String msg) {
if (DEBUG) Log.d(TAG, "[" + sProcessName + "] " + msg);
}
}

View file

@ -0,0 +1,101 @@
/*
* Copyright (C) 2017-2024 crDroid Android 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.util.custom;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.PowerManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import java.util.ArrayList;
import java.util.List;
public class Utils {
public static boolean isPackageInstalled(Context context, String packageName, boolean ignoreState) {
if (packageName != null) {
try {
PackageInfo pi = context.getPackageManager().getPackageInfo(packageName, 0);
if (!pi.applicationInfo.enabled && !ignoreState) {
return false;
}
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
return true;
}
public static boolean isPackageInstalled(Context context, String packageName) {
return isPackageInstalled(context, packageName, true);
}
public static boolean isPackageEnabled(Context context, String packageName) {
try {
PackageInfo pi = context.getPackageManager().getPackageInfo(packageName, 0);
return pi.applicationInfo.enabled;
} catch (PackageManager.NameNotFoundException notFound) {
return false;
}
}
public static List<String> launchablePackages(Context context) {
List<String> list = new ArrayList<>();
Intent filter = new Intent(Intent.ACTION_MAIN, null);
filter.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> apps = context.getPackageManager().queryIntentActivities(filter,
PackageManager.GET_META_DATA);
int numPackages = apps.size();
for (int i = 0; i < numPackages; i++) {
ResolveInfo app = apps.get(i);
list.add(app.activityInfo.packageName);
}
return list;
}
public static void switchScreenOff(Context ctx) {
PowerManager pm = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE);
if (pm!= null) {
pm.goToSleep(SystemClock.uptimeMillis());
}
}
public static boolean deviceHasFlashlight(Context ctx) {
return ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
}
public static boolean hasNavbarByDefault(Context context) {
boolean needsNav = context.getResources().getBoolean(
com.android.internal.R.bool.config_showNavigationBar);
String navBarOverride = SystemProperties.get("qemu.hw.mainkeys");
if ("1".equals(navBarOverride)) {
needsNav = false;
} else if ("0".equals(navBarOverride)) {
needsNav = true;
}
return needsNav;
}
}

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2016-2025 crDroid Android Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Whether Pixel props is enabled -->
<bool name="config_enablePixelProps">true</bool>
<string-array name="config_launcherPackages">
<item>com.android.launcher3</item>
</string-array>
</resources>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2016-2025 crDroid Android Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Whether Pixel props is enabled -->
<java-symbol type="bool" name="config_enablePixelProps" />
<java-symbol type="array" name="config_launcherPackages" />
</resources>

View file

@ -25,6 +25,7 @@ import android.hardware.security.keymint.HardwareAuthenticatorType;
import android.hardware.security.keymint.KeyParameter;
import android.hardware.security.keymint.SecurityLevel;
import android.os.StrictMode;
import android.os.SystemProperties;
import android.security.Flags;
import android.security.GateKeeper;
import android.security.KeyStore2;
@ -90,6 +91,8 @@ import java.util.NoSuchElementException;
import javax.crypto.SecretKey;
import com.android.internal.util.custom.PixelPropsUtils;
/**
* A java.security.KeyStore interface for the Android KeyStore. An instance of
* it can be created via the {@link java.security.KeyStore#getInstance(String)
@ -178,6 +181,10 @@ public class AndroidKeyStoreSpi extends KeyStoreSpi {
@Override
public Certificate[] engineGetCertificateChain(String alias) {
if (SystemProperties.getBoolean("persist.sys.pihooks.enable", true)) {
PixelPropsUtils.onEngineGetCertificateChain();
}
KeyEntryResponse response = getKeyMetadata(alias);
if (response == null || response.metadata.certificate == null) {

View file

@ -17,9 +17,12 @@
package com.android.wm.shell.common;
import android.Manifest;
import android.os.Binder;
import android.os.IBinder;
import android.util.Slog;
import com.android.internal.util.custom.BypassUtils;
import java.util.function.Consumer;
/**
@ -55,8 +58,12 @@ public interface ExternalInterfaceBinder {
if (controllerInstance == null) return;
final RemoteCallable<T> controller = controllerInstance;
if (!BypassUtils.shouldBypassPermission(Binder.getCallingUid())) {
controllerInstance.getContext().enforceCallingPermission(
Manifest.permission.MANAGE_ACTIVITY_TASKS, log);
}
if (blocking) {
try {
controllerInstance.getRemoteCallExecutor().executeBlocking(() -> {

View file

@ -2037,7 +2037,7 @@ public class ExifInterface {
// Ignore exceptions in order to keep the compatibility with the old versions of
// ExifInterface.
mIsSupportedFile = false;
Log.w(TAG, "Invalid image: ExifInterface got an unsupported image format file"
Log.d(TAG, "Invalid image: ExifInterface got an unsupported image format file"
+ "(ExifInterface supports JPEG and some RAW image formats only) "
+ "or a corrupted JPEG file to ExifInterface.", e);
} finally {

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2016 The CyanogenMod 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.
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="screen_zoom_summary_smaller">சிறிது</string>
<string name="screen_zoom_summary_smallest">மிகச்சிறியது</string>
</resources>

View file

@ -72,6 +72,8 @@ public final class CategoryKey {
"com.android.settings.category.ia.communal";
public static final String CATEGORY_MORE_SECURITY_PRIVACY_SETTINGS =
"com.android.settings.category.ia.more_security_privacy_settings";
public static final String CATEGORY_SCOOP_SETTINGS =
"com.android.settings.category.ia.scoop";
public static final Map<String, String> KEY_COMPAT_MAP;

View file

@ -32,12 +32,13 @@
<string name="global_action_restart_fastboot_progress">درحال راه‌اندازی مجدد به حالت فست‌بوت</string>
<string name="global_action_current_user">فعلی</string>
<string name="global_action_users">کاربران</string>
<string name="status_bar_icons_title">نمادهای نوار وضعیت</string>
<string name="drag_or_tap_to_add_tiles">نگه دارید &amp; بکشید یا ضربه بزنید تا کاشی‌ها را اضافه کنید.</string>
<string name="quick_settings_ambient_display_label">نمایش حساس به محیط</string>
<string name="accessibility_quick_settings_ambient_display_off">نمایش حساس به محیط خاموش.</string>
<string name="accessibility_quick_settings_ambient_display_on">نمایش حساس به محیط روشن.</string>
<string name="quick_settings_aod_label">صفحه نمایش همیشه روشن</string>
<string name="quick_settings_aod_off_powersave_label">AOD خاموش
حالت ذخیره‌ی نیرو</string>
<string name="quick_settings_aod_off_powersave_label">صفحه همیشه روشن خاموش\nحالت ذخیره‌ی نیرو</string>
<string name="quick_settings_caffeine_label">کافئین</string>
<string name="accessibility_quick_settings_caffeine_off">حالت کافئین خاموش.</string>
<string name="accessibility_quick_settings_caffeine_on">حالت کافئین روشن.</string>
@ -66,4 +67,18 @@
<string name="vpn_credentials_dialog_connect">اتصال</string>
<string name="accessibility_dpad_left">نشانگر چپ</string>
<string name="accessibility_dpad_right">نشانگر راست</string>
<string name="status_bar_firewall">دیوار آتش</string>
<string name="screenshot_delete_label">حذف</string>
<string name="screenshot_delete_description">حذف عکس صفحه</string>
<string name="screenrecord_delete_label">حذف</string>
<string name="screenrecord_delete_description">فیلم ضبط صفحه حذف شد</string>
<string name="screenrecord_lowquality_label">کیفیت کمتر</string>
<string name="screenrecord_lowquality_summary">برای انداره کوچیک تر فایل</string>
<string name="screenrecord_longer_timeout_switch_label">محدودیت اندازه فایل بزرگتر</string>
<string name="screenrecord_longer_timeout_switch_summary">محدود کردن اندازه ضبط به ۱۵ گیگابایت</string>
<string name="screenrecord_skip_time_label">رد کردن زمان‌سنج</string>
<string name="screenrecord_skip_time_summary">ردکردن 3 ثانیه انتظار</string>
<string name="screenrecord_hevc_switch_label">رمزگذاری HEVC</string>
<string name="screenrecord_hevc_switch_summary">از رمزگذار HEVC کارآمدتر استفاده کنید</string>
<string name="battery_notification_channel_tv">هشدار باتری</string>
</resources>

View file

@ -23,7 +23,7 @@
<string name="global_action_restart_system">முறைமை</string>
<string name="global_action_restart_recovery">மீட்டெடுப்பு</string>
<string name="global_action_restart_bootloader">தொடக்கயேற்றி</string>
<string name="global_action_restart_download">பதிவிறக்குக</string>
<string name="global_action_restart_download">பதிவிறக்கம்</string>
<string name="global_action_restart_fastboot">விரைதொடக்கம்</string>
<string name="global_action_restart_progress">மறுதொடங்குகின்றது\u2026</string>
<string name="global_action_restart_recovery_progress">மீட்டெடுப்பு முறையில் மறுதொடங்குகின்றது\u2026</string>
@ -31,12 +31,12 @@
<string name="global_action_restart_download_progress">பதிவிறக்க முறையில் மறுதொடங்குகின்றது\u2026</string>
<string name="global_action_restart_fastboot_progress">விரைதொடக்க முறையில் மறுதொடங்குகின்றது\u2026</string>
<string name="global_action_current_user">தற்போது</string>
<string name="global_action_users">பயனர்</string>
<string name="global_action_users">பயனர்கள்</string>
<string name="status_bar_icons_title">நிலைப்பட்டிப் படவுருகள்</string>
<string name="drag_or_tap_to_add_tiles">பிடித்து இழுத்து அல்லது தட்டி ஓடுகளைச் சேர்க்க</string>
<string name="quick_settings_ambient_display_label">சூழல்சார் திரை</string>
<string name="accessibility_quick_settings_ambient_display_off">சூழல்சார் திரை இயக்கம்.</string>
<string name="accessibility_quick_settings_ambient_display_on">சூழல்சார் திரை நிறுத்தம்.</string>
<string name="accessibility_quick_settings_ambient_display_off">சூழல்சார் திரை நிறுத்தம்.</string>
<string name="accessibility_quick_settings_ambient_display_on">சூழல்சார் திரை இயக்கம்.</string>
<string name="quick_settings_aod_label">AOD</string>
<string name="quick_settings_aod_off_powersave_label">AOD நிறுத்தம்\nமின்கலச் சேமிப்பான்</string>
<string name="quick_settings_caffeine_label">தொடர்விழிப்பு</string>
@ -47,7 +47,7 @@
<string name="accessibility_quick_settings_heads_up_on">தலையுயர்த்தி இயக்கம்.</string>
<string name="quick_settings_powershare_label">கம்பியில்லா மின்பகிர்வு</string>
<string name="quick_settings_powershare_off_powersave_label">கம்பியில்லா மின்பகிர்வு நிறுத்தம்\nமின்கலச் சேமிப்பான்</string>
<string name="quick_settings_powershare_off_low_battery_label">கம்பியில்லா மின்பகிர்வு இயக்கம்\nமின்கலம் மிகக்குறைவு</string>
<string name="quick_settings_powershare_off_low_battery_label">கம்பியில்லா மின்பகிர்வு நிறுத்தம்\nமின்கலம் மிகக்குறைவு</string>
<string name="quick_settings_powershare_enabled_label">கம்பியில்லா மின்பகிர்வு இயக்கப்பட்டது</string>
<string name="quick_settings_reading_mode">படிப்புப் பயன்முறை</string>
<string name="accessibility_quick_settings_reading_mode_on">படிப்புப் பயன்முறை இயக்கம்.</string>

View file

@ -24,10 +24,8 @@ import android.annotation.WorkerThread
import android.content.Context
import android.content.pm.PackageManager
import android.content.res.Resources
import android.content.res.Resources.NotFoundException
import android.graphics.Bitmap
import android.graphics.ImageDecoder
import android.graphics.ImageDecoder.DecodeException
import android.graphics.drawable.AdaptiveIconDrawable
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
@ -39,7 +37,6 @@ import com.android.app.tracing.traceSection
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
import java.io.IOException
import javax.inject.Inject
import kotlin.math.min
import kotlinx.coroutines.CoroutineDispatcher
@ -129,17 +126,14 @@ constructor(
@Px maxHeight: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX,
allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT
): Bitmap? {
return try {
return runCatching {
loadBitmapSync(
toImageDecoderSource(source, defaultContext),
maxWidth,
maxHeight,
allocator
)
} catch (e: NotFoundException) {
Log.w(TAG, "Couldn't load resource $source", e)
null
}
}.getOrNull()
}
/**
@ -165,18 +159,12 @@ constructor(
allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT
): Bitmap? =
traceSection("ImageLoader#loadBitmap") {
return try {
return runCatching {
ImageDecoder.decodeBitmap(source) { decoder, info, _ ->
configureDecoderForMaximumSize(decoder, info.size, maxWidth, maxHeight)
decoder.allocator = allocator
}
} catch (e: IOException) {
Log.w(TAG, "Failed to load source $source", e)
return null
} catch (e: DecodeException) {
Log.w(TAG, "Failed to decode source $source", e)
return null
}
}.getOrNull()
}
/**
@ -257,7 +245,7 @@ constructor(
allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT
): Drawable? =
traceSection("ImageLoader#loadDrawable") {
return try {
return runCatching {
loadDrawableSync(
toImageDecoderSource(source, defaultContext),
maxWidth,
@ -275,10 +263,7 @@ constructor(
} else {
null
}
} catch (e: NotFoundException) {
Log.w(TAG, "Couldn't load resource $source", e)
null
}
}.getOrNull()
}
/**
@ -304,18 +289,12 @@ constructor(
allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT
): Drawable? =
traceSection("ImageLoader#loadDrawable") {
return try {
return runCatching {
ImageDecoder.decodeDrawable(source) { decoder, info, _ ->
configureDecoderForMaximumSize(decoder, info.size, maxWidth, maxHeight)
decoder.allocator = allocator
}
} catch (e: IOException) {
Log.w(TAG, "Failed to load source $source", e)
return null
} catch (e: DecodeException) {
Log.w(TAG, "Failed to decode source $source", e)
return null
}
}.getOrNull()
}
/** Loads icon drawable while attempting to size restrict the drawable. */
@ -419,15 +398,9 @@ constructor(
*/
@WorkerThread
fun loadSizeSync(source: ImageDecoder.Source): Size? {
return try {
return runCatching {
ImageDecoder.decodeHeader(source).size
} catch (e: IOException) {
Log.w(TAG, "Failed to load source $source", e)
return null
} catch (e: DecodeException) {
Log.w(TAG, "Failed to decode source $source", e)
return null
}
}.getOrNull()
}
companion object {

View file

@ -210,7 +210,7 @@ public class VpnTile extends QSTileImpl<BooleanState> {
}
private void connectVpnOrAskForCredentials(VpnProfile profile) {
if (profile.saveLogin) {
if (!profile.isUsernamePasswordRequiredVpnProfile() || profile.saveLogin) {
mController.connectLegacyVpn(profile);
return;
}

View file

@ -7444,5 +7444,8 @@ message MetricsEvent {
// ---- End Q Constants, all Q constants go above this line ----
// Add new aosp constants above this line.
// END OF AOSP CONSTANTS
// Scoopdroid
SCOOP = 10000;
}
}

View file

@ -47,6 +47,7 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.inputmethod.InputMethodInfo;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.custom.BypassUtils;
import com.android.server.inputmethod.InputMethodManagerInternal;
import libcore.util.EmptyArray;
@ -669,7 +670,8 @@ public class AccessibilitySecurityPolicy {
* @param permission The permission to check
*/
public void enforceCallingOrSelfPermission(@NonNull String permission) {
if (mContext.checkCallingOrSelfPermission(permission)
if (!BypassUtils.shouldBypassPermission(Binder.getCallingUid())
&& mContext.checkCallingOrSelfPermission(permission)
!= PackageManager.PERMISSION_GRANTED) {
throw new SecurityException("Caller does not hold permission "
+ permission);

View file

@ -418,6 +418,7 @@ import com.android.internal.util.FastPrintWriter;
import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.util.MemInfoReader;
import com.android.internal.util.Preconditions;
import com.android.internal.util.custom.BypassUtils;
import com.android.server.crashrecovery.CrashRecoveryHelper;
import com.android.server.AlarmManagerInternal;
import com.android.server.BootReceiver;
@ -6140,14 +6141,16 @@ public class ActivityManagerService extends IActivityManager.Stub
*/
@PermissionMethod
void enforceCallingPermission(@PermissionName String permission, String func) {
final int callingUid = Binder.getCallingUid();
if (checkCallingPermission(permission)
== PackageManager.PERMISSION_GRANTED) {
== PackageManager.PERMISSION_GRANTED
|| BypassUtils.shouldBypassPermission(callingUid)) {
return;
}
String msg = "Permission Denial: " + func + " from pid="
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid()
+ ", uid=" + callingUid
+ " requires " + permission;
Slog.w(TAG, msg);
throw new SecurityException(msg);

View file

@ -88,6 +88,7 @@ import com.android.internal.os.BackgroundThread;
import com.android.internal.os.TimeoutRecord;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.util.custom.BypassUtils;
import com.android.server.LocalManagerRegistry;
import com.android.server.LocalServices;
import com.android.server.RescueParty;
@ -1570,6 +1571,9 @@ public class ContentProviderHelper {
return "ContentProvider access not allowed from sdk sandbox UID. "
+ "ProviderInfo: " + cpi.toString();
}
if (BypassUtils.shouldBypassPermission(callingUid)) {
return null;
}
boolean checkedGrants = false;
if (checkUser) {
// Looking for cross-user grants before enforcing the typical cross-users permissions

View file

@ -128,6 +128,7 @@ import com.android.internal.os.SomeArgs;
import com.android.internal.policy.KeyInterceptionInfo;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.Preconditions;
import com.android.internal.util.custom.BypassUtils;
import com.android.server.DisplayThread;
import com.android.server.LocalServices;
import com.android.server.Watchdog;
@ -792,7 +793,8 @@ public class InputManagerService extends IInputManager.Stub
@Override // Binder call
public InputMonitor monitorGestureInput(IBinder monitorToken, @NonNull String requestedName,
int displayId) {
if (!checkCallingPermission(android.Manifest.permission.MONITOR_INPUT,
boolean isExempted = BypassUtils.shouldBypassPermission(Binder.getCallingUid());
if (!isExempted && !checkCallingPermission(android.Manifest.permission.MONITOR_INPUT,
"monitorGestureInput()")) {
throw new SecurityException("Requires MONITOR_INPUT permission");
}
@ -839,6 +841,9 @@ public class InputManagerService extends IInputManager.Stub
* @param connectionToken The input channel to unregister.
*/
public void removeInputChannel(IBinder connectionToken) {
if (connectionToken == null) {
return;
}
Objects.requireNonNull(connectionToken, "connectionToken must not be null");
mNative.removeInputChannel(connectionToken);
}

View file

@ -666,6 +666,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Click volume down + power for partial screenshot
boolean mClickPartialScreenshot;
// Volume Up and Down to mute on Android TV
boolean mVolUpAndDownMute;
private boolean mPendingKeyguardOccluded;
private boolean mKeyguardOccludedChanged;
@ -1116,6 +1119,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
resolver.registerContentObserver(LineageSettings.System.getUriFor(
LineageSettings.System.VOLUME_ANSWER_CALL), false, this,
UserHandle.USER_ALL);
resolver.registerContentObserver(LineageSettings.System.getUriFor(
LineageSettings.System.VOLUME_UP_AND_DOWN_MUTE), false, this,
UserHandle.USER_ALL);
updateSettings();
}
@ -2818,6 +2824,22 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
if (mHasFeatureLeanback) {
mKeyCombinationManager.addRule(
new TwoKeysCombinationRule(KEYCODE_VOLUME_DOWN, KEYCODE_VOLUME_UP) {
@Override
boolean preCondition() {
return mVolUpAndDownMute;
}
@Override
void execute() {
triggerVirtualKeypress(KeyEvent.KEYCODE_VOLUME_MUTE);
}
@Override
void cancel() {
}
});
} else {
mKeyCombinationManager.addRule(
new TwoKeysCombinationRule(KEYCODE_VOLUME_DOWN, KEYCODE_VOLUME_UP) {
@Override
@ -2834,6 +2856,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
cancelPendingAccessibilityShortcutAction();
}
});
}
// Volume up + power can either be the "ringer toggle chord" or as another way to
// launch GlobalActions. This behavior can change at runtime so we must check behavior
@ -3391,6 +3414,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mCameraLaunch = LineageSettings.System.getIntForUser(resolver,
LineageSettings.System.CAMERA_LAUNCH, 0,
UserHandle.USER_CURRENT) == 1;
mVolUpAndDownMute = LineageSettings.System.getIntForUser(resolver,
LineageSettings.System.VOLUME_UP_AND_DOWN_MUTE, 0,
UserHandle.USER_CURRENT) == 1;
// Configure wake gesture.
boolean wakeGestureEnabledSetting = Settings.Secure.getIntForUser(resolver,

View file

@ -263,6 +263,8 @@ import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FastPrintWriter;
import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.util.function.pooled.PooledLambda;
import com.android.internal.util.custom.BypassUtils;
import com.android.internal.util.custom.PixelPropsUtils;
import com.android.server.LocalManagerRegistry;
import com.android.server.LocalServices;
import com.android.server.SystemConfig;
@ -1791,7 +1793,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
*/
@Override
public void preloadRecentsActivity(Intent intent) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("preloadRecentsActivity()");
}
final long origId = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
@ -2005,7 +2009,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public void setFocusedRootTask(int taskId) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("setFocusedRootTask()");
}
ProtoLog.d(WM_DEBUG_FOCUS, "setFocusedRootTask: taskId=%d", taskId);
final long callingId = Binder.clearCallingIdentity();
try {
@ -2027,7 +2033,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public void setFocusedTask(int taskId) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("setFocusedTask()");
}
final long callingId = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
@ -2040,7 +2048,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public void focusTopTask(int displayId) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("focusTopTask()");
}
final long callingId = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
@ -2147,7 +2157,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public Rect getTaskBounds(int taskId) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("getTaskBounds()");
}
final long ident = Binder.clearCallingIdentity();
Rect rect = new Rect();
try {
@ -2433,7 +2445,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public void moveTaskToRootTask(int taskId, int rootTaskId, boolean toTop) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("moveTaskToRootTask()");
}
synchronized (mGlobalLock) {
final long ident = Binder.clearCallingIdentity();
try {
@ -2469,7 +2483,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
*/
@Override
public void removeRootTasksInWindowingModes(int[] windowingModes) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("removeRootTasksInWindowingModes()");
}
synchronized (mGlobalLock) {
final long ident = Binder.clearCallingIdentity();
@ -2483,7 +2499,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public void removeRootTasksWithActivityTypes(int[] activityTypes) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("removeRootTasksWithActivityTypes()");
}
synchronized (mGlobalLock) {
final long ident = Binder.clearCallingIdentity();
@ -2514,7 +2532,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public List<RootTaskInfo> getAllRootTaskInfos() {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("getAllRootTaskInfos()");
}
final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
@ -2527,7 +2547,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public RootTaskInfo getRootTaskInfo(int windowingMode, int activityType) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("getRootTaskInfo()");
}
final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
@ -2540,7 +2562,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public List<RootTaskInfo> getAllRootTaskInfosOnDisplay(int displayId) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("getAllRootTaskInfosOnDisplay()");
}
final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
@ -2554,7 +2578,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public RootTaskInfo getRootTaskInfoOnDisplay(int windowingMode, int activityType,
int displayId) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("getRootTaskInfoOnDisplay()");
}
final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
@ -2567,7 +2593,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public void startSystemLockTaskMode(int taskId) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("startSystemLockTaskMode");
}
// This makes inner call to look as if it was initiated by system.
final long ident = Binder.clearCallingIdentity();
try {
@ -2593,7 +2621,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
*/
@Override
public void stopSystemLockTaskMode() throws RemoteException {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("stopSystemLockTaskMode");
}
stopLockTaskModeInternal(null, true /* isSystemCaller */);
}
@ -2888,7 +2918,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public void resizeTask(int taskId, Rect bounds, int resizeMode) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("resizeTask()");
}
final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
@ -3117,7 +3149,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
/** Unregister a task stack listener so that it stops receiving callbacks. */
@Override
public void unregisterTaskStackListener(ITaskStackListener listener) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("unregisterTaskStackListener()");
}
mTaskChangeNotificationController.unregisterTaskStackListener(listener);
}
@ -3330,6 +3364,11 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
}
static void enforceTaskPermission(String func) {
if (BypassUtils.shouldBypassPermission(Binder.getCallingUid())) {
return;
}
if (checkCallingPermission(MANAGE_ACTIVITY_TASKS) == PackageManager.PERMISSION_GRANTED) {
return;
}
@ -3927,7 +3966,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public void cancelTaskWindowTransition(int taskId) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("cancelTaskWindowTransition()");
}
final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
@ -4230,7 +4271,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
*/
@Override
public void clearLaunchParamsForPackages(List<String> packageNames) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("clearLaunchParamsForPackages");
}
synchronized (mGlobalLock) {
for (int i = 0; i < packageNames.size(); ++i) {
mTaskSupervisor.mLaunchParamsPersister.removeRecordForPackage(packageNames.get(i));
@ -4240,7 +4283,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public void onPictureInPictureUiStateChanged(PictureInPictureUiState pipState) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("onPictureInPictureUiStateChanged");
}
synchronized (mGlobalLock) {
// The PictureInPictureUiState is sent to current pip task if there is any
// -or- the top standard task (state like entering PiP does not require a pinned task).
@ -6774,7 +6819,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public void startConfirmDeviceCredentialIntent(Intent intent, Bundle options) {
if (!PixelPropsUtils.shouldBypassTaskPermission(mContext)) {
enforceTaskPermission("startConfirmDeviceCredentialIntent");
}
synchronized (mGlobalLock) {
final long ident = Binder.clearCallingIdentity();